Create Policy Rule

POST /policies/policy-rules

Policy Rules determine when Policy Executions are created. The type of policy rule applied is determined by the kind field in the nested configuration object. These are the supported kinds:

  • AlwaysActivated: Always trigger the policy.

  • TransferAmountLimit: Trigger the policy if the transfer is over a given limit. (Wallets only.)

  • PaymentAmountLimit: Trigger the policy if the payment is over a given limit. (Asset accounts only. Deprecated)

Required Permissions

NameConditions

PolicyRules:Create

Always Required

Request body

The following fields are common to all kinds of Policy Rules:

Request body fieldsRequired/OptionalDescriptionType

name

Required

A name for the rule

String

description

Required

A description for the rule

String

configuration

Required

A nested object specifying details of the Policy Rule

Object

Amount Limit Rule

Use the following fields in the nested configuration object to create a Policy Rule which triggers a Policy Execution if the Transfer amount is over the specified amount:

Request body fieldsRequired/OptionalDescriptionType

kind

Required

Specify: "TransferAmountLimit"

Enumerated Type

limit

Required

The amount over which the policy should trigger - specified as a string

String

currency

Required

The currency used to denominate the limit field - one of "USD", "EUR"

String

Example Body:

{
    "description": "TransferAmountLimit", 
    "name": "poliy rule no.1",
    "configuration": {
        "kind": "TransferAmountLimit",
        "limit": "10",
        "currency": "USD",
    }
}

Always Activated Rule

Use the following fields in the nested configuration object to create a Policy Rule which always triggers:

Request body fieldsRequired/OptionalDescriptionType

kind

Required

Specify: "AlwaysActivated"

Enumerated Type

Example Body:

{
    "description": "AlwaysActivated", 
    "name": "poliy rule no.1",
    "configuration": {
        "kind": "AlwaysActivated"
    }
}

Response

Response example

If successful, the response contains, among other things, a status indicating whether the rule has been enabled:

{
   "id": "pr-tennessee-artist-f2078ea085",
   "version": "f1b1me4kd",
   "kind": "TransferAmountLimit",
   "orgId": "cu-purple-pip-1b417b958500",
   "author": "oe-nine-artist-9de60fef6963",
   "description": "Test Rule 1 PaymentAmountLimit",
   "name": "Test Rule 1",
   "configuration": {
       "kind": "TransferAmountLimit",
       "limit": "10",
       "currency": "USD"
   },
   "tags": [],
   "dateCreated": "2022-07-14T21:22:54.829Z",
   "status": "Enabled"
}

Last updated