Mandate · Concept
Network grants
A network grant is one permission a person gives an agent, such as a per-order limit and a monthly budget at any store, that every store accepting Provenance honours. The person grants it once in Provenance, the app for people, with their passkey. The agent then buys without asking, inside the limits, and asks the person for anything outside them.
When to use it
- A shopping agent buys at many stores for the same person, with one budget across all of them.
- A person wants to give an agent standing limits once, instead of approving every order.
- A store wants to accept agent orders that a person already authorized, with the budget checked for it.
For one company's own agent and its own customers, a grant is simpler.
How it works
- The agent's maker asks. POST
/names a verified agent and the limits. The person opensv1/ mandate/ grant_ requests grant_url, lowers any limit and grants it with a passkey. The maker gets the grant token by themandate.network_grant.grantedwebhook. - The agent buys. POST
/takes the token, the store's cart and the store's origin. Inside the limits, the amount is reserved from the budget and a cart-bound intent token comes back.v1/ mandate/ network_ orders - The store accepts online. POST
/turns the reservation into spend. The store ships only after it.v1/ authorize/ network_ orders/ confirm
- Grantthe person's limits, a passkey
- Authorizereserve, then a 10-minute token
- Acceptthe store, online: spend
Why the store accepts online
Offline verification proves the token and the exact cart, but it can't stop two stores each spending the last of a budget. Each authorize reserves its amount atomically, and only the online accept turns it into spend. A reservation the store never accepts is released when its token expires after 10 minutes, and POST / gives a cancelled or refunded order back to the budget.
verifyAgentCheckout in @provenanceauth/rails/checkout returns requires_online_accept for these tokens. acceptNetworkOrder verifies the token offline and then accepts it online in one call.
Limits and outcomes
max_amountnumber | null- The per-order limit, in major units of
currency. budget_amountnumber | null- The budget per
budget_window(day,weekormonth, counted in UTC). allowed_storesstring[] | null- Store origins the agent may buy at without asking.
nullallows any store. blocked_storesstring[]- Store origins it never buys at.
heartbeatobject | null- A check-in the person confirms every week, two weeks or month; the grant stops if they don't.
expires_atstring- At most a year out.
The person's personal rules apply on top. Authorize answers with one result:
result | What happens | reason |
|---|---|---|
authorized | A token and a reservation | |
approval_ | The person is asked for this one order; show them approval., then authorize again with approval_ | over_, over_, store_, ask_, outside_ |
refused | Nothing is reserved | network_, agent_, store_, currency_ |
Control and privacy
The person can lower any limit at once, raise one with their passkey (above what the agent asked for, up to the maker's hard_max when it set one), pause it, resume it with their passkey or revoke it, or turn the agent off everywhere.
Each change reaches the maker as mandate.network_grant.updated or mandate.network_grant.revoked, and a revoked or paused grant refuses new authorizes and fails accept for outstanding tokens at once.
An order a different limit would let through carries an adjust link for the person: see when a person changes a grant.
Before it ends, the person can renew it with their passkey or the Provenance app: by its first length, or a length they pick up to what the agent asked for, counted from the current end. The token carries its expiry, so the maker gets mandate.network_grant.renewed with a fresh token in data.network_mandate (plus previous_expires_at and expires_at); GET / returns the fresh token too. Switch to it: the old one stops at the old end.
The maker sees the person only as a pairwise subject. Each store sees a different sub for the same person, so two stores can't link their customers.
Pricing: free for people and agent makers. Each accepted order counts as one decision for the store.
Example
An agent's maker asks a person for a network grant with POST /. The agent needs an active signing key, so register one first:
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST $PROVENANCE_API/v1/mandate/agents \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "name": "cartwise", "category": "shopping_agent" }' > agent.json
export AGENT_ID=$(jq -r .id agent.json)
curl -s -X POST $PROVENANCE_API/v1/identify/agents/$AGENT_ID/signing_keys \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{ "jwk": { "kty": "OKP", "crv": "Ed25519", "x": "G_STrQBvTD7Bi8OjlNnLcKPPiPp03Vh0sJKTMG7QzFY" } }' > /dev/null
curl -s -X POST $PROVENANCE_API/v1/mandate/grant_requests \
-H "Authorization: Bearer $PROVENANCE_KEY" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "'"$AGENT_ID"'",
"proposed": { "max_amount": 50, "budget_amount": 200, "budget_window": "month", "currency": "USD", "expires_at": "2027-06-30T00:00:00Z" },
"return_url": "https://cartwise.example/connected"
}'
const res = await fetch(`${process.env.PROVENANCE_API}/v1/mandate/grant_requests`, {
method: "POST",
headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
agent_id: agentId,
proposed: { max_amount: 50, budget_amount: 200, budget_window: "month", currency: "USD", expires_at: "2027-06-30T00:00:00Z" },
return_url: "https://cartwise.example/connected",
}),
});
const request = await res.json();
import os, httpx
request = httpx.post(f"{os.environ['PROVENANCE_API']}/v1/mandate/grant_requests",
headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"},
json={
"agent_id": agent_id,
"proposed": {"max_amount": 50, "budget_amount": 200, "budget_window": "month", "currency": "USD", "expires_at": "2027-06-30T00:00:00Z"},
"return_url": "https://cartwise.example/connected",
}).json()
{
"object": "network_grant_request",
"status": "pending",
"proposed": { "max_amount": 50, "budget_amount": 200, "budget_window": "month", "currency": "USD" },
"network_grant_id": null
}
Send the person to grant_url. They grant it with a passkey and can lower any limit. The grant token's claims then carry the limits the person chose, the agent's name and the person's yes, with a subject that differs at each store:
{
"iss": "provenance-authorize",
"jti": "ngr_01M6JJ6A2Q7Y1SXJ6R9P8VY4QK",
"sub": "psub_4kq2x7mzt5w3n8b6c1v9d0f2gh",
"aud": "provenance-network",
"mandate": true,
"network": true,
"constraints": {
"max_amount": 40,
"budget_amount": 150,
"budget_window": "month",
"currency": "USD",
"allowed_stores": null,
"blocked_stores": [],
"allowed_categories": [],
"heartbeat": null,
"expires_at": "2027-06-30T00:00:00.000Z"
},
"agent": { "name": "cartwise" },
"confirmed": { "at": "2026-11-04T06:02:11.000Z", "via": "grant" },
"risk": { "score": 5, "action": "allow" }
}