# Ask a person to approve

Ask a person to approve an agent's action before it runs, with a policy rule, an approval inbox, phone delivery and a verify that passes once they 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](https://provenanceauth.com/docs/authorize/guides/verify-agent-checkout.md#ask-the-shopper-to-approve).

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

```bash
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](https://provenanceauth.com/docs/authorize/guides/ask-once.md).

## 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`](https://provenanceauth.com/docs/api/policies.md#put-v1-mandate-policies); the second rule keeps the default hardware check.

**curl**

```bash
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" }
    ] }
  }'
```

**Node**

```ts
import { Provenance } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
await prov.mandate.policies.set(
  {
    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" },
    ],
  },
  { note: "wires need a person" },
);
```

**Python**

```python
import os
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
prov.mandate.policies.set(
    {"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"},
    ]},
    note="wires need a person",
)
```

```json
{
  "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](https://provenanceauth.com/docs/mandate/guides/biometric-approval.md). 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**

```bash
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)
```

**Node**

```ts
const action = {
  actionDescription: "Wire $12,000 to Acme Corp for PO-7781",
  actionPayload: { type: "wire", amount: 12000, currency: "USD", beneficiary: "acct_acme" },
};
const auth = await prov.mandate.intents.create({
  ...action,
  displaySummary: "Wire $12,000 to Acme Corp",
  agentSessionId: "sess_treasury_1",
  deviceId: "dev_00000000000000000000000000000001",
});
```

**Python**

```python
description = "Wire $12,000 to Acme Corp for PO-7781"
payload = {"type": "wire", "amount": 12000, "currency": "USD", "beneficiary": "acct_acme"}
auth = prov.mandate.intents.create(
    action_description=description,
    display_summary="Wire $12,000 to Acme Corp",
    action_payload=payload,
    agent_session_id="sess_treasury_1",
    device_id="dev_00000000000000000000000000000001",
)
```

```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**

```bash
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)
```

**Node**

```ts
const pending = await prov.mandate.assessments.create({ intentToken: auth.intentToken, ...action, context: { actionType: "wire" } });
const approvalId = pending.approvalId!;
```

**Python**

```python
pending = prov.mandate.assessments.create(
    intent_token=auth["intent_token"],
    action_description=description,
    action_payload=payload,
    context={"action_type": "wire"},
)
approval_id = pending["approval_id"]
```

```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`](https://provenanceauth.com/docs/api/verify.md#post-v1-verify) and its paid [`POST /v1/authorize/verifications`](https://provenanceauth.com/docs/api/verifications.md#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](https://provenanceauth.com/docs/authorize/guides/verify-tokens.md#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`](https://provenanceauth.com/docs/api/approvals.md#post-v1-mandate-approvals-id-respond):

**curl**

```bash
curl $PROVENANCE_API/v1/mandate/approvals/$APPROVAL_ID/respond \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "decision": "approve" }'
```

**Node**

```ts
await prov.mandate.approvals.respond(approvalId, { decision: "approve" });
```

**Python**

```python
prov.mandate.approvals.respond(approval_id, decision="approve")
```

```json
{
  "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](https://provenanceauth.com/docs/mandate/guides/step-up-approval.md#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](https://provenanceauth.com/docs/mandate/guides/automate-approvals.md) gave says `rule`.

### Pass the link on yourself

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`](https://provenanceauth.com/docs/api/approvals.md#post-v1-mandate-approvals-id-link) returns a fresh single-use link to a pending approval:

**curl**

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

**Node**

```ts
const { approveUrl, shortUrl } = await prov.mandate.approvals.link(approvalId);
```

**Python**

```python
link = prov.mandate.approvals.link(approval_id)
```

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:

```ts
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](https://provenanceauth.com/docs/authorize/guides/ucp.md).

## 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**

```bash
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" }
  }'
