For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Logo
DocumentationAPI ReferenceChangelog
DocumentationAPI ReferenceChangelog
  • Get Started
    • Introduction
    • Authentication
    • Rate Limits
    • Pricing
  • Integration
    • MCP Server
    • SDKs
    • OpenAI Compatibility
    • MCP Docs Server
    • llms.txt
    • x402
  • Guides
    • Research Parameters
    • Research Chat
    • Brainstorming
    • Model Selection
    • Prompt Guidance
    • Versioning
  • Reference
    • Errors
    • Pagination
On this page
  • How the flow works
  • Requesting research with x402
  • Using the scoped API key
  • Troubleshooting
  • Additional resources
Integration

x402 Payments

Built with

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

  1. Prepare an x402 payment payload using your wallet or facilitator client (see the x402 quickstart for language-specific helpers).
  2. POST to /x402/research with the payment payload and your research request.
  3. Receive a response containing the research job ID, status, and a temporary api_key_secret.
  4. Use the returned API key as a Bearer token to call standard Caesar endpoints (e.g., GET /research/{id} or GET /research/{id}/results/{resultId}/content).
  5. 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

POST
/x402/research
1curl -X POST https://api.caesar.xyz/x402/research \
2 -H "X-PAYMENT: X-PAYMENT" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "query": "What are the latest advancements in renewable energy technologies?"
6}'
Try it

The endpoint accepts the same body as POST /research. The key difference is the required X-PAYMENT header:

1POST /x402/research HTTP/1.1
2Host: api.caesar.xyz
3Content-Type: application/json
4X-PAYMENT: {{base64-encoded x402 payload}}
5
6{
7 "query": "Summarise the latest trends in agentic tooling for autonomous research",
8 "compute_units": 2,
9 "system_prompt": "Return a concise executive summary with bullet-point recommendations."
10}

The service verifies the payment, settles it, enqueues the ask, and returns the temporary key:

1{
2 "id": "f2f6e5db-2c7d-4f56-bb0c-5a6b6a7a9b10",
3 "status": "queued",
4 "api_key_secret": "sk-temp-x402-demo-secret"
5}

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.

$curl "https://api.caesar.xyz/research/f2f6e5db-2c7d-4f56-bb0c-5a6b6a7a9b10" \
> -H "Authorization: Bearer sk-temp-x402-demo-secret"

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

x402 protocol docs

Deep dive into payment payloads, facilitator configuration, and supported chains.

Caesar API reference

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.