View as Markdown

Mandate · Guide

Ask a person to approve

Use step-up approval when an action should wait for a person instead of failing. A policy rule marks which actions need approval. When one matches, verify returns approval_pending, the person gets the request on their phone or in the console, and the same verify passes once they approve.

A store can ask for the same kind of approval at checkout. That path opens the approval at authorize instead of verify and returns a fresh token bound to the order; see ask the shopper to approve.

Before you begin: export the sandbox account key. Policies and approvals belong to an account.

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
  1. Agent verifies
    approval_pending + approval_id
  2. Person approves
    phone, console or Slack link
  3. Agent verifies again
    valid: true

Verify first, ask only when nothing valid is attached: when the person already approved this exact action (the same payload_hash and action_hash) by passkey, or on this account and device, inside its window, verify reuses that approval instead of opening a new request, and a pending one is attached to. See ask once.

1. Add an approval rule

A rule with require: { approval: true } sends matching actions for approval. This one matches when your executor passes action_type: "wire" in context. Save it with PUT /v1/mandate/policies; the second rule keeps the default hardware check.

curl -X PUT $PROVENANCE_API/v1/mandate/policies \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "wires need a person",
    "document": { "rules": [
      { "id": "wire-needs-approval", "when": [{ "fact": "action_type", "op": "eq", "value": "wire" }], "require": { "approval": true } },
      { "id": "default-hardware-over-500", "when": [{ "fact": "transaction_amount", "op": "gt", "value": 500 }], "require": { "hardware": true }, "reason": "hardware_required_above_500" }
    ] }
  }'
{
  "object": "policy_version",
  "domain": "intent",
  "version": 2,
  "active": true,
  "note": "wires need a person"
}

The default hardware rule (default-hardware-over-500) is also met when the person approved the exact proposal a deal or purchase comes from with their passkey: the approval is bound to that proposal's accepted offer and used once. A rule you write with "hardware": true still needs a hardware-attested device.

Add "approvers": 2 to require two different approvers (Enterprise), or "biometric": true to require a passkey with the approval; see biometric approval. Each person counts once, however many sessions they use, and all of your account's API keys together count as one approver: two people, or one person and your backend, meet "approvers": 2, but two of your keys alone don't.

2. Authorize the action

Authorize as usual. display_summary is the short text sent by SMS; the approval page always shows the full action_description.

curl -s $PROVENANCE_API/v1/mandate/intents \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action_description": "Wire $12,000 to Acme Corp for PO-7781",
    "display_summary": "Wire $12,000 to Acme Corp",
    "action_payload": { "type": "wire", "amount": 12000, "currency": "USD", "beneficiary": "acct_acme" },
    "agent_session_id": "sess_treasury_1",
    "device_id": "dev_00000000000000000000000000000001"
  }' | tee authorization.json
export INTENT_TOKEN=$(jq -r .intent_token authorization.json)
{
  "object": "intent_authorization",
  "intent_token": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ijc1MjY5NmZmMGY1ZTRmNTMifQ.eyJpc3MiOiJwcm92ZW5hbmNlLWF1dGhvcml6ZSJ9.dUvSg20-l4xn1dRTrhQTU8F0W9tRDWpE1INz793rICt-daFn5wVgd0SndvqNIquHFUih1aFMJ24rCoZCMq3AOA",
  "expires_at": "2026-10-24T17:39:01.000Z",
  "attestation_id": "2deea622-571a-4b70-8b2d-247fbcf0079c",
  "biometric_bound": false
}

3. Verify and get a pending approval

Verify with action_type: "wire" in context. The rule matches, so the response is approval_pending with the approval's ID, and the request goes to the person.

curl -s $PROVENANCE_API/v1/mandate/assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "intent_token": "'"$INTENT_TOKEN"'",
    "action_description": "Wire $12,000 to Acme Corp for PO-7781",
    "action_payload": { "type": "wire", "amount": 12000, "currency": "USD", "beneficiary": "acct_acme" },
    "context": { "action_type": "wire" }
  }' | tee verification.json
export APPROVAL_ID=$(jq -r .approval_id verification.json)
{
  "object": "mandate_assessment",
  "valid": false,
  "reason": "approval_pending",
  "approval_id": "appr_01M5Q25QP84QHATMRDGSGQ459K",
  "expires_at": "2026-10-24T13:49:01.448Z",
  "policy": {
    "id": "pol_3F9A1C7E52B04D8E6A1F27C9B4",
    "version": 1,
    "rule": {
      "id": "rul_01JDATQBT4FW259TW3JGA9YA3B",
      "name": null,
      "phase": "assess",
      "action": "challenge",
      "conditions": [
        { "fact": "action_type", "op": "eq", "value": "wire", "actual": "wire" }
      ]
    }
  }
}

The approval expires after 10 minutes. Don't run the action yet.

