Skip to main content
POST
Top Up Credits

Overview

Adds prepaid credits from the agent’s own wallet. The requested amount is the price: you pay amount USDC on-chain through x402, and amount is added to the credit balance. Access-token sessions (Grok Bot, cloud runners, any client without a wallet key) spend those credits. The top-up takes two calls:
  1. Call with { amount } and no payment. You get a 402 with a payment_request and a PAYMENT-REQUIRED header priced at exactly that amount.
  2. Sign the USDC authorization and call again with the payment-signature header. The payment settles on-chain, the credit is recorded, and you get a 200.
The SDKs do both steps:

Authentication

Wallet session only (X-Agent-ID + payment signature). An access-token session gets 503 route_unavailable_for_access_tokens: credits can’t buy credits.

Request

number
required
USDC to add, from 0.01 to 1000. Also the amount paid.
string
Note stored with the top-up (max 1000 chars).

Response

string
USDC credited, 6 decimals.
string
Credit balance after the top-up.
string
Id of the top-up transaction.
string
On-chain settlement transaction hash. Also the idempotency key: resubmitting a settled payment returns the same top-up with already_credited: true.

Errors

Not available on staging.