Top up credits with an x402 payment (agent-native)

Adds a fixed amount of Treza credit per call, paid via the x402 protocol (HTTP 402): call without payment to receive a 402 challenge carrying the price and networks, sign the payment with an x402-capable wallet, and retry with the payment-signature header. The challenge lists two ways to pay the same amount: USDC on Base (eip155:8453) first, then USDC on Solana mainnet (solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp); a client pays the first one it has a wallet for, and neither needs gas money in the paying wallet. Grants are idempotent per settled transaction. A bearer (API key, OAuth token, or session) is optional and only chooses which account is credited; without one the credits are keyed to the paying wallet, so an agent holding nothing but a wallet can still fund itself. A Base wallet and a Solana wallet are separate accounts, and their balances are not shared. Only available when the deployment has x402 enabled; the balance endpoint's x402 field says so.

post/api/billing/credits/x402

Request

  • Base URL: https://www.trezalabs.com
  • URL: https://www.trezalabs.com/api/billing/credits/x402
  • Auth: HTTP bearer

Response

Credits granted

grantedUsdnumber
duplicateboolean

True when this payment was already credited (idempotent replay).

balanceUsdnumber
networkstring

Where the payment settled: eip155:8453 (Base) or solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp (Solana).

Changes

No recorded changes to this operation across all 1 revision of this API.