Skip to main content
Agent session authentication lets agentic payment workflows authenticate once and operate within a declared spend cap for the duration of a session. Two credential paths are supported:
  • ATB ZKP certificate — the agent presents a Falcon-1024 signed ATB Pass Certificate (Phase 2, Bulletproofs range proof). Open to all tenants.
  • Federation token — the agent presents a pre-composed cross-issuer federation token. Available under the AlgoVoi Commercial License.

Why it exists

Standard API key authentication is stateless: every request to /x402, /mpp, /ap2, or /a2a presents the full API key. For high-frequency agentic workflows — where an agent may make dozens of payment decisions per session — this has two problems:
  1. Repeated key exposure — the API key travels on every request.
  2. No session-level spend governance — there is no in-gateway mechanism to cap total spend for a single agentic run, independent of the tenant-level volume caps.
Agent session tokens solve both. The agent presents its API key and ATB ZKP cert once, receives a short-lived signed token, and uses that token for the remainder of the session. The token embeds a spend cap enforced in-process on every payment route.

Prerequisites

Authentication flow

POST /auth/token

Exchange an ATB ZKP certificate for a session token.

Request

Commercial License required for federation_token. The federation_token path requires the algovoi-federation-validator service, which is available under the AlgoVoi Commercial License v1.0. Evaluation use (non-production testing) is free. Production or commercial deployment requires a written licence agreement. Contact [email protected] to enquire. The atb_zk_credential path has no additional licensing requirement beyond your standard AlgoVoi account.
Or, with a federation token (Commercial License):

Response

Error responses

GET /auth/token/status

Check current spend vs cap for a live session.

Request

No X-Tenant-Id required — the tenant is resolved from the JWT claims.

Response

Spend cap mechanics

The spend cap is enforced in-process on every payment route (/x402/verify, /mpp/{resource_id}, /a2a task completion). After each confirmed settlement, the gateway records the amount against the session’s jti.
  • Exceeded cap402 Payment Required with detail: "agent_spend_cap_exceeded". The payment is blocked before it reaches the facilitator.
  • Tenant volume caps (database-level) remain the hard enforcement floor regardless of session cap. Session caps are an additional advisory layer.
  • Single-instance note — the in-process spend store resets on gateway restart. For multi-instance deployments, the spend counter should be moved to Redis. On the current single-instance production deployment this is not a concern.

ATB discount

When a valid ATB ZKP cert is presented and ATB_DISCOUNT_ENABLED=true on the gateway, the effective payment amount is reduced by the discount factor (default 20%) at the resource price resolution step. The session token carries this discount forward automatically — no additional header is required on payment routes.

Using the session token

Once issued, the session token replaces the API key on all payment routes:
X-Tenant-Id is not required — it is resolved from the JWT sub claim.

Quick start

Python

TypeScript

Backwards compatibility

Existing API key authentication is fully unaffected. The gateway’s GatewayAuth dependency accepts both API keys and agent session tokens (union). No changes to existing integrations are required.

On-premise deployment

The full AlgoVoi payment stack is available as a self-hosted Docker Compose deployment. See the On-Premise guide for setup instructions. Agent session authentication — both the ATB ZKP cert path and the federation token path — is supported in the on-premise stack. The local gateway validates a Falcon-1024 signed licence token issued by the AlgoVoi main gateway on startup; no API calls back to AlgoVoi during normal operation. Contact us for enterprise deployment and commercial licensing enquiries.

See also