Create Policy

POST /policies

Policies join Policy Rules and Policy Controls with an activityKind that determines which actions on the API may trigger a Policy Execution. These are the supported activityKinds:

For legacy Asset Accounts, use the following:

Required Permissions

NameConditions

Policies:Create

Always Required

Request body

Request body fieldsRequired/OptionalDescriptionType

name

Required

A name for the Policy

String

description

Required

A description for the Policy

String

activityKind

Required

Determines which actions on the API may trigger a Policy Execution. See supported values above.

Enumerated Type

ruleIds

Required

Array of Policy Rule IDs to evaluate

Array of Strings

controlIds

Required

Array of Policy Control IDs to apply

Array of Strings

status

Required

"Enabled", "Disabled"

Enumerated Type

filter

Optional

Specify a list of entities to scope the policy to (eg. wallets)

Object

Filter Object

Use the following fields in the nested filter object to scope the policy to a specific entity:

Request body fieldsRequired/OptionalDescriptionType

kind

Required

Specify: "Wallet"

Enumerated Type

walletIds

Required

IDs of wallets the policy should apply to.

Array of Strings

Request Example

{
  "activityKind": "WalletsTransferAsset",
  "description": "Preventing theft",
  "name": "Anti Theft Policy",
  "ruleIds": ["pr-edward-shade-d887751054"],
  "controlIds": ["pc-music-william-failed-54497df60b"],
  "status": "Enabled",
  "filter": {
    "kind": "Wallet",
    "walletIds": ["wa-...", "wa-..."]
  }
}

Response

Response example

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

{
  "activityKind": "WalletsGenerateSignature",
  "description": "Test AlwaysActive",
  "name": "Anti Theft Policy",
  "ruleIds": [
    "pr-nebraska-november-finch-4e10e32a0d"
  ],
  "controlIds": [
    "pc-table-pennsylvania-269c9cfee9"
  ],
  "status": "Enabled",
  "id": "pl-mockingbird-seventeen-c14e223d70",
  "version": "f1d7d94gm",
  "versionedId": "pl-mockingbird-seventeen-c14e223d70@f1d7d94gm",
  "orgId": "cu-purple-pip-1b417b958500",
  "author": "oe-nine-artist-9de60fef6963",
  "dateCreated": "2022-07-19T19:58:21.334Z"
}

Last updated