View as Markdown

Mandate · Guide

Bind the exact action

Use execution binding to make sure an agent runs exactly the action a person approved. You authorize the exact payload, the agent's stated reason and the agent's identity, then verify all three right before the action runs. Anything that changed in between fails the check.

Before you begin: export the sandbox account key. Agents and receipts belong to an account, so this guide uses the account key, not the full-access key. Each run gets its own agent session ID.

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
export AGENT_SESSION_ID=sess_$(date +%s)

1. Register the agent

Registering an agent gives it an ID that appears on its tokens, its decisions and its deny alerts. It's optional: without one, the agent session ID is the only label. Create it with POST /v1/mandate/agents:

curl -s $PROVENANCE_API/v1/mandate/agents \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "invoice-bot" }' | tee agent.json
export AGENT_ID=$(jq -r .id agent.json)
{
  "id": "agt_01M5Q21JM14QHAWX0ND24THM3M",
  "object": "agent",
  "name": "invoice-bot",
  "description": null,
  "status": "active",
  "created_at": "2026-10-24T13:36:45.185Z",
  "last_seen_at": null
}

2. Authorize the payload and the reason

Send the request to POST /v1/mandate/intents with three things bound into the token:

FieldBound asWhat it proves
action_payloadpayload_hashThe exact machine payload the agent will run, such as a payment or an API request body
context_evidencecontext_hashThe agent's stated reason, shown to the person who approves
agent_idagent (id, name, integration, sdk_version)Which registered agent asked, and the integration its client declared
curl -s $PROVENANCE_API/v1/mandate/intents \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
    "action_payload": { "type": "payment", "amount": 1850, "currency": "USD", "payee": "acct_brindlecote_supplies" },
    "context_evidence": { "invoice": "INV-2041", "reason": "net-30 terms, due today" },
    "agent_id": "'"$AGENT_ID"'",
    "agent_session_id": "'"$AGENT_SESSION_ID"'",
    "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:36:45.000Z",
  "attestation_id": "7f79a885-5fc7-4946-a27e-6d5c5dc412d0",
  "biometric_bound": false
}

The reason is the agent's own claim. Provenance binds it and shows it to the person who approves, labelled as the agent's words; it doesn't check that the reason is true.

3. Verify right before you execute

Your executor sends the token with the payload and reason it is about to act on to POST /v1/mandate/assessments. Run the action only when valid is true.

curl $PROVENANCE_API/v1/mandate/assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "intent_token": "'"$INTENT_TOKEN"'",
    "action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
    "action_payload": { "type": "payment", "amount": 1850, "currency": "USD", "payee": "acct_brindlecote_supplies" },
    "context_evidence": { "invoice": "INV-2041", "reason": "net-30 terms, due today" }
  }'
{
  "object": "mandate_assessment",
  "approval_context": null,
  "valid": true,
  "hardware_attested": false,
  "scope_match": true,
  "payload_bound": true,
  "intent_token_age_seconds": 0,
  "policy": null,
  "signature": { "method": "none", "valid": null, "key_id": null, "directory": null, "agent_id": null, "covers": [] },
  "authority": {
    "kind": "provenance_intent_token",
    "verified": true,
    "verified_against": "provenance_jwks",
    "alg": "ES256",
    "key_id": "kH3pQe",
    "issuer": "https://api.provenanceauth.com",
    "mandate_id": null,
    "approval_context_id": null,
    "cart_match": "not_applicable"
  }
}

Verify from the code that executes the action, not from the agent. If the agent could skip the check, the binding proves nothing.

A token authorizes one action. The first verify that returns valid: true spends it, so a second verify of the same token, or two at once, returns valid: false with token_already_used for all but one. A verify that returns valid: false (a step-up still waiting, a changed payload) spends nothing, so you can verify again once the person approves. To act again, authorize again for a fresh token. A token minted under a grant is counted by the grant's own limits instead.

When the agent signs its requests to your tool, pass the request as you received it in request: its method, URL and headers, and its body when the signature covers the body's digest. The signature is checked before the token and comes back as signature (see how the agent signed). A signature that doesn't verify makes the result valid: false.