The token is signed, but it isn't approved until the person approves. While the approval is open, every check of the token answers valid: false with approval_pending, including a store's free POST /v1/verify and its paid POST /v1/authorize/verifications. A denied or expired approval keeps the token from verifying anywhere. Present the token to a store only after your own verify passes. See approval holds.

4. Approve the request

The person sees the request in the console's Approvals inbox, or on their phone from the link Provenance sends. Here you approve it with the key, through POST /v1/mandate/approvals/{id}/respond:

curl $PROVENANCE_API/v1/mandate/approvals/$APPROVAL_ID/respond \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "decision": "approve" }'
{
  "id": "appr_01M5Q25QP84QHATMRDGSGQ459K",
  "object": "approval",
  "status": "approved",
  "action_description": "Wire $12,000 to Acme Corp for PO-7781",
  "context": { "action_type": "wire" },
  "agent_session_id": "sess_treasury_1",
  "matched_rule_id": "rul_01JDATQBT4FW259TW3JGA9YA3B",
  "requires_biometric": false,
  "decided_via": "api",
  "decided_method": "api_key"
}

Send "decision": "decline" to refuse (deny works too); a decline is final for this token, and the approval reads status: "declined" with the reason in decline_reason (approval decisions). decided_via records the surface the answer came through (api here: a server with a key) and decided_method how the person was verified. An approval an auto_approve clause gave says rule.

When your agent already talks to the person (a chat, its own text, a code on a screen), it can hand them the approval page itself. POST /v1/mandate/approvals/{id}/link returns a fresh single-use link to a pending approval:

curl -X POST $PROVENANCE_API/v1/mandate/approvals/$APPROVAL_ID/link \
  -H "Authorization: Bearer $PROVENANCE_KEY"

The response has approve_url, short_url (the short text link when short links are on, else null) and expires_at. The page asks for a passkey when the approval needs one, so a link hands on nothing your key couldn't already decide. Once the approval is decided, a new link is 409 approval_already_decided; an approval routed to an approver is theirs, with its own link (409 approval_routed_to_approver).

Handle a UCP approval Action

A store on the Universal Commerce Protocol (UCP) can ask the person through its checkout response: an Action of type com.provenanceauth.checkout.approval, sent only to platforms whose profile lists that extension. List it in your platform's profile with ucpPlatformCapability from @provenanceauth/rails/ucp, then handle the Action like this:

import { ucpApprovalActionsOf, ucpApproveUrlAllowed } from "@provenanceauth/rails/ucp";

for (const action of ucpApprovalActionsOf(checkout)) {
  // approvalOrigins: config.approval_origins from the store's profile entry for the extension
  if (!ucpApproveUrlAllowed(action.config.approve_url, approvalOrigins)) continue; // decline it
  await showToPerson(String(action.config.approve_url)); // a link or a QR code
}

In a browser or an agent framework, ucpApprovalHandoff(checkout, { approvalOrigins }) from @provenanceauth/agent-adapters (ucp_approval_handoff in the Python SDK's provenanceauth.ucp) does the same check and returns the link, a QR text, status_url and what to tell the person. Through Provenance's MCP server, pass the checkout to request_checkout_approval as ucp_checkout.

Poll the Action's status_url until the approval is decided, then get the checkout again. The store drops the Action once the person approves; never treat the order as approved because the person opened the link. If your agent holds an intent token for this checkout, withProvenanceIntentSignal(request, token, jwksUri) sends it with Complete Checkout. The store's side is in Approve UCP checkouts.

5. Verify again and execute

The agent repeats the same verify. The approval satisfies the rule, so the result is valid and names the approval:

curl $PROVENANCE_API/v1/mandate/assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "intent_token": "'"$INTENT_TOKEN"'",
    "action_description": "Wire $12,000 to Acme Corp for PO-7781",
    "action_payload": { "type": "wire", "amount": 12000, "currency": "USD", "beneficiary": "acct_acme" },
    "context": { "action_type": "wire" }
  }'
{
  "object": "mandate_assessment",
  "valid": true,
  "payload_bound": true,
  "approval_id": "appr_01M5Q25QP84QHATMRDGSGQ459K"
}

In your agent, verifyWithApproval (Node) or verify_with_approval (Python) does steps 3 to 5: it verifies, waits while the approval is pending, and returns once it resolves or times out. The approval is bound to this token, description and payload, so a changed payload fails with payload_hash_mismatch instead of inheriting it.

6. Choose how people are reached

Every person the request reaches has a channel setting. Each console person chooses their own in the console under Settings → Notifications → Your notifications; everyone who hasn't follows the account default, which owners and admins set there or with PUT /v1/account/approval_channels. A setting has two modes:

  • first_available (First that works): the channels are tried in order until one delivers, and email is always the last one. This is the default.
  • all (Every channel): every channel gets each approval. If none of them delivered, the email goes anyway.

A text needs a verified phone and web push a browser that turned notifications on; each person gets only the channels they have set up, so a default that names a text reaches a teammate without a phone by email. The console's Approvals queue always holds the request.

