Mandate · Concept
Grants
A grant is a person's standing, bounded authority for an agent, such as "pay these suppliers, within a per-payment limit and a daily budget, until December", that lets the agent act without asking each time. The agent authorizes each action under the grant, and every verify enforces its limits on top of your account policy.
When to use it
- An agent pays recurring or routine bills within limits the person set once.
- A purchasing agent buys from approved suppliers up to a budget.
- A scheduled payment, such as monthly rent, runs once per cycle without a new approval.
For one-off actions that need a person each time, use step-up approval instead.
How it works
- The person grants the grant. POST
/returns a signedv1/ mandate/ grants mandate_token(ES256, verifiable with the same published keys as intent tokens). - The agent authorizes under it. Each authorize sends the
mandate_token, and the intent token is tied to the grant. - Verify enforces it. Each verify checks the grant and its limits, then your policy, then debits the budget.
- Grantlimits, budget, expiry
- Authorizeintent token under the grant
- Verifylimits → policy → budget debit
Verify runs its checks in this order, and stops at the first failure:
| Check | Fails with |
|---|---|
| The token's signature, expiry, description and payload | The usual token reasons, such as payload_ |
| The grant is active and not expired | grant_, grant_ |
| The action fits the grant's limits | grant_, with grant_ |
The amount is in the grant's currency, when it states one | grant_ |
The grant has purchases left (max_, max_) | grant_, grant_ |
| Your account policy | The policy's reason; no budget is spent |
The window's budget covers transaction_ | grant_, with budget_ and budget_ |
A grant never bypasses your policy. The budget is debited atomically, so concurrent verifies can't spend the same budget twice. Each valid verify debits, so verify once, right before the action runs.
A store on Authorize spends from the same budget. When the agent shows the grant (or a token minted under it) at a store's checkout assessment and the cart goes through, the cart's total is debited from the window. A cart the budget can't take is challenged. One cart spends once, whether the store, your verify call or both see it.
Each debit also writes a spend entry: its kind (verify or checkout), amount, currency and what caused it (the decision, the assessment, the token). GET / lists them, newest first. A verify pass and a store-covered cart are each one purchase for max_uses and max_purchases; a cart counted at the store and verified later is still one.
Key fields
max_amountnumber | null- The most a single action may be. Compared with
context.transaction_amountat verify. budget_amountnumber | null- The total allowed per
budget_window. budget_windowstring | nullday,weekormonth, counted in UTC.allowed_action_typesstring[]- The allowed
context.action_typevalues. Empty allows any. allowed_counterpartiesstring[] | null- The allowed
context.counterpartyvalues.nullallows any. scheduleobject | null- A standing schedule: one payment per
cadence(weekly,monthlyorquarterly) to onecounterparty, ofamount_fixedor up toamount_max. A second payment in the same cycle fails withschedule_already_executed. heartbeatobject- Optional check-ins that keep the grant alive; see heartbeats.
currencystring- The ISO 4217 code the amounts are in, such as
USD. An amount in another currency isn't covered: verify needs a matchingcontext.currency, and a store's cart must be in it. There is no conversion. Leave it out to compare amounts as plain numbers. max_usesinteger- Purchases allowed over the grant's whole life.
1makes it single use. A spent grant stays spent. max_purchasesinteger- Purchases allowed per
purchase_window:day,weekormonthin UTC, orlifetime. Independent of the budget window. allowed_mccarray- Kinds of store by merchant category code: groups such as
{ "group": "lodging" }or ranges. Checked against the MCC the store declares with the cart.blocked_mccrefuses kinds of store; a block wins over every allow list (kinds of merchant and countries). blocked_counterpartiesarray- Stores refused, matched as
allowed_counterpartiesis. allowed_countriesarray- Merchant countries allowed, as
PTor620;blocked_countriesrefuses countries. Checked against the country the store declares. service_windowobject- The dates of what is bought,
{ "from": "2027-03-12", "to": "2027-03-16" }(both included; for lodgingtois the check-out date). Separate fromexpires_at. Checked against each cart line'sservice_period(service dates). over_limitobject- What each limit does when a cart at a store goes past it:
aska person orrefuse, per lock (amount,budget,counterparty,currency,uses,purchases,category,country,block,dates). The amount and budget locks ask up to a margin,refuse_over: { "percent": 20 }by default (or a fixed{ "amount": 300 }in the grant's currency), and refuse past it. Leave a lock out to follow the grant above, then your account's settings. expires_atstring- When the grant ends. Required.
Beside the constraints, a grant can carry a purpose (one line of plain text the person sees with the limits, such as "Restock printer paper for the office"), the agent_id of the registered agent that holds it, and max_depth, how many levels of subagents may sit below it (default 4). The token then carries purpose_hash, the sha256 of the purpose. A grant without them keeps its exact token.
Budgets
A subagent's budget has two settings, the same on a company grant's child (budget on a delegate or a proposal) and on a helper in a person's plan (budget beside its amount):
| Setting | Field | Value | Label | What it does |
|---|---|---|---|---|
| Share | allocation | reserved | Reserved | Set aside from the parent. Other subagents can't spend it. |
shared | Flexible share | Drawn from what the parent has left. Nothing is set aside. | ||
| At the limit | at_ | stop | Stop | Anything past the amount is refused. |
ask | Ask me | The person is asked, up to ask_ past the amount. Past that, refused. | ||
continue | Keep going | Goes past the amount without asking while every budget above has room. |
ask_up_to goes with ask only: { "percent": 20 } by default, or a fixed { "amount": 50 } in the grant's currency; null asks at any amount the parent has room for. Any share works with any limit behaviour. On a company grant, stop and ask set the budget lock's over-limit setting (constraints.over_limit.budget).
Read more in share the parent's budget.
The currency, the purchase counts, the kinds of store, countries and block lists, the service window and the over-limit settings stay on the server: the token never carries them.
With max_uses, the grant shows uses and remaining_uses; with max_purchases, purchases in the current window.
A grant token travels to every counterparty, so its sub is a per-token subject (anon_…), never the device id. Provenance resolves the device from the grant itself, so revoking the device still stops it. Grants given before October 2026 carry the device's UUID until they expire; grant a new one and revoke the old one to replace it.
Give and use a grant
Give a grant, authorize under it, and verify with the facts the grant checks. Export the sandbox account key first:
The response, trimmed:
{
"id": "grt_01M5Q33ZKY22JZP271J6VF93B0",
"object": "grant",
"status": "active",
"agent_session_id": "sess_ap_1",
"approval_context": null,
"remaining_budget": 500,
"mandate_token": "eyJhbGciOiJFUzI1NiIsInR5cCI6Im1hbmRhdGUrand0In0.eyJpc3MiOiJwcm92ZW5hbmNlLWF1dGhvcml6ZSJ9.HBZ1gq7tZyq7p7KhKbGDj3Rrcn9DRckwHHvkF7B-L7plT84vCNY1BVBAKlAv5Y8LywQwU0I3rxTBG3qQCk0bCQ"
}
The agent authorizes a payment under the grant:
curl -s $PROVENANCE_API/v1/mandate/intents \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"action_description": "Pay invoice INV-2041: $300.00 to Brindlecote Supplies",
"agent_session_id": "sess_ap_1",
"device_id": "dev_00000000000000000000000000000001",
"mandate_token": "'"$MANDATE_TOKEN"'"
}' | tee authorization.json
export INTENT_TOKEN=$(jq -r .intent_token authorization.json)
const auth = await prov.mandate.intents.create({
actionDescription: "Pay invoice INV-2041: $300.00 to Brindlecote Supplies",
agentSessionId: "sess_ap_1",
deviceId: "dev_00000000000000000000000000000001",
mandateToken: mandate.mandateToken,
});
auth = prov.mandate.intents.create(
action_description="Pay invoice INV-2041: $300.00 to Brindlecote Supplies",
agent_session_id="sess_ap_1",
device_id="dev_00000000000000000000000000000001",
mandate_token=mandate["mandate_token"],
)
{
"object": "intent_authorization",
"intent_token": "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJwcm92ZW5hbmNlLWF1dGhvcml6ZSJ9.mnIslW_8ZGoSLdXzXXOBtTAEpAQ1Ht05ruMPMJAwMdPnFwyggE1iabNZHTC4_9yYhhPu62ijzHhPqhyZ09wfdw",
"expires_at": "2026-10-24T17:55:32.000Z",
"biometric_bound": false
}
The executor verifies with the amount, action type and counterparty in context. A counterparty outside the grant fails before anything is spent:
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: $300.00 to Brindlecote Supplies",
"context": { "transaction_amount": 300, "action_type": "payment", "counterparty": "acct_unknown_vendor" }
}'
const check = await prov.mandate.assessments.create({
intentToken: auth.intentToken,
actionDescription: "Pay invoice INV-2041: $300.00 to Brindlecote Supplies",
context: { transactionAmount: 300, actionType: "payment", counterparty: "acct_unknown_vendor" },
});
check = prov.mandate.assessments.create(
intent_token=auth["intent_token"],
action_description="Pay invoice INV-2041: $300.00 to Brindlecote Supplies",
context={"transaction_amount": 300, "action_type": "payment", "counterparty": "acct_unknown_vendor"},
)
{
"object": "mandate_assessment",
"valid": false,
"reason": "grant_constraint_violated",
"grant_detail": "counterparty not permitted by mandate"
}
With "counterparty": "acct_brindlecote_supplies" the verify is valid and the day's remaining budget drops to 200. Read it with GET /.
Allow it in your product
Instead of building the "allow this agent" screen and the passkey prompt yourself, create a draft and show it in <provenance-grant>:
- POST
/with the device, the agent's name and the constraints. The draft lasts up to 15 minutes (v1/ mandate/ grant_ drafts expires_in) and creates nothing until it's allowed. - Mint a
mandateembed token for the draft'sid. The component shows each limit in plain words, such as "Only at quillstack.example", "Check in every month" and "Until Dec 31", with amounts in the draft'scurrency. - The person taps Allow and their passkey signs a challenge bound to this draft and its exact limits. Provenance grants the same grant
POST /v1/mandate/grantswould, with anapproval_contextthat records how the person allowed it (approval context). - GET
/returnsv1/ mandate/ grant_ drafts/ {id} status: granted, thegrant_idand themandate_tokenfor your agent.
Not now closes the draft (declined) and nothing is set up. A draft that's already allowed, declined or past its 15 minutes answers 409 grant_draft_closed. The same component with mode="checkin" runs the check-in below, and <provenance-agent-access> lists a person's grants on your account with a Turn off button for each.
Heartbeats
A heartbeat keeps a long-lived grant tied to the person's attention: they check in each period with a passkey, or the grant suspends. Add it at grant time as "heartbeat": { "interval": "weekly", "grace_hours": 72 }. The interval can be weekly, every two weeks (biweekly) or monthly. A grant confirmed with a passkey counts as the first check-in, so the next one is due at the start of the next period plus grace_hours; a grant without a passkey needs a check-in in its first period.
In your product, <provenance-grant mode="checkin"> does the whole check-in: it shows the spend this window and the limits, and Keep it on signs the period's challenge with the person's passkey. To check in through the API, get the period's challenge from GET /, sign it with a passkey as in biometric approval, and post the assertion to POST /. The challenge changes every period, so an old check-in can't be replayed.
| State | What happens |
|---|---|
| Checked in this period | The grant works as usual. |
Missed, past grace_ | The grant suspends: verify fails with grant_, the mandate. webhook fires, and the person is notified. |
| Checked in within 7 days of suspending | The grant is active again. |
| No check-in after that | The grant expires for good. |
Revoke a grant
Revoke with POST /. Every token minted under it then fails verify with grant_revoked. Revoking again returns the same result.
When the person turns a grant off themselves in your product, with <provenance-agent-access> (one agent or Turn off all) or a check-in's Turn it off, you get a mandate.grant.revoked webhook for each one.
curl $PROVENANCE_API/v1/mandate/grants/$MANDATE_ID/revoke \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "reason": "supplier contract ended" }'
await prov.mandate.grants.revoke(mandate.id);
prov.mandate.grants.revoke(mandate["id"], reason="supplier contract ended")
{
"id": "grt_01M5Q33ZKY22JZP271J6VF93B0",
"object": "grant",
"status": "revoked"
}
Delegate to subagents
An agent that starts subagents gives each one its own child grant with POST /: narrower limits, its own session and its own purpose, with no passkey. Every spend under a child counts against its own budget and every budget above it, and revoking a grant revokes everything delegated below it. See delegate to subagents. An agent asked by another agent checks the asker's grant with verifyMandate; see check an agent's grant.
Offline checks and the budget
A verifier checking a grant-bound token offline sees the grant's ID and fixed limits in the token, but not how much budget is left: the budget lives on the server and is debited at verify. For anything that spends, call POST /.
Related
- Agent payments, for grants as AP2 open Payment Mandates
- Policies
- Delegate to subagents
- Decision ledger, which records each decision with its grant