---
title: "Create Basic Rule"
method: POST
path: "/pws/v2/pws_advanced_rules/"
tags: ["Rules V2"]
---

# Create Basic Rule

`POST /pws/v2/pws_advanced_rules/`

## Request

- Base URL: `https://api.uat.paymentology.com/ppws/api`
- URL: `https://api.uat.paymentology.com/ppws/api/pws/v2/pws_advanced_rules/`
- Auth: none declared

This web service allows to create different types of advanced rules. <p>Version 2 Basic Rules api support idempotency;</p>

## Request body

- AdvancedRules
  - `api_call_unique_identifier` string, required: Unique number that must be passed at each API request. Identifier to make each API request unique
  - `client_id` integer, required: Unique identifier for the client which Paymentology will provide at outset
  - `rule_desc` string, required: Rule description. Description should specific and should describe rule in a concise manner.
  - `rule_name` string, required: Rule name
  - `rule_type` string, required: Rule type : <ul><li class="docBullet">Au = Authorisation</li><li class="docBullet">Se = Settlement</li><li class="docBullet">Sc = Scheduled</li><li class="docBullet">Lo = Load</li><li class="docBullet">Un = Unload</li><li class="docBullet">Ot = Others</li><li class="docBullet">Da = Deactivated</li></ul>
  - `scope` string, required: Rule applicable scope. Values of scope can be : <ul><li class="docBullet">C=Direct card rules (These rules are held at individual card level and therefore can be personalized per card holder.)</li><li class="docBullet">G=Group rules (These rules are more generic to card program and typically used to set upper limit controls.)</li><li class="docBullet">T=Token Group rules (These rules are more generic to card program which is set at token level and typically used to set upper limit controls.)</li><li class="docBullet">A=Parent Account rules (These rules cascade down to the cards linked to all children accounts of this parent.)</li><li class="docBullet">P=Product rules (These rules are set to the product.)</li></ul>
  - `user_id` string: User Id of the Customer who triggered the API request.
  - `remarks` string: Remarks for API request
  - `token` integer: Public token for card. Required in case of scope 'C'
  - `severity` integer: Severity level. It can be 0(lowest)-10(highest). As per severity level, rules with highest severity are checked in priority
  - `group_id` integer: Group Id. Required in case of scope 'G' or 'T'
  - `amount_limit_cumulative` number: <p>This will define cumulative limit for a card within a time_window frame.</br >If you need to include cumulative amount limit, then time_window value should be set otherwise it limit will be ignored. </ br>This field will be applicable to billing currency of card.</p>
  - `time_window` string: Time window for limit.<ul><li class="docBullet">min=>Minute eg: 30min</li> <li class="docBullet">hrs=>hour eg: 12hrs</li><li class="docBullet">day=> days eg: 5day</li><li class="docBullet">wks=> weeks eg: 4wks</li><li class="docBullet">mts => Months eg: 3mts</li><li class="docBullet">yrs=> years eg: 2yrs </li> </br ></br >To include rule limit for certain time frame use like this : time_window = 30 min and amount_limit_cumulative = 1000, then within 30 min maximum of 1000 amount can be spent. </br ></br >To include rule limit for overall card lifetime, if card has expiry of 3 years : set time_window = 3yrs and amount_limit_cumulative = 1000000 </br ></br >To include rule limit for current transaction only please don't use any value for time_window field.
  - `amount_limit_single` number: This will define single transaction limit. Will be applicable to current transaction only
  - `count_limit` integer: <p>Total number of transaction count limit for given time window.</br >This value without time window will be ignored.</p>
  - `spend_type` string: Spend mode can be comma separated values of: <ul><li class="docBullet">POS (Including ECOM)</li> <li class="docBullet">ATM </li><li class="docBullet">POSCB ( Purchase with cashback)</li><li class="docBullet">CR (credit)</li><li class="docBullet">BAL (Balance inquiry)</li><li class="docBullet">PINU (Pin unblock)</li><li class="docBullet">PINC (Pin change)</li></ul>
  - `spend_types_advanced` string: Spend mode advanced can be comma separated values of: <ul><li class="docBullet">RECR (Recurring)</li> <li class="docBullet">ECOM </li><li class="docBullet">CONTL (Contactless)</li><li class="docBullet">CONF (Card on file)</li><li class="docBullet">MAG (Mag stripe)</li></ul>
  - `show_how_far_to_hit_limit` boolean: <ul><li class="docBullet">True = Rule is for limit check like (amount limit or transaction count limit)</li><li class="docBullet">False =Rule is not for limit check like (amount limit or transaction count limit)</li></ul>
  - `rule_id` integer: Rule Id To Edit. Existing rule will be updated when this value is passed.
  - `action_decline` string: Decline action,de39 response code <ul> <li class="docBullet">57 = Txn not permitted</li> <li class="docBullet">03 = Invalid merchant</li> <li class="docBullet">04 = Capture card</li> <li class="docBullet">05 = Do not honour</li> <li class="docBullet">12 = Invalid txn</li> <li class="docBullet">13 = Invalid amt</li> <li class="docBullet">14 = Invalid card no</li> <li class="docBullet">30 = Format error</li> <li class="docBullet">41 = Lost card</li> <li class="docBullet">43 = Stolen card</li> <li class="docBullet">51 = Insufficient funds</li> <li class="docBullet">54 = Expired card</li> <li class="docBullet">55 = Invalid pin</li> <li class="docBullet">57 = Txn not allowed</li> <li class="docBullet">58 = Invalid txn/terminal</li> <li class="docBullet">61 = Exceed cash limit</li> <li class="docBullet">62 = Restricted card</li> <li class="docBullet">63 = Security violation</li> <li class="docBullet">71 = Pin not changed</li> <li class="docBullet">75 = Pin tries exceeded</li> <li class="docBullet">88 = crypto Fail</li> <li class="docBullet">96 = System error</li> <li class="docBullet">70 = Contact card issuer</li> </ul>
  - `account_id` integer: Account Id. Required in case of scope 'A'
  - `product_id` integer: Product Id. Required in case of scope 'P'

## Response `200`

Successful Response

- CreateRuleResponseModel
  - `header` ResponseHeader
    - `error_id` integer: Error Id
    - `error_desc` string: Error Message
  - `body` CreateRuleResponseModelBody
    - `rule_id` integer: Rule Id

## Other responses

- `404`: Webservices does not exist
- `500`: Internal Server error

## Changes

- **2026-11-03** `73c2771493b1`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/paymentology/apis/payapi-docs/changes/pws/v2/pws_advanced_rules/post.md)

---

[API](https://skmtc.dev/paymentology/apis/payapi-docs.md) - [All operations](https://skmtc.dev/paymentology/apis/payapi-docs/llms.txt) - [OpenAPI document](https://skmtc.dev/paymentology/apis/payapi-docs/revisions/73c2771493b1?raw)
