Skip to main content

Token API

POST /v1/token/exchange​

RFC 8693 token exchange — form-encoded, not JSON, and its errors follow RFC 6749 §5.2 ({"error": "...", "error_description": "..."}) rather than this project's usual error envelope, since an OAuth client already knows how to read that shape.

Request (application/x-www-form-urlencoded):

FieldRequiredNotes
grant_typeYesMust be urn:ietf:params:oauth:grant-type:token-exchange
subject_tokenYesThe presented (current-hop) token
subject_token_typeYesMust be urn:ietf:params:oauth:token-type:jwt
resourceYesThe target this exchange narrows to
scopeYesThe data class this exchange narrows to
action_idYesThe action_id from the POST /v1/authorize allow this exchange spends
actor_token / actor_token_typeNoProof-of-possession actor assertion (future identity work)
audienceNo
taintNo

An exchange re-decides rather than trusting that /v1/authorize was called first, and it only succeeds if action_id names a committed allow row matching this exact hop (session, caller, target, data class) — see The delegation-chain audit model.

Response — 200:

{"access_token": "<JWT, hop N+1>", "issued_token_type": "urn:ietf:params:oauth:token-type:jwt", "token_type": "Bearer", "expires_in": 60}

Decoded, the new token's sub is unchanged, aud is exactly resource, scope is exactly the requested scope, hop is one greater than the subject token's, and act nests the subject token's own sub — the delegation proof.

Errors (RFC 6749 shape, all in the error/error_description form above):

HTTPerrorMeaning
403invalid_targetThe recorded allow no longer holds under a fresh decision
400invalid_grant (already exchanged)subject_token's jti was already spent
400invalid_grant (bad action_id)Missing or malformed action_id
503invalid_grant (guard unavailable)Single-use replay guard couldn't be reached; refuses to issue rather than risk a double-mint

See JWKS for the companion endpoint a resource server uses to verify the tokens this endpoint mints, offline.

POST /v1/token/transaction​

Mints a transaction token for one call to a privileged tool, bound to its exact parameters. The resource rejects it for any other target, any changed parameter, or a second use.

Bearer: the hop token issued for this tool call, whose aud is the target. A delegation token or a root grant is refused. The decision is read from the token's signed action_id claim, never from the body.

Request body (TransactionMintRequest):

{"params": {"account_id": "acc-123", "reason": "customer request"}}

params is the JSON object the agent will send. The binding covers the whole object, or only the RFC 6901 pointers the tool declares in its manifest's binding_params.

Response: 200 (TransactionMinted)

{"transaction_token": "<JWT>", "action_id": "...", "params_hash": "<base64url SHA-256>", "binding": null, "expires_in": 30}

binding is the pointers applied, or null for the whole body. Send the token as the Txn-Token header with the call.

Errors (standard envelope):

HTTPerror.codeMeaning
401unauthorizedThe bearer isn't the hop token for a tool call, or its decision doesn't authorize a transaction
403policy_deniedTAINTED_INTO_PRIVILEGED: a tainted context can't mint call-bound authority
409transaction_already_mintedThis decision already has a transaction token
422validation_errorThe target isn't privileged, params can't be canonicalized, or it exceeds AGENTIC_AUTH_MAX_PRIVILEGED_BODY_BYTES
404not_foundAGENTIC_AUTH_TRANSACTION_TOKENS_ENABLED=false