Authorization
Updated:
The x402 API has no accounts, passwords or API keys. Three kinds of proof are used instead: the payment signature, the access token of the order and the wallet signature.
Do not give your access tokens to third parties and never send the private key of your wallet to anyone, including us.
Key features
Payment signature
The wallet that signs the payment is the buyer. The first successful payment creates a wallet account automatically, there is nothing to register. Renewals and residential traffic of an order can be paid only from the wallet that paid the order.
Access token
Every paid order returns an access_token once, in the 202 response. Send it in the Authorization header with every request about this order: status and credentials, renewal, traffic, settings, IP replacement and events.
Wallet signature
To get new tokens for your orders or to withdraw your balance, sign a one-time text message (EIP-4361) with the same wallet. Signing does not move funds.
Access tokens
Authorization: Bearer x402_q8Zt3Lw0mN6pR2vY9cK4hJ7sD1fG5bX8aE3uW0iO2nTProperty | Value |
|---|---|
Format |
|
Where | Only in the |
Scope | One order: |
Issued | Once per operation, in the |
Lifetime | Until the expiry date of the order plus 90 days; renewals extend it. For an operation without an expiry date, 90 days after its final status |
Revocation | Blocking of the wallet, |
New tokens do not revoke old ones: every valid token of an order keeps working.
Errors
Response | When |
|---|---|
| The |
| Any other problem: the order does not exist, the token belongs to another order, the token is revoked or expired. The API does not tell these cases apart |
Example
401: Unauthorized
{
"error": "unauthorized",
"message": "Authorization is required",
"retryable": false,
"retry_action": "abandon",
"detail": "Authorization: Bearer <access_token> from the order response is required"
}Lost token
If the token is lost, recover access with your wallet: Recover access. The response lists all orders of the wallet with new tokens.