View as Markdown

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

  1. The person grants the grant. POST /v1/mandate/grants returns a signed mandate_token (ES256, verifiable with the same published keys as intent tokens).
  2. The agent authorizes under it. Each authorize sends the mandate_token, and the intent token is tied to the grant.
  3. Verify enforces it. Each verify checks the grant and its limits, then your policy, then debits the budget.
  1. Grant
    limits, budget, expiry
  2. Authorize
    intent token under the grant
  3. Verify
    limits → policy → budget debit

Verify runs its checks in this order, and stops at the first failure:

CheckFails with
The token's signature, expiry, description and payloadThe usual token reasons, such as payload_hash_mismatch
The grant is active and not expiredgrant_revoked, grant_expired
The action fits the grant's limitsgrant_constraint_violated, with grant_detail
The amount is in the grant's currency, when it states onegrant_currency_mismatch
The grant has purchases left (max_uses, max_purchases)grant_uses_exhausted, grant_purchase_limit_reached
Your account policyThe policy's reason; no budget is spent
The window's budget covers transaction_amountgrant_budget_exceeded, with budget_spent and budget_limit

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 /v1/mandate/grants/{id}/spend 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_amount at verify.
budget_amountnumber | null
The total allowed per budget_window.
budget_windowstring | null
day, week or month, counted in UTC.
allowed_action_typesstring[]
The allowed context.action_type values. Empty allows any.
allowed_counterpartiesstring[] | null
The allowed context.counterparty values. null allows any.
scheduleobject | null
A standing schedule: one payment per cadence (weekly, monthly or quarterly) to one counterparty, of amount_fixed or up to amount_max. A second payment in the same cycle fails with schedule_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 matching context.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. 1 makes it single use. A spent grant stays spent.
max_purchasesinteger
Purchases allowed per purchase_window: day, week or month in UTC, or lifetime. 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_mcc refuses kinds of store; a block wins over every allow list (kinds of merchant and countries).
blocked_counterpartiesarray
Stores refused, matched as allowed_counterparties is.
allowed_countriesarray
Merchant countries allowed, as PT or 620; blocked_countries refuses 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 lodging to is the check-out date). Separate from expires_at. Checked against each cart line's service_period (service dates).
over_limitobject
What each limit does when a cart at a store goes past it: ask a person or refuse, 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):

SettingFieldValueLabelWhat it does
ShareallocationreservedReservedSet aside from the parent. Other subagents can't spend it.
sharedFlexible shareDrawn from what the parent has left. Nothing is set aside.
At the limitat_limitstopStopAnything past the amount is refused.
askAsk meThe person is asked, up to ask_up_to past the amount. Past that, refused.
continueKeep goingGoes 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:

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5

curl -s $PROVENANCE_API/v1/mandate/grants \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "device_id": "dev_00000000000000000000000000000001",
    "agent_session_id": "sess_ap_1",
    "constraints": {
      "max_amount": 400, "budget_amount": 500, "budget_window": "day",
      "allowed_action_types": ["payment"], "allowed_counterparties": ["acct_brindlecote_supplies"],
      "expires_at": "2027-12-31T23:59:59Z"
    }
  }' | tee mandate.json
export MANDATE_ID=$(jq -r .id mandate.json)
export MANDATE_TOKEN=$(jq -r .mandate_token mandate.json)

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)
{
  "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" }
  }'
{
  "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 /v1/mandate/grants/{id}.

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>:

  1. POST /v1/mandate/grant_drafts with the device, the agent's name and the constraints. The draft lasts up to 15 minutes (expires_in) and creates nothing until it's allowed.
  2. Mint a mandate embed token for the draft's id. 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's currency.
  3. 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/grants would, with an approval_context that records how the person allowed it (approval context).
  4. GET /v1/mandate/grant_drafts/{id} returns status: granted, the grant_id and the mandate_token for 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 /v1/mandate/grants/{id}/heartbeat/challenge, sign it with a passkey as in biometric approval, and post the assertion to POST /v1/mandate/grants/{id}/heartbeat. The challenge changes every period, so an old check-in can't be replayed.

StateWhat happens
Checked in this periodThe grant works as usual.
Missed, past grace_hoursThe grant suspends: verify fails with grant_heartbeat_lapsed, the mandate.grant.heartbeat_lapsed webhook fires, and the person is notified.
Checked in within 7 days of suspendingThe grant is active again.
No check-in after thatThe grant expires for good.

Revoke a grant

Revoke with POST /v1/mandate/grants/{id}/revoke. 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" }'
{
  "id": "grt_01M5Q33ZKY22JZP271J6VF93B0",
  "object": "grant",
  "status": "revoked"
}

Delegate to subagents

An agent that starts subagents gives each one its own child grant with POST /v1/mandate/grants/{id}/delegate: 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 /v1/mandate/assessments.