POST /v1/convert
Convert a document synchronously. Returns the converted file as the response body on success.
POST
/v1/convert
Requires X-API-Key. Counts toward your monthly quota.
Request formats
Send either JSON (Content-Type: application/json) or multipart form data for file uploads.
JSON body
{
"input_format": "markdown",
"output_format": "pdf",
"content": "# Title\n\nBody text.",
"options": {
"theme": "default",
"page_size": "A4",
"margins": "normal",
"filename": "report"
}
}
Binary inputs (DOCX, PDF)
For docx or pdf input, send base64-encoded bytes:
{
"input_format": "docx",
"output_format": "pdf",
"content": "UEsDBBQAAAAI...",
"content_encoding": "base64"
}
URL to PDF
Use input_format: "url" and pass the URL in the url field (not content):
{
"input_format": "url",
"output_format": "pdf",
"url": "https://example.com/article",
"options": {
"mode": "visual",
"timeoutMs": 30000
}
}
Multipart upload
Upload a single file with form fields:
file— the source documentinput_format— e.g.docxoutput_format— e.g.pdfoptions— optional JSON string
curl -X POST https://api-production-7d714.up.railway.app/v1/convert \
-H "X-API-Key: dc_live_YOUR_KEY" \
-F "file=@document.docx" \
-F "input_format=docx" \
-F "output_format=pdf" \
--output document.pdf
Successful response
On success the API returns raw file bytes (not JSON):
Content-Type— e.g.application/pdfContent-Disposition—attachment; filename="..."- Body — binary file content
Fields reference
| Field | Required | Description |
|---|---|---|
input_format | Yes | markdown, html, docx, pdf, or url |
output_format | Yes | markdown, html, pdf, or docx |
content | Yes* | Text or base64 for most formats (*use url for URL input) |
url | URL only | Public HTTP(S) URL when input_format is url |
content_encoding | No | base64 for binary docx/pdf in JSON |
options | No | Conversion options — see Formats & options |
Size limit: Synchronous conversions are limited to 1 MB of input content. Larger payloads return
400 FILE_TOO_LARGE.
Examples
HTML to Markdown
curl -X POST https://api-production-7d714.up.railway.app/v1/convert \
-H "Content-Type: application/json" \
-H "X-API-Key: dc_live_YOUR_KEY" \
-d '{"input_format":"html","output_format":"markdown","content":"<h1>Hi</h1><p>Text</p>"}'
URL to PDF (article text mode)
curl -X POST https://api-production-7d714.up.railway.app/v1/convert \
-H "Content-Type: application/json" \
-H "X-API-Key: dc_live_YOUR_KEY" \
-d '{"input_format":"url","output_format":"pdf","url":"https://example.com/blog/post","options":{"mode":"text"}}' \
--output article.pdf