The x402 protocol facilitates autonomous machine-to-machine value exchange without the need for pre-negotiated API keys or session management. It uses the HTTP 402 status code as a native flow control mechanism, enabling agents to discover payment requirements at runtime.
| Field | Type | Description |
|---|---|---|
| X-PAYMENT | Base64 | EIP-712 signed transferWithAuthorization payload. Required on all POST /api/crawl requests. |
| X-PAYMENT-RESPONSE | Base64 | Returned by server after successful payment verification. Contains transaction hash and settlement details. |
| scheme | String | Payment scheme in 402 body. Currently exact for fixed USDC amounts. |
| maxAmountRequired | String | Amount in atomic units (6 decimals). 100000 = $0.10 USDC on Base Sepolia. |
| payTo | Address | Settlement wallet address. Receives USDC via transferWithAuthorization on Base Sepolia. |
| Code | Identity | Cause |
|---|---|---|
| 402 | PAYMENT_REQUIRED | No X-PAYMENT header or payment verification failed. Returns x402 discovery body with accepts[]. |
| 202 | JOB_ACCEPTED | Payment verified. Returns jobId, pollUrl, and initial status: queued. |
| 404 | JOB_NOT_FOUND | Expected during 30-60s after POST due to D1 eventual consistency. Retry with exponential backoff. |
| 409 | ALREADY_TERMINAL | DELETE called on a job already in completed, failed, or cancelled state. |