curl -X PUT $PROVENANCE_API/v1/account/approval_channels \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "mode": "first_available", "channels": ["text", "web_push", "email"] }'
{ "object": "approval_channels", "mode": "first_available", "channels": ["text", "web_push", "email"] }

A person's own setting is theirs: PUT /v1/account/approval_channels/me needs a signed-in person, so an API key can't change it, and a change to the default doesn't touch it. Owners and admins see each person's mode on the People card, never their contacts.

Hours hold the channels that make a sound. A console person may set Only between these hours in their own setting; a named approver's hours are their own rules.

With Every channel outside those hours, the email goes at once and the app, web push, text and call wait until the hours begin, then go together if the request is still waiting; deliveries shows them as held. Reminders go on the person's whole set the same way, and each round still counts once.

When the person answers on one channel, the others are handled once: an app notification is cleared with a silent push, a web home notification is replaced by a silent Approved or Declined, and a text, an email or a queued call is left alone; its link opens the decided page. Each message in deliveries gets an outcome, and the approval's answered_on says which message the answer came from.

Named approvers choose their own setting too, one for every company they approve for. A request's channels narrows their set and never widens it:

The request's channels holdAllows
app_notificationThe app and web push
emailThe email
textThe text

When nothing of the person's set is left, one message goes on the first channel the request allows that reaches them; when none does, nothing is sent and the delivery says channel_excluded. A phone call follows only the person's own opt-in. For a named approver, deliveries shows only the messages that went, never a channel that didn't or why.

A console person with the Provenance app can also turn on the app notification: it reaches the app of the one person whose verified email is theirs and opens the request in the company's workspace.

Each message is reported on the approval. GET /v1/mandate/approvals/{id} lists them under deliveries, oldest first:

FieldWhat it says
personWho the message went to
channelapp_push, webpush, sms, email or voice
recipientThe masked address or phone (none for the app)
statussent, not_sent or held, with reason when it didn't go
channel_reasonfloor when the email went because nothing else delivered
ChannelWhat the person gets
SMS or WhatsAppThe short summary and a signed link to the approval page
Web pushA notification that opens the approval page
EmailThe summary and the link; always tried last
SlackA message with a Review and approve button that opens the approval page; set it up at PUT /v1/account/slack
Phone call (voice)A call to the verified phone that reads the request after a key press; 1 approves within your call limit or sends the link. The person turns calls on first; see approve by phone call

Every channel ends on the same approval page, which shows the full description, the amount and an expiry countdown. The link works once and only for this approval. Replying "yes" to a message does nothing: approval needs the page, and a passkey when the rule asks for one. The one exception is a phone confirmation within your voice limit, where 1 on a call Provenance placed to the verified phone approves; see phone confirmations.

7. Remove the rule

When you're done testing, return the sandbox account to the default policy with DELETE /v1/mandate/policies:

curl -X DELETE $PROVENANCE_API/v1/mandate/policies \
  -H "Authorization: Bearer $PROVENANCE_KEY"
{ "object": "policy", "domain": "intent", "is_default": true }

Approval decisions

Every approval you read says what the person decided, when and how, in the same fields: a step-up approval (approval), a cart approval (checkout_approval), a card issuer's approval (issuer_approval) and a person's network order approval (network_order_approval). A field that doesn't apply, or that the record doesn't keep, is null.

FieldWhat it says
statuspending, approved, declined or expired, plus the type's own states (in_review on a cart, used on an issuer or network order approval, changes_requested on a step-up).
decided_atWhen the answer that settled it came in.
decided_viaThe surface: link, email, app, phone, console, api, embed, rule, route_default, external or ciba.
decided_methodHow the person was verified: passkey, device_key, keypad, signed_in, api_key or none.
person_decisionThe person's own answer, approved or declined, kept when a rule or your review then changed the outcome. null when no person answered.
decline_reasonWith declined: the coded reason (unrecognized, wrong_amount, not_now, off_task, passkey_too_new, policy_rule, store_review, review_expired).
decline_noteWith declined: the person's short note, links and phone numbers removed.

To decline, send "decision": "decline" with an optional reason. On a cart, the person can add a note. List filters take status=declined. The older words (deny, denied, deny_reason, deny_note) are still accepted on requests.

Errors you might see

SymptomCauseFix
valid: false, approval_deniedThe person denied the requestDon't run the action; authorize a new one if it should be retried.
valid: false, approval_expiredNobody decided within 10 minutesAuthorize and verify again to send a new request.
valid: false, approval_pending after approvingA quorum rule still needs more approversWait for the other approvers; the response shows approvals_received and approvals_needed.
400 approval_biometric_required on respondThe rule requires a passkeyApprove from the approval page with a passkey; see biometric approval.
402 plan_required on the policyapprovers above 1 is EnterpriseSee plans and usage.

See also