Rather than using the SDKs we provide, you can also use the REST API directly using regular HTTP requests. This is useful if you want to integrate the markdown to PDF conversion into your own applications or scripts without relying on a specific programming language SDK. The overall process is similar to using the SDKs, but you will need to handle the HTTP requests and responses yourself. TheDocumentation Index
Fetch the complete documentation index at: https://markdown2pdf.ai/llms.txt
Use this file to discover all available pages before exploring further.
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.
