Apr 15, 2026

Markdown2PDF.ai

Convert markdown to a professionally formatted PDF via a simple REST API. No account or API key required — access is gated by L402 Lightning payments, making it ideal for agents that need to generate documents on the fly. Full API reference: https://markdown2pdf.ai/api-reference/overview

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

MethodPathPurpose
POST/markdownSubmit markdown for conversion
POST/payment-requestGet Lightning invoice after 402 response
GET/job/{job_id}/statusPoll for completion
GET/job/{job_id}/outputGet 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)

  1. POST to /markdown — receive HTTP 402 with a payment_context_token and payment_request_url.
  2. POST to the payment_request_url with the offer ID and context token.
  3. Receive a BOLT11 Lightning invoice (payment_request).
  4. Pay the invoice.
  5. Retry the original POST to /markdown.
  6. Receive a 200 response with a path pointing 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