API reference

Automation rules

Rules that auto-approve, or always send to approval, matching documents.

More about this resource

Conditional overrides on top of Settlement's autonomy settings, per process (purchase_order, invoice_payment): a rule matches by supplier account (or, for a supplier with no Pleaxy account, by name) and amount, and either auto-approves a match with nobody acting, or forces the full approval chain. An auto-approve rule needs the Autonomous plan and never applies to an invoice that autonomy couldn't approve either (one a buyer entered, one in another currency, or one not matched against an issued AWS invoice), nor to a PO over a spend limit. Rules are evaluated in order, and the first enabled match wins.

Get automation rules

Returns a process's automation rules.

GET/v1/workspaces/{regionId}/automation-rules/{process}

Parameters

  • process"purchase_order" | "invoice_payment"Required

    Which flow's rules to fetch.

Returns

200 OK with the object shown in the response.

More details

Returns a process's automation rules in priority order, or { process, rules: [] } if none are configured, and whether the workspace's plan lets auto-approve rules run.

Response fields

  • autoApproveAllowedboolean

    Whether the plan allows autonomy (Autonomous or Enterprise). When false, rules with autoApprove true are kept but skipped when orders and invoices are evaluated, so a rule behind them can still match; upgrading makes them run again. Computed on every read, never stored.

Errors

  • 401 Unauthorized - No credential was presented, or the Bearer token / X-Api-Key value is missing, invalid, expired, or revoked.
  • 403 Forbidden - The caller's Bearer token or API key doesn't grant access to this workspace (regionId), or lacks the required role.
GET /v1/workspaces/{regionId}/automation-rules/{process}
Request
curl "$PLEAXY_API_BASE_URL/v1/workspaces/{regionId}/automation-rules/{process}" \
  -H "X-Api-Key: $PLEAXY_API_KEY"
Response · 200 OK
{
   "process": "purchase_order" | "invoice_payment",
   "rules": [
      { "id": "string", "label": "string", "conditions": { "supplierWorkspaceId": "string", "supplierContains": "string", "maxAmount": number }, "autoApprove": boolean, "enabled": boolean, "createdAt": "string" }
   ],
   "autoApproveAllowed": boolean
}

Update automation rules

Replaces a process's automation rules.

PATCH/v1/workspaces/{regionId}/automation-rules/{process}

Parameters

  • process"purchase_order" | "invoice_payment"Required

    Which flow's rules to replace.

Body

  • rulesarrayRequired

    Each { id?, label, conditions: { supplierWorkspaceId?, supplierContains?, maxAmount? }, autoApprove, enabled }. supplierWorkspaceId is the supplier account the rule applies to (its Workspace ID, e.g. reg_….supplier) and must be one of your connected suppliers; suppliers are matched by account, never by name. supplierContains is legacy and matches only suppliers with no Pleaxy account. autoApprove true skips approval for a match; false forces the full chain.

Returns

200 OK with the object shown in the response.

More details

Replaces a process's automation rules, in priority order. A rule that keeps its id keeps its createdAt.

Changed 2026-09-27, a security fix inside v1: Signed-in session only, for every process: an auto-approve rule approves purchase orders or invoices with nobody acting, so an API key gets 403 HUMAN_SESSION_REQUIRED whatever its procurement role. Reading the rules still accepts a buyer API key.

Errors

  • 400 Bad Request - AUTONOMY_PLAN_REQUIRED: a new rule, or a change to an existing one, sets autoApprove true on a plan without autonomy ("Auto-approve rules need the Autonomous plan - the {Plan} plan allows rules that require approval only. Upgrade to Autonomous to use auto-approve rules."). Nothing is saved. A rule already stored with autoApprove true can be sent back with its conditions unchanged (its label and on/off switch may change), so the rest of the list stays editable; changing its conditions is refused.
  • 400 Bad Request - DUPLICATE_RULE_ID: the list carries the same rule id more than once ("Rule '{id}' is in the list more than once. Send each rule once."). Nothing is saved.
  • 403 Forbidden - Code HUMAN_SESSION_REQUIRED. The caller isn't a signed-in person (for example, an API key), for any process ("Automation rules can only be changed by a signed-in person. Change them in Pleaxy."). Nothing is saved.
  • 401 Unauthorized - No credential was presented, or the Bearer token / X-Api-Key value is missing, invalid, expired, or revoked.
  • 403 Forbidden - The caller's Bearer token or API key doesn't grant access to this workspace (regionId), or lacks the required role.
PATCH /v1/workspaces/{regionId}/automation-rules/{process}
Request
curl -X PATCH "$PLEAXY_API_BASE_URL/v1/workspaces/{regionId}/automation-rules/{process}" \
  -H "X-Api-Key: $PLEAXY_API_KEY" \
  -H "Content-Type: application/json" \
  -d @body.json
body.json
{
   "rules": [
      { "id": "string", "label": "string", "conditions": { "supplierWorkspaceId": "string", "supplierContains": "string", "maxAmount": number }, "autoApprove": boolean, "enabled": boolean }
   ]
}
Response · 200 OK
{
   "process": "purchase_order" | "invoice_payment",
   "rules": [
      { "id": "string", "label": "string", "conditions": { "supplierWorkspaceId": "string", "supplierContains": "string", "maxAmount": number }, "autoApprove": boolean, "enabled": boolean, "createdAt": "string" }
   ]
}
Talk to us