authority names the token that covered the action and, under a grant, the grant and its chain.

4. See a changed reason fail

Each bound value is checked on its own. Here the agent's reason changed after the approval, so verification fails even though the payload is the same:

curl $PROVENANCE_API/v1/mandate/assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "intent_token": "'"$INTENT_TOKEN"'",
    "action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
    "action_payload": { "type": "payment", "amount": 1850, "currency": "USD", "payee": "acct_brindlecote_supplies" },
    "context_evidence": { "invoice": "INV-2041", "reason": "urgent, the CEO asked" }
  }'
{
  "object": "mandate_assessment",
  "valid": false,
  "reason": "context_hash_mismatch"
}

Each binding has its own reason code:

What changedreason
The descriptionaction_hash_mismatch
The payloadpayload_hash_mismatch
The stated reasoncontext_hash_mismatch

5. Pass your own facts in context

Facts that only your executor knows, such as the amount or the action type, go in context at verify. Your account's policy reads them. The default policy requires hardware-backed devices above 500, so this payment is refused on the sandbox's simulated device. The token from step 3 is spent, so authorize again first:

curl -s $PROVENANCE_API/v1/mandate/intents -o authorization.json \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
    "action_payload": { "type": "payment", "amount": 1850, "currency": "USD", "payee": "acct_brindlecote_supplies" },
    "context_evidence": { "invoice": "INV-2041", "reason": "net-30 terms, due today" },
    "agent_id": "'"$AGENT_ID"'",
    "agent_session_id": "'"$AGENT_SESSION_ID"'",
    "device_id": "dev_00000000000000000000000000000001"
  }'
export INTENT_TOKEN=$(jq -r .intent_token authorization.json)
curl $PROVENANCE_API/v1/mandate/assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "intent_token": "'"$INTENT_TOKEN"'",
    "action_description": "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
    "action_payload": { "type": "payment", "amount": 1850, "currency": "USD", "payee": "acct_brindlecote_supplies" },
    "context_evidence": { "invoice": "INV-2041", "reason": "net-30 terms, due today" },
    "context": { "transaction_amount": 1850, "action_type": "payment" }
  }'
{
  "object": "mandate_assessment",
  "valid": false,
  "reason": "hardware_required_above_500"
}

context is not bound into the token: it's your executor's input to policy, read at verify time.

6. Stop the agent's session

To stop an agent, revoke its session with POST /v1/mandate/revocations. Every token the session minted fails its next verify with token_revoked. You can instead revoke one token (intent_token) or everything from a device (device_id).

curl $PROVENANCE_API/v1/mandate/revocations \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "agent_session_id": "'"$AGENT_SESSION_ID"'", "reason": "agent stopped by operator" }'
{
  "object": "revocation",
  "scope": "session",
  "revoked": true,
  "reason": "agent stopped by operator"
}

A verifier that checks tokens offline can't see a revocation; it calls GET /v1/mandate/intents/{id} before a high-value action. To stop a registered agent across all its sessions, suspend it with POST /v1/mandate/agents/{id}/suspend; its tokens then fail with agent_suspended.

Errors you might see

SymptomCauseFix
valid: false, payload_hash_mismatchThe executor's payload differs from the authorized one, even by key order or a number's typeSend the payload exactly as authorized; keys are canonicalized, values are not.
valid: false, token_expiredTokens last four hoursAuthorize again.
valid: false, token_revokedThe token, its session or its device was revokedAuthorize again in a new session.
valid: false, token_already_usedAn earlier verify of this token was valid; a token authorizes one actionVerify once, right before you execute. Authorize again to act again.
valid: false, agent_signature_invalidThe request you passed carries a signature that doesn't verify: changed after signing, expired, replayed, or not covering the method and pathPass the request exactly as the agent sent it, headers and body unchanged.
valid: false, agent_signature_unverifiedThe signature's Signature-Agent directory didn't resolve or doesn't list its keyCheck the agent's directory publishes the key.
404 resource_missing at authorizeThe agent_id belongs to another accountUse an agent registered with this key's account.

See also