Documentation Menu
POST
/v1/billing/ticketsSession 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
| Field | Type | Required | Description |
|---|---|---|---|
| intent | string | Yes | The 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. |
| quantity | integer | Yes | Number 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
| Field | Type | Description |
|---|---|---|
| success | boolean | Whether the ticket blockchain creation was successful. |
| ticket | string | The signed JWT. Pass this exactly in future Auth headers as 'Authorization: Ticket <jwt>'. |
| ticket_id | string | Internal ID of the session ticket. |
| intent | string | The capability routing string this ticket grants access to. |
| quota | integer | The full batch quantity purchased in the L2 transaction. |
| expires_at | string | 7-day rolling expiration timestamp. |
Error Codes
| Status | Reason | Description |
|---|---|---|
| 400 | Bad Request | Missing intent, or quantity falls outside the 10-10,000 limit. |
| 402 | Payment Required | The Base L2 USDC transaction failed verification or payment headers missing. |
| 409 | Conflict | Double spend error - the transaction hash has already been claimed. |