Markdown2PDF.ai
Category: Document Generation
Convert markdown to a professionally formatted PDF with a single API call. No account or API key required — payments are handled via the L402 protocol over Lightning Network.
Base URL
https://api.markdown2pdf.ai
Endpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /markdown | Submit markdown for conversion |
| POST | /payment-request | Get Lightning invoice after 402 response |
| GET | /job/{job_id}/status | Poll for completion |
| GET | /job/{job_id}/output | Get PDF download URL |
Request Format
POST /markdown
{
"data": {
"text_body": "# My Document
Content here...",
"meta": {
"title": "My Document",
"date": "2025-01-01"
}
},
"options": {
"document_name": "output.pdf"
}
}
Payment Flow (L402 / Lightning)
- POST to
/markdown— receiveHTTP 402with apayment_context_tokenandpayment_request_url. - POST to the
payment_request_urlwith the offer ID and context token. - Receive a BOLT11 Lightning invoice (
payment_request). - Pay the invoice.
- Retry the original POST to
/markdown. - Receive a
200response with apathpointing to the job status endpoint.
Polling for Completion
GET /job/{job_id}/status → { "status": "Done", "path": "/job/{job_id}/output" }
GET /job/{job_id}/output → PDF download URL
Poll every ~3 seconds; expect completion within 30 seconds.
Full API reference: markdown2pdf.ai/api-reference/overview
