APG PayAPG Paydocs

Reference data

Create rule policies

POST/rule-policies

Make a rule policy as a draft at version 1. The rule is checked against its template and its owner's lists, and refused with every reason if it fails.

Permissions

Required permission
rules:update

Requires the `update` action on `rules` for the supplied runtime context

Request body

This body is a tagged shape: type is always "RpolCmdCreate". Send it; more variants can be added, and a caller that switches on it keeps working when they are.

Discriminated by type
type = "RpolCmdCreate"
domainstringrequired

The area the rule is for, as ruleAreaId names it.

The tenant that owns the policy. Absent for the caller's own tenant. A platform caller names none, and acts for a tenant with its headers.

A rule: the template it is made from, and the value of each of the template's parameters. A parameter left out takes the template's default. The action is the one the template and its values take, so it is returned and never sent.

modeRpolMode

Whether the rule acts or is only recorded. Enforcing where absent.

ShadowEnforcingUnknown
descriptionstring
effectiveFromstring (date-time)

When the rule takes effect. Now where absent.

Example 2026-08-19T04:21:07Z

effectiveUntilstring (date-time)

When the rule stops taking effect. It does not, where absent.

Example 2026-08-19T04:21:07Z

reasonCodeRpolReasonrequired
NewTypologyTuningRegulatoryChangeIncidentResponseCorrectionRollbackScheduledReviewImportUnknown
reasonstring

Example Requested by the customer.

curl -X POST https://api.tst.au.apgpay.dev/rule-policies \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "type": "RpolCmdCreate",
  "domain": "string",
  "owner": {
    "type": "RpolOwnerEnterprise",
    "enterpriseId": "ent_9f2Kd8QpLzXw"
  },
  "rule": {
    "type": "RpolRuleAttributes",
    "templateId": "string",
    "arguments": [
      {
        "type": "RpolArgumentAttributes",
        "parameterId": "string",
        "value": {
          "type": "RpolValueAmount",
          "amount": {
            "type": "IsoCurrencyAmount",
            "minorCurrencyUnits": 1250,
            "currency": "AUD"
          }
        }
      }
    ],
    "action": {
      "type": "RpolActionAttributes",
      "name": "Ada Lovelace"
    }
  },
  "mode": "Shadow",
  "description": "string",
  "effectiveFrom": "2026-08-19T04:21:07Z",
  "effectiveUntil": "2026-08-19T04:21:07Z",
  "reasonCode": "NewTypology",
  "reason": "Requested by the customer."
}'

Responses

The response is a tagged shape: type is always "RpolCreateRspAttributes". Switch on it; subtypes can be added, and a client that already reads it will not break.

Discriminated by type
type = "RpolCreateRspAttributes"

The resource that was created.

Example
{
  "type": "RpolCreateRspAttributes",
  "created": {
    "type": "RpolViewAttributes",
    "rulePolicyId": "rpol_9f2Kd8QpLzXw",
    "domain": "string",
    "owner": {
      "type": "RpolOwnerEnterprise",
      "enterpriseId": "ent_9f2Kd8QpLzXw"
    },
    "state": "Draft",
    "mode": "Shadow",
    "paused": true,
    "rule": {
      "type": "RpolRuleAttributes",
      "templateId": "string",
      "arguments": [
        {
          "type": "RpolArgumentAttributes",
          "parameterId": "string",
          "value": {
            "type": "RpolValueAmount",
            "amount": {
              "type": "IsoCurrencyAmount",
              "minorCurrencyUnits": 1250,
              "currency": "AUD"
            }
          }
        }
      ],
      "action": {
        "type": "RpolActionAttributes",
        "name": "Ada Lovelace"
      }
    },
    "templateVersion": 1250,
    "description": "string",
    "version": 1250,
    "effectiveFrom": "2026-08-19T04:21:07Z",
    "effectiveUntil": "2026-08-19T04:21:07Z",
    "retiredAt": "2026-08-19T04:21:07Z",
    "createdAt": "2026-08-19T04:21:07Z",
    "createdBy": "string",
    "updatedAt": "2026-08-19T04:21:07Z",
    "updatedBy": "string",
    "approvedBy": "string",
    "approvedAt": "2026-08-19T04:21:07Z",
    "rejectedBy": "string",
    "rejectedAt": "2026-08-19T04:21:07Z"
  }
}

Error responses