x402 Payments
Caesar supports x402 so you can pay for research jobs per request without pre-provisioning an API key. The /x402/research endpoint verifies an x402 payment, creates a scoped API key that only works for the resulting ask, and returns that secret in the response. You can then call any standard Caesar endpoint with that key to retrieve results or fetch content.
x402 is fully self-serve: you provide a signed payment payload in the X-PAYMENT header, Caesar verifies/settles it with the facilitator, and you instantly receive a temporary key for that ask.
How the flow works
- Prepare an x402 payment payload using your wallet or facilitator client (see the x402 quickstart for language-specific helpers).
- POST to
/x402/researchwith the payment payload and your research request. - Receive a response containing the research job ID, status, and a temporary
api_key_secret. - Use the returned API key as a Bearer token to call standard Caesar endpoints (e.g.,
GET /research/{id}orGET /research/{id}/results/{resultId}/content). - Once the research completes, revoke the key (it is already scoped to the single ask and expires automatically after settlement).
The api_key_secret returned from /x402/research is the only time the secret is shown. Store it securely if you need to poll for results.
Requesting research with x402
The endpoint accepts the same body as POST /research. The key difference is the required X-PAYMENT header:
The service verifies the payment, settles it, enqueues the ask, and returns the temporary key:
Using the scoped API key
Treat the returned api_key_secret exactly like a normal Caesar API key, but remember it is scoped to a single ask. Any request that references the original ask ID will succeed; other operations will be rejected.
Troubleshooting
402 Payment required
Ensure the X-PAYMENT header is present and correctly base64-encoded. The payload must match the price quoted by the endpoint; out-of-date or reused payloads are rejected.
401 Unauthorized after using the secret
The secret only authorizes access to the ask it created. Verify you are calling endpoints with the same ask ID returned by /x402/research.
Need higher compute budget
Increase compute_units in the request body. The x402 charge scales with the units you specify.
Additional resources
Deep dive into payment payloads, facilitator configuration, and supported chains.
View the OpenAPI definition for /x402/research, including request/response schemas.
Looking for a higher-level walkthrough? The Firecrawl x402 documentation is a great companion piece that illustrates similar flows.