# Intent tokens and receipts

Intent tokens prove an action was authorized before it runs, and receipts prove what was decided afterwards. Both are ES256 signatures anyone can check offline against the published keys.

An intent token is a short-lived ES256 signature that binds one exact action an agent is about to take, so whoever runs the action can check that it was authorized. A receipt is a signed record of a decision after it was made, so anyone you hand it to can check what was decided without trusting you or Provenance.

## When to use it

- A store, a bank or another agent receives an order and checks the token that came with it before it ships or pays.
- You hand a counterparty, an auditor or a card network proof of who approved an action and under which rule.
- Your own service checks a token or a receipt offline, with no API key and no call to Provenance.

## How it works

1. **An agent asks first.** [`POST /v1/mandate/intents`](https://provenanceauth.com/docs/api/intent-tokens.md#post-v1-mandate-intents) returns an `intent_token` for one action description and, optionally, its exact payload. When the account's rules ask a person, the token stays on hold until they approve.
2. **Whoever runs the action checks the token.** The signature, the expiry and the hashes of the description and payload must match what is about to run.
3. **Every decision is recorded and can be signed.** Each check writes a record to the [decision ledger](https://provenanceauth.com/docs/mandate/concepts/decision-ledger.md); its receipt is the same record, signed, for anyone to verify.

1. **Intent token**: ES256, binds the action's hashes
2. **Check before it runs**: offline, POST /v1/verify, or with your key
3. **Receipt**: ES256, the decision as recorded

Both are signed with ES256 by the same keys, published at [`GET /.well-known/jwks.json`](https://provenanceauth.com/docs/api/public-keys.md#get-well-known-jwks-json). Each token's header names its key in `kid`, so a key rotation lists both keys for a while and old tokens keep verifying. Only ES256 is accepted: a token with any other `alg` fails with reason `invalid_token`.

## Intent tokens

An intent token is a JWT that lasts four hours. The claims you'll check most:

| Claim | What it holds |
| --- | --- |
| `jti` | The token's ID, the `attestation_id` returned when it was minted. Used for revocation. |
| `sub` | An opaque subject for the person, never a device id: the same for one person at your site, and unrelated at every other site, when the token names an `audience`. |
| `aud` | The one site the token is for, when the agent named one. Accept it only when it names you. |
| `action_hash` | SHA-256 of the approved action description. |
| `payload_hash` | SHA-256 of the canonical JSON of the approved payload, when one was bound. |
| `confirmed` | When a person approved and how it reached them. Present only when a person approved. |
| `exp` | The expiry. |

The full list, and the paid check that adds how the person approved, are in [verify a token](https://provenanceauth.com/docs/authorize/guides/verify-tokens.md).

A grant token works the same way for standing permission: a person grants an agent limits once with [`POST /v1/mandate/grants`](https://provenanceauth.com/docs/api/grants.md#post-v1-mandate-grants), and the agent shows the signed `mandate_token` instead of asking each time ([grants](https://provenanceauth.com/docs/mandate/concepts/grants.md)).

## Receipts

Every receipt endpoint returns the same `receipt` object: `claims`, the signed content decoded; `token`, the ES256 JWS that carries it; and `verify_url`, a link that opens it on the console's Verify a proof page. Receipts are rebuilt from the ledger record each time, never stored.

| Receipt | Issued by | Endpoint |
| --- | --- | --- |
| Decision | Mandate | [`GET /v1/mandate/assessments/{id}/receipt`](https://provenanceauth.com/docs/api/decisions.md#get-v1-mandate-assessments-id-receipt) |
| Agreement | Mandate | [`GET /v1/mandate/agreements/{id}/receipt`](https://provenanceauth.com/docs/api/agreements.md#get-v1-mandate-agreements-id-receipt) |
| Verification | Authorize | [`GET /v1/authorize/verifications/{id}/receipt`](https://provenanceauth.com/docs/api/verifications.md#get-v1-authorize-verifications-id-receipt) |
| Deal | Authorize | [`GET /v1/authorize/deals/{id}/receipt`](https://provenanceauth.com/docs/api/deals.md#get-v1-authorize-deals-id-receipt) |
| Dispute | Authorize | [`GET /v1/authorize/disputes/{id}/receipt`](https://provenanceauth.com/docs/api/disputes.md#get-v1-authorize-disputes-id-receipt) |
| Verified call | Authorize | [`GET /v1/authorize/call_checks/{id}/receipt`](https://provenanceauth.com/docs/api/call-checks.md#get-v1-authorize-call-checks-id-receipt) |

A receipt you hand to a third party, such as through the receipt embed, carries the free claims only: the decision, its result and its place in the hash chain, with no device, session, agent or approval detail.

## Check a token or a receipt

| Check | Key | What it confirms |
| --- | --- | --- |
| Offline, against the published keys | None | Signature and expiry |
| [`POST /v1/verify`](https://provenanceauth.com/docs/api/verify.md#post-v1-verify) | None | Signature, issuer, expiry, revocation, approval holds, the payload binding and the free claims |
| [`POST /v1/authorize/verifications`](https://provenanceauth.com/docs/api/verifications.md#post-v1-authorize-verifications) | Your account key | All of that, your checkout rules and how the person approved |
| [`POST /v1/mandate/assessments`](https://provenanceauth.com/docs/api/intent-tokens.md#post-v1-mandate-assessments) | A key for the issuing account | Every check at once, with your policy, and a new ledger record |

The offline verifiers are in the Node and Python SDKs and in verifier-only libraries for Python and Go ([SDKs and tools](https://provenanceauth.com/docs/get-started/sdks.md)). To check one by hand, paste it into the console's [Verify a proof](https://provenanceauth.com/docs/integrate/verify-a-proof.md) page.

## Related

- [Verify a token](https://provenanceauth.com/docs/authorize/guides/verify-tokens.md): the offline check, the free check and the paid one, step by step
- [Assess an agent checkout](https://provenanceauth.com/docs/authorize/guides/assess-checkouts.md): one call for a store's checkout
- [Execution binding](https://provenanceauth.com/docs/mandate/guides/execution-binding.md): bind the exact payload an agent will run
- [Decision ledger](https://provenanceauth.com/docs/mandate/concepts/decision-ledger.md): the record every receipt is signed from
- [Transparency log](https://provenanceauth.com/docs/concepts/transparency-log.md): the public checkpoints of each account's chain
- [Glossary](https://provenanceauth.com/docs/get-started/glossary.md#intent-token)
