The PDF to Markdown API allows you to convert PDF documents into clean, structured Markdown with a simple API call. Our service extracts text, tables, and formatting from PDFs and transforms them into well-formatted Markdown.
Perfect for:
Endpoint | Description |
---|---|
POST /v1/pdf2md |
Upload a PDF file for conversion |
GET /v1/pdf2md/{jobId} |
Check the status of a conversion job |
POST https://api.2markdown.com/v1/pdf2md
Header | Value | Description |
---|---|---|
X-Api-Key | YOUR_API_KEY | Your API key for authentication |
Content-Type | multipart/form-data | Required for file uploads |
Send as multipart/form-data with the following fields:
Field | Type | Description |
---|---|---|
file | File | The PDF file to convert (max 100MB) |
{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"status": "pending",
"pages": 5
}
GET https://api.2markdown.com/v1/pdf2md/{jobId}
Header | Value | Description |
---|---|---|
X-Api-Key | YOUR_API_KEY | Your API key for authentication |
{
"status": "processing",
"progress": 45,
"pages": 5
}
{
"status": "completed",
"progress": 100,
"pages": 5,
"result": "# PDF Document Title\n\nThis is the content of the PDF converted to Markdown..."
}
{
"status": "failed",
"error": "Error message describing the failure"
}
# Upload PDF
curl -X POST "https://api.2markdown.com/v1/pdf2md" \
-H "X-Api-Key: YOUR_API_KEY" \
-F "[email protected]"
# Check status
curl -X GET "https://api.2markdown.com/v1/pdf2md/550e8400-e29b-41d4-a716-446655440000" \
-H "X-Api-Key: YOUR_API_KEY"
Note:
PDF conversion is an asynchronous process. You'll need to poll the job status endpoint until the job is completed or failed.
Status Code | Description |
---|---|
400 | Bad Request - Missing file or invalid parameters |
401 | Unauthorized - Invalid or missing API key |
402 | Payment Required - Insufficient credits |
404 | Not Found - Job ID not found |
413 | Payload Too Large - PDF file exceeds size limit |