```

**Node**

```ts
const approved = await prov.mandate.assessments.create({ intentToken: auth.intentToken, ...action, context: { actionType: "wire" } });
```

**Python**

```python
approved = prov.mandate.assessments.create(
    intent_token=auth["intent_token"],
    action_description=description,
    action_payload=payload,
    context={"action_type": "wire"},
)
```

```json
{
  "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`](https://provenanceauth.com/docs/api/account.md#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**

```bash
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"] }'
```

**Node**

```ts
await fetch(`${process.env.PROVENANCE_API}/v1/account/approval_channels`, {
  method: "PUT",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({ mode: "first_available", channels: ["text", "web_push", "email"] }),
});
```

**Python**

```python
import httpx

api, headers = os.environ["PROVENANCE_API"], {"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}
httpx.put(f"{api}/v1/account/approval_channels", json={"mode": "first_available", "channels": ["text", "web_push", "email"]}, headers=headers)
```

```json
{ "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 hold | Allows |
| --- | --- |
| `app_notification` | The app and web push |
| `email` | The email |
| `text` | The 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}`](https://provenanceauth.com/docs/api/approvals.md#get-v1-mandate-approvals-id) lists them under `deliveries`, oldest first:

| Field | What it says |
| --- | --- |
| `person` | Who the message went to |
| `channel` | `app_push`, `webpush`, `sms`, `email` or `voice` |
| `recipient` | The masked address or phone (none for the app) |
| `status` | `sent`, `not_sent` or `held`, with `reason` when it didn't go |
| `channel_reason` | `floor` when the email went because nothing else delivered |

| Channel | What the person gets |
| --- | --- |
| SMS or WhatsApp | The short summary and a signed link to the approval page |
| Web push | A notification that opens the approval page |
| Email | The summary and the link; always tried last |
| Slack | A message with a **Review and approve** button that opens the approval page; set it up at [`PUT /v1/account/slack`](https://provenanceauth.com/docs/api/account.md#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](https://provenanceauth.com/docs/mandate/guides/approve-by-phone.md) |

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](https://provenanceauth.com/docs/mandate/concepts/phone-confirmations.md).

## 7. Remove the rule

When you're done testing, return the sandbox account to the default policy with [`DELETE /v1/mandate/policies`](https://provenanceauth.com/docs/api/policies.md#delete-v1-mandate-policies):

**curl**

```bash
curl -X DELETE $PROVENANCE_API/v1/mandate/policies \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
await prov.mandate.policies.reset();
```

**Python**

```python
prov.mandate.policies.reset()
```

```json
{ "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`.

| Field | What it says |
| --- | --- |
| `status` | `pending`, `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_at` | When the answer that settled it came in. |
| `decided_via` | The surface: `link`, `email`, `app`, `phone`, `console`, `api`, `embed`, `rule`, `route_default`, `external` or `ciba`. |
| `decided_method` | How the person was verified: `passkey`, `device_key`, `keypad`, `signed_in`, `api_key` or `none`. |
| `person_decision` | The person's own answer, `approved` or `declined`, kept when a rule or your review then changed the outcome. `null` when no person answered. |
| `decline_reason` | With `declined`: the coded reason (`unrecognized`, `wrong_amount`, `not_now`, `off_task`, `passkey_too_new`, `policy_rule`, `store_review`, `review_expired`). |
| `decline_note` | With `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

| Symptom | Cause | Fix |
| --- | --- | --- |
| `valid: false`, `approval_denied` | The person denied the request | Don't run the action; authorize a new one if it should be retried. |
| `valid: false`, `approval_expired` | Nobody decided within 10 minutes | Authorize and verify again to send a new request. |
| `valid: false`, `approval_pending` after approving | A quorum rule still needs more approvers | Wait for the other approvers; the response shows `approvals_received` and `approvals_needed`. |
| `400` [`approval_biometric_required`](https://provenanceauth.com/docs/platform/errors.md#approval_biometric_required) on respond | The rule requires a passkey | Approve from the approval page with a passkey; see [biometric approval](https://provenanceauth.com/docs/mandate/guides/biometric-approval.md). |
| `402` [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required) on the policy | `approvers` above 1 is Enterprise | See [plans and usage](https://provenanceauth.com/docs/account/plans-and-usage.md). |

## See also

- [Biometric approval](https://provenanceauth.com/docs/mandate/guides/biometric-approval.md)
- [Approve by phone call](https://provenanceauth.com/docs/mandate/guides/approve-by-phone.md)
- [Offer options](https://provenanceauth.com/docs/mandate/guides/offer-options.md), to let the person pick one of several actions
- [Handle a change request](https://provenanceauth.com/docs/mandate/guides/change-requests.md), for "yes, but 1, not 2"
- [Route approvals](https://provenanceauth.com/docs/mandate/guides/route-approvals.md), to send each request to the right people
- [Policies](https://provenanceauth.com/docs/concepts/policies.md)
- [Execution binding](https://provenanceauth.com/docs/mandate/guides/execution-binding.md)
- [Webhooks](https://provenanceauth.com/docs/integrate/webhooks.md), for approval events in your own systems
