PDF to Markdown API

Overview

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:

  • Document conversion projects
  • Knowledge base creation
  • Documentation systems
  • Research paper analysis
  • Content migration

API Usage

Endpoints

Endpoint Description
POST /v1/pdf2md Upload a PDF file for conversion
GET /v1/pdf2md/{jobId} Check the status of a conversion job

Upload PDF

POST https://api.2markdown.com/v1/pdf2md

Headers

Header Value Description
X-Api-Key YOUR_API_KEY Your API key for authentication
Content-Type multipart/form-data Required for file uploads

Request Body

Send as multipart/form-data with the following fields:

Field Type Description
file File The PDF file to convert (max 100MB)

Response

{
  "jobId": "550e8400-e29b-41d4-a716-446655440000",
  "status": "pending",
  "pages": 5
}

Check Job Status

GET https://api.2markdown.com/v1/pdf2md/{jobId}

Headers

Header Value Description
X-Api-Key YOUR_API_KEY Your API key for authentication

Response (Processing)

{
  "status": "processing",
  "progress": 45,
  "pages": 5
}

Response (Completed)

{
  "status": "completed",
  "progress": 100,
  "pages": 5,
  "result": "# PDF Document Title\n\nThis is the content of the PDF converted to Markdown..."
}

Response (Failed)

{
  "status": "failed",
  "error": "Error message describing the failure"
}

Example

# 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.

Error Codes

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