Documentation Menu
POST/v1/billing/tickets

Session Tickets

Pre-purchase large batches of API requests (10-10,000) using a single L2 blockchain transaction. Completely bypass repetitive gas fees and latency for subsequent high-frequency agent actions.

Authentication

Minting a Session Ticket inherently requires cryptographic payment proof. You MUST submit a valid x402 Header with a Base USDC transaction hash.

Request

curl Example

curl
curl -X POST https://api.agentinternetruntime.com/v1/billing/tickets \
  -H "X-Payment: <base64-encoded-payment-payload>" \
  -H "Content-Type: application/json" \
  -d '{
    "intent": "query_sdk_capabilities",
    "quantity": 100
  }'

Request Body

FieldTypeRequiredDescription
intentstringYesThe public ticket intent to prepay. Recommended public intents today are 'query_sdk_capabilities', 'execute_sdk_macro', and 'query_agentjson'. Legacy intents still exist in the backend but are intentionally omitted from these docs.
quantityintegerYesNumber of requests included. Must be between 10 and 10,000.

Response

200 OK
{
  "success": true,
  "ticket": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "ticket_id": "84f9q11c-dbb6-4ef1-a8...",
  "intent": "query_sdk_capabilities",
  "quota": 100,
  "expires_at": "2027-03-20T22:00:00Z",
  "message": "Session ticket purchased successfully. Pass this JWT in the Authorization header as 'Ticket <jwt>'."
}

Response Schema

FieldTypeDescription
successbooleanWhether the ticket blockchain creation was successful.
ticketstringThe signed JWT. Pass this exactly in future Auth headers as 'Authorization: Ticket <jwt>'.
ticket_idstringInternal ID of the session ticket.
intentstringThe capability routing string this ticket grants access to.
quotaintegerThe full batch quantity purchased in the L2 transaction.
expires_atstring7-day rolling expiration timestamp.

Error Codes

StatusReasonDescription
400Bad RequestMissing intent, or quantity falls outside the 10-10,000 limit.
402Payment RequiredThe Base L2 USDC transaction failed verification or payment headers missing.
409ConflictDouble spend error - the transaction hash has already been claimed.