Polivor

Authorize

POST /v1/authorize asks for authority for one action. It needs an agent key and an Idempotency-Key header of 1 to 128 characters.

The request

FieldMeaning
agent_buildOptional. A label for the agent's build or model, up to 64 characters, for your own records. It is stored with the decision and never changes the outcome.
actionThe payment: type (PayInvoice), amount_minor, currency, debtor_account, payment_type (SEPA_CT or SEPA_INST), beneficiary (id and iban; a country is accepted but never used) and reference.
signalsOptional hints such as origin and risk_flags. They can make a policy stricter, never more permissive.

Unknown fields are ignored. Flags like iban_changed or beneficiary_allowlisted have no effect, because Polivor computes those facts itself.

The answer

OutcomeHTTPWhat it means
ALLOW200Go ahead. The response carries an authorization.
DENY200Do not pay. denial says what to do. No authorization.
REQUIRE_APPROVAL202A person must decide first. No authorization yet; see Approvals and webhooks.

The answer never says why a payment was refused: it has no reasons, no list of checks and no policy version, so an agent that has been manipulated learns nothing about your allowlist, your limits or your rules. When nothing is allowed it carries a denial with a code from the closed list below, a fixed message that says what to do, and retryable. A person sees the full explanation in the console, with an admin key (GET /v1/decisions/{id}), and in the evidence. The evidence reference points to the signed record of this decision.

Denial codes

Match on the code, not on the wording. retryable is true only when sending the same request again later, with nothing else changed, may succeed.

CoderetryableWhat to do
AGENT_NOT_ENABLEDnoThis agent has no authority to act at the moment. Do not retry; ask the agent's owner.
OUTSIDE_AUTHORITYnoThis payment is outside what this agent may do. Do not retry; ask the agent's owner.
APPROVAL_REQUIREDnoA person must approve this payment before it can be made. Do not send it again: read the decision later.
UNAVAILABLEyesPolivor cannot decide this payment now, and it was not approved. Try again later.
APPROVER_DENIEDnoA person denied this payment.
APPROVAL_EXPIREDnoNobody decided in time. The payment was not approved.

The signed authorization on an ALLOW keeps its claims as they are, including the policy version.

Reason codes

These are what a person sees (console, admin key, evidence), never an agent. A reason is either the id of the policy rule that decided (such as invoice.over_threshold), or one of these codes. Match on the code, not on any wording.

CodeMeaning
AGENT_SUSPENDEDThe agent is suspended.
NO_ACTIVE_MANDATEThe agent has no mandate in force: none yet, or only a draft.
MANDATE_REVOKEDThe version in force was revoked. A new version must be approved before the agent has authority again.
MANDATE_EXPIREDThe validity of the version in force has ended. A new version with later dates restores authority once approved.
MANDATE_NOT_YET_VALIDThe version in force starts later.
NO_ACTIVE_POLICYNo policy is published for the tenant.
NO_PERMITNo rule of the active policy permits this payment: it is outside the mandate's scope.
POLICY_EVALUATION_ERRORThe policy could not be evaluated. The payment is denied, never allowed.
BUDGET_EXCEEDEDThe day or month budget is used up.
APPROVER_DENIEDA person denied the payment.
APPROVAL_EXPIREDNobody decided before the approval expired.

A denial looks like this:

{
  "decision_id": "9c1d2e3f-4a5b-4c6d-8e7f-0a1b2c3d4e5f",
  "outcome": "DENY",
  "denial": {
    "code": "AGENT_NOT_ENABLED",
    "message": "This agent has no authority to act at the moment. Do not retry; ask the agent's owner.",
    "retryable": false
  },
  "mandate": { "id": "2d1b3b44-5e0c-4a3c-9a7e-6f1f7a9c0a11", "version": "2.1" },
  "evidence": { "id": "b53c9b3e-9a1e-4a43-9c5b-2a6f5c6e7d10", "seq": 18 }
}

Idempotency

Send the same Idempotency-Key and the same body and you get the same response back, for 24 hours; nothing is decided twice and the budget is reserved once. The same key with a different body returns 409 IDEMPOTENCY_KEY_REUSED; a key older than 24 hours returns 409 IDEMPOTENCY_KEY_EXPIRED. Use a new key for each new payment.

Money

Amounts are integers in minor units with an ISO 4217 currency. There are no decimals anywhere in the API.

Simulate

POST /v1/simulate takes the same body (plus an optional policy_version to preview a draft policy) and returns what a person sees (the reasons, the checks and the policy version, plus the denial an agent would get) with "simulated": true. It writes nothing, reserves nothing and issues no authorization. It needs an admin key.

Get a decision later

GET /v1/decisions/{id} returns the status: ALLOWED, DENIED or PENDING_APPROVAL, the denial when nothing is allowed, and the authorization once it exists. An agent can read its own decisions and gets only that. An admin key also gets the reasons, the checks and the policy version.