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 /:
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)
import { Provenance } from "@provenanceauth/sdk";
const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const agent = await prov.mandate.agents.create({ name: "invoice-bot" });
const agentSessionId = `sess_${Date.now()}`;
import os, time
import httpx
from provenanceauth import Provenance
prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
api, headers = os.environ["PROVENANCE_API"], {"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}
agent = httpx.post(f"{api}/v1/mandate/agents", json={"name": "invoice-bot"}, headers=headers).json()
agent_session_id = f"sess_{int(time.time())}"
{
"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 / with three things bound into the token:
| Field | Bound as | What it proves |
|---|---|---|
action_ | payload_ | The exact machine payload the agent will run, such as a payment or an API request body |
context_ | context_ | The agent's stated reason, shown to the person who approves |
agent_ | agent (id, name, integration, sdk_) | 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)
const action = {
actionDescription: "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies",
actionPayload: { type: "payment", amount: 1850, currency: "USD", payee: "acct_brindlecote_supplies" },
contextEvidence: { invoice: "INV-2041", reason: "net-30 terms, due today" },
};
const auth = await prov.mandate.intents.create({
...action,
agentId: agent.id,
agentSessionId,
deviceId: "dev_00000000000000000000000000000001",
});
description = "Pay invoice INV-2041: $1,850.00 to Brindlecote Supplies"
payload = {"type": "payment", "amount": 1850, "currency": "USD", "payee": "acct_brindlecote_supplies"}
reason = {"invoice": "INV-2041", "reason": "net-30 terms, due today"}
auth = prov.mandate.intents.create(
action_description=description,
action_payload=payload,
context_evidence=reason,
agent_id=agent["id"],
agent_session_id=agent_session_id,
device_id="dev_00000000000000000000000000000001",
)
{
"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 /. 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" }
}'
const check = await prov.mandate.assessments.create({ intentToken: auth.intentToken, ...action });
if (check.valid) {
// run the payment
}
check = prov.mandate.assessments.create(
intent_token=auth["intent_token"],
action_description=description,
action_payload=payload,
context_evidence=reason,
)
{
"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" }
}'
const changed = await prov.mandate.assessments.create({
intentToken: auth.intentToken,
...action,
contextEvidence: { invoice: "INV-2041", reason: "urgent, the CEO asked" },
});
changed = prov.mandate.assessments.create(
intent_token=auth["intent_token"],
action_description=description,
action_payload=payload,
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 changed | reason |
|---|---|
| The description | action_ |
| The payload | payload_ |
| The stated reason | context_ |
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" }
}'
const again = await prov.mandate.intents.create({
...action,
agentId: agent.id,
agentSessionId,
deviceId: "dev_00000000000000000000000000000001",
});
const withFacts = await prov.mandate.assessments.create({
intentToken: again.intentToken,
...action,
context: { transactionAmount: 1850, actionType: "payment" },
});
again = prov.mandate.intents.create(
action_description=description,
action_payload=payload,
context_evidence=reason,
agent_id=agent["id"],
agent_session_id=agent_session_id,
device_id="dev_00000000000000000000000000000001",
)
with_facts = prov.mandate.assessments.create(
intent_token=again["intent_token"],
action_description=description,
action_payload=payload,
context_evidence=reason,
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 /. 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" }'
await prov.mandate.revocations.create({ agentSessionId, reason: "agent stopped by operator" });
prov.mandate.revocations.create(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 / before a high-value action. To stop a registered agent across all its sessions, suspend it with POST /; its tokens then fail with agent_suspended.
Errors you might see
| Symptom | Cause | Fix |
|---|---|---|
valid: false, payload_ | The executor's payload differs from the authorized one, even by key order or a number's type | Send the payload exactly as authorized; keys are canonicalized, values are not. |
valid: false, token_ | Tokens last four hours | Authorize again. |
valid: false, token_ | The token, its session or its device was revoked | Authorize again in a new session. |
valid: false, token_ | An earlier verify of this token was valid; a token authorizes one action | Verify once, right before you execute. Authorize again to act again. |
valid: false, agent_ | The request you passed carries a signature that doesn't verify: changed after signing, expired, replayed, or not covering the method and path | Pass the request exactly as the agent sent it, headers and body unchanged. |
valid: false, agent_ | The signature's Signature-Agent directory didn't resolve or doesn't list its key | Check the agent's directory publishes the key. |
404 resource_ at authorize | The agent_ belongs to another account | Use an agent registered with this key's account. |