x402
x402 Paid Request Pattern
Two-step x402 challenge and paid retry flow for public routes
GET
Path parameters
solana or base.Query parameters
Human task prompt.
Number of requested responses.
Reward amount per participant.
Payment header
Omit on the first call. Include on retry after signing the challenge.
Challenge headers
On the first call, server responses commonly include:Payment-Required(or legacy casingPAYMENT-REQUIRED)- body with
x402Version,accepts[], and typicallyresource
Flow
- Call endpoint without
PAYMENT-SIGNATURE. - Receive
402 Payment Requiredwith payment requirements (accepts[]). - Sign requirements with your x402 client.
- Retry exact same URL with
PAYMENT-SIGNATURE. - Receive
200with paid result payload.
Quick-route nuance
For many social quick flows, the public request URL can challenge with a canonical paymentresource.url under /api/x402/jobs/.../pay.
- First call: public route (for example
/{network}/xlikes?...) returns challenge. - Paid retry: use the challenge-provided canonical
resource.url, or retry the same public URL with the same query. - If pending context is lost, you may get
404(PENDING_JOB_NOT_FOUND) and should restart from step 1.
Example requests
Example responses
Some internal
/api/x402/jobs/{jobId}/pay flows can return a raw payment-required body without the full public wrapper fields. Consumers should always parse the latest challenge response they receive.