Top up credits (x402, USDC on Base)
Buy credits for the API key’s account, paid in USDC on Base mainnet over the x402 v2 protocol. Without a payment the call returns 402 with a PAYMENT-REQUIRED header carrying the exact-scheme terms (amount = credits × $0.05); an x402 client signs an EIP-3009 transferWithAuthorization (gasless for the payer) and retries with a PAYMENT-SIGNATURE header. Credits are granted only after on-chain settlement, exactly once per payment authorization — retrying a settled payment replays the original result instead of double-crediting. The payer must be a plain EOA holding USDC on Base.
Authorizations
Your Chance API key (chance_sk_…), created in the dashboard.
Query Parameters
How many credits to buy (1 credit = $0.05). Default bounds: 20–10000.
20 <= x <= 10000Public account code (chance_topup_…) naming the account to credit. Use this instead of an x-api-key header when paying on someone else's behalf; the code can only add credits.
Response
Payment settled and credits granted. The PAYMENT-RESPONSE header carries the x402 settlement (tx hash, payer, network).
Credits added by this payment.
200
"10.00"
New balance.
203
Base settlement transaction hash.
Wallet that paid (recovered from the signature).
True when this response replays an already-credited payment (idempotent retry).
