Decision policies

Base URL: $BUSINESS_API

Read the decision policy of an approval type

Logs

GET /decision-policies/{type}

Returns the tenant's decision policy for one approval type, with its mode and current version. When the tenant has never configured that type, a default policy in human mode is returned without being saved. Requires automations:read; an unknown approval type returns 400.

Parameters

typestring · path · required

Approval type: billing_posting, price_version_publication, manual_journal_entry, supplier_payout, refund, write_off or cut_approval.

Returns

200 Policy with its current mode, limits and version

Permissions automations:read · Roles: admin, analyst, customer_service, finance, operations, owner

curl -X GET "$BUSINESS_API/decision-policies/{type}" \
  -H "Authorization: Bearer sk_test_..."
Response 200

Policy with its current mode, limits and version

Configure an approval type's mode, conditions and limits

Logs

PUT /decision-policies/{type}

Saves a new immutable version of the approval type's policy (mode, condition group, limits, sampling percent and explanation) and increments the policy version; the first update creates the policy. Every approval type currently has a platform minimum of human review, so any mode other than human is refused with 400. An invalid condition group or a sampling_percent outside 0 to 100 also returns 400. Requires automations:write.

Parameters

typestring · path · required

Approval type: billing_posting, price_version_publication, manual_journal_entry, supplier_payout, refund, write_off or cut_approval.

Body application/json

modestring · required

one of automatic, human, sampled

condition_groupobject · optional
limitsobject · optional
sampling_percentinteger · optional
explanationstring · optional

Returns

200 Updated policy

Errors 400

Permissions automations:write · Roles: admin, finance, operations, owner

curl -X PUT "$BUSINESS_API/decision-policies/{type}" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "mode": "automatic",
  "condition_group": {},
  "limits": {},
  "sampling_percent": 0,
  "explanation": "explanation"
}'
Response 200

Updated policy

Evaluate a policy against one case and record the decision

Logs

POST /decision-policies/{type}/simulate

Evaluates the current policy version against the supplied case (amount_cents and inputs) and returns the outcome: automatic, pending_human, approved or rejected. The decision is always saved to the decision log, so this call is not a dry run. When approved is set, the decision records a human approval or rejection by the caller, which also requires the write scope for that approval type (for example refund needs payments:write). Requires automations:read; an unknown approval type returns 400.

Parameters

typestring · path · required

Approval type to evaluate: billing_posting, price_version_publication, manual_journal_entry, supplier_payout, refund, write_off or cut_approval.

Body application/json

subject_typestring · optional
subject_idstring · optional
inputsobject · optional
amount_centsinteger · optional
approvedboolean · optional
decided_bystring · optional

Returns

200 Decision with policy version, outcome and explanation

Permissions automations:read · Roles: admin, analyst, customer_service, finance, operations, owner

curl -X POST "$BUSINESS_API/decision-policies/{type}/simulate" \
  -H "Authorization: Bearer sk_test_..." \
  -H "Content-Type: application/json" \
  -d '{
  "subject_type": "subject type",
  "subject_id": "sub_2Cg5f6gZ7W8jvEm53ICdbaeNrWe",
  "inputs": {},
  "amount_cents": 125000,
  "approved": true,
  "decided_by": "decided by"
}'
Response 200

Decision with policy version, outcome and explanation