Reference

Markdown to PDF

This endpoint accepts Markdown and a small set of rendering options, then delivers the finished PDF through the shared DocuShell jobs API.

Reference
View as Markdown

Reference

Endpoint Reference

POST/v1/markdown-to-pdf

Queue a Markdown render job and download the finished PDF through the shared jobs API.

Auth

Bearer token required.

Idempotency

Supports optional Idempotency-Key replay protection.

Content Type

application/json

Headers

NameTypeRequiredLocationDescription
AuthorizationBearer <API_KEY>YesheaderUser-owned API key created in the DocuShell dashboard.
Idempotency-KeystringNoheaderRecommended for safely retrying submit requests without creating duplicate jobs.
Content-Typeapplication/jsonYesheaderJSON body with Markdown content.

Request Fields

NameTypeRequiredLocationDescription
markdownstringYesbodyMarkdown source. The public lane enforces a 2 MB request body limit.
file_namestringNobodyOptional source name used to derive the output filename.
page_sizeA4 | Letter | LegalNobodyTarget print size for the generated PDF.Default: A4

First request

bash

curl -X POST "https://api.docushell.com/api/v1/markdown-to-pdf" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: quickstart-001" \
  -d '{
    "markdown": "# DocuShell\n\nRendered through the public API.",
    "file_name": "quickstart.md",
    "page_size": "A4"
  }'

Try It Now

Console placeholder for safe sandbox execution.

Coming soon

Queued response

json

{
  "job_id": "job_01JX8Y5YJ2M2D8N1AQ5F7Q3KVT",
  "status": "queued",
  "cost": 5,
  "service": "markdown-to-pdf",
  "request_id": "req_01JX8Y62XCDNZ2BM7TBM2M9Q8E",
  "links": {
    "status": "/v1/jobs/job_01JX8Y5YJ2M2D8N1AQ5F7Q3KVT",
    "download": "/v1/jobs/job_01JX8Y5YJ2M2D8N1AQ5F7Q3KVT/download"
  }
}

Status response

json

{
  "job_id": "job_01JX8Y5YJ2M2D8N1AQ5F7Q3KVT",
  "status": "done",
  "service": "markdown-to-pdf",
  "request_id": "req_01JX8Y62XCDNZ2BM7TBM2M9Q8E",
  "result": {
    "filename": "quarterly-report.pdf",
    "sizeBytes": 184322,
    "download": "/v1/jobs/job_01JX8Y5YJ2M2D8N1AQ5F7Q3KVT/download"
  },
  "completed_at": "2026-04-24T10:12:56.145Z",
  "links": {
    "status": "/v1/jobs/job_01JX8Y5YJ2M2D8N1AQ5F7Q3KVT",
    "download": "/v1/jobs/job_01JX8Y5YJ2M2D8N1AQ5F7Q3KVT/download"
  }
}
Completed jobs return a public download link and keep the file streaming URL behind the gateway. Downloads use application/pdf.

Poll And Download

  • Completed jobs stream one application/pdf file from GET /v1/jobs/:jobId/download.
  • See [Quickstart](/getting-started#queued-response) for the shared submit, poll, and download flow.

Failure Notes

  • Malformed JSON or missing markdown content returns invalid_request.
  • Bodies larger than 2 MB are rejected before a job is created.
  • backend_unavailable indicates the render service was unreachable before the queue handoff completed.

Oversized request body

400invalid_request

The Markdown payload or overall JSON request exceeds the configured 2 MB limit.

400 error

json

{
  "error": {
    "code": "invalid_request",
    "message": "Request body exceeds the 2 MB limit.",
    "type": "invalid_request_error",
    "request_id": "req_01JX8Y62XCDNZ2BM7TBM2M9Q8E"
  }
}