Skip to main content
POST
/
approval_policies
Create an approval policy
curl --request POST \
  --url https://api.sandbox.monite.com/v1/approval_policies \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-monite-entity-id: <x-monite-entity-id>' \
  --header 'x-monite-version: <x-monite-version>' \
  --data '
{
  "name": "<string>",
  "script": [
    true
  ],
  "description": "<string>",
  "ends_at": "2023-11-07T05:31:56Z",
  "priority": 0,
  "starts_at": "2023-11-07T05:31:56Z",
  "trigger": "{amount >= 1000}"
}
'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z",
  "created_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "name": "<string>",
  "script": [
    true
  ],
  "status": "active",
  "description": "<string>",
  "ends_at": "2023-11-07T05:31:56Z",
  "priority": 0,
  "starts_at": "2023-11-07T05:31:56Z",
  "trigger": "{amount >= 1000}",
  "updated_by": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Headers

x-monite-version
string<date>
required
x-monite-entity-id
string<uuid>
required

The ID of the entity that owns the requested resource.

Example:

"9d2b4c8f-2087-4738-ba91-7359683c49a4"

Body

application/json
name
string
required

The name of the approval policy.

Maximum string length: 255
script
(boolean | number | string | any[] | object)[]
required

A list of JSON objects that represents the approval policy script. The script contains the logic that determines whether an action should be sent to approval. This field is required, and it should contain at least one script object.

description
string

A brief description of the approval policy.

Maximum string length: 255
ends_at
string<date-time>

The date and time (in the ISO 8601 format) when the approval policy stops being active and stops triggering approval workflows.If ends_at is provided in the request, then starts_at must also be provided and ends_at must be later than starts_at. The value will be converted to UTC.

priority
integer
default:0

The priority controls which approval policy takes precedence when a payable matches multiple approval policies. A higher value mean higher priority.

Required range: -32768 <= x <= 32767
starts_at
string<date-time>

The date and time (in the ISO 8601 format) when the approval policy becomes active. Only payables submitted for approval during the policy's active period will trigger this policy. If omitted or null, the policy is effective immediately. The value will be converted to UTC.

trigger

A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated.

Example:

"{amount >= 1000}"

Response

Successful Response

id
string<uuid>
required
created_at
string<date-time>
required
updated_at
string<date-time>
required
created_by
string<uuid>
required
name
string
required

The name of the approval policy.

Maximum string length: 255
script
(boolean | number | string | any[] | object)[]
required

A list of JSON objects that represents the approval policy script. The script contains the logic that determines whether an action should be sent to approval. This field is required, and it should contain at least one script object.

status
enum<string>
required

The current status of the approval policy.

Available options:
active,
pending
Example:

"active"

description
string

A brief description of the approval policy.

Maximum string length: 255
ends_at
string<date-time>

The date and time (in the ISO 8601 format) when the approval policy stops being active and stops triggering approval workflows.If ends_at is provided in the request, then starts_at must also be provided and ends_at must be later than starts_at. The value will be converted to UTC.

priority
integer
default:0

The priority controls which approval policy takes precedence when a payable matches multiple approval policies. A higher value mean higher priority.

Required range: -32768 <= x <= 32767
starts_at
string<date-time>

The date and time (in the ISO 8601 format) when the approval policy becomes active. Only payables submitted for approval during the policy's active period will trigger this policy. If omitted or null, the policy is effective immediately. The value will be converted to UTC.

trigger

A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated.

Example:

"{amount >= 1000}"

updated_by
string<uuid>