POST /markdown endpoint accepts both L402 (Lightning) and X402 (USDC on Solana) payments — the 402 response advertises both offers and the client picks. Below is a step-by-step guide on how to use the REST API directly:
/markdown endpoint
Call the
markdown endpoint with your markdown content. If a payment is required, you receive a 402 whose body contains an offers[] array. Expect two entries: one with payment_methods: ["lightning"] (L402) and one with payment_methods: ["x402"]. The X-Accept-Payment response header advertises the same list. Pick whichever rail your agent has a wallet for.Pay — L402 (Lightning)
For the L402 offer, call
/payment_request with the payment_context_token and offer_id to fetch a BOLT11 Lightning invoice, pay it, then re-submit the same POST /markdown body.Pay — X402 (USDC on Solana)
For the X402 offer, read the native
accepts[] payload from offers[].metadata.x402 (or call /payment_request/x402). Sign an X-PAYMENT base64 header using any x402-aware signer, then re-POST /markdown with that header. The server verifies + settles via the facilitator and returns 200 with X-Payment-Response carrying the settlement proof./job/{job_id}/status endpoint
Call the
status endpoint repeatedly to check the status of your document generation job. It will return the current status and, once complete, provide a URL to download the generated PDF./job/{job_id}/output endpoint
Call the
output endpoint to retrieve the URL from which you can download the generated PDF once the job is complete.
