File Conversion

Convert single files to AI-ready Markdown format

POST /api/v1/convertPOST

Overview

The file conversion endpoint allows you to convert a single document to AI-ready Markdown format. It supports form data uploads (recommended), Base64-encoded file content, and URL-based conversion, making it flexible for various integration scenarios.

✓ Supported Input Methods

  • • Form data upload (recommended)
  • • Base64-encoded file content
  • • Direct URL to downloadable file

⚡ Key Features

  • • AI-optimized Markdown output
  • • OCR for image-based content
  • • Structured data extraction

Request Format

Form Data Upload

Recommended
cURL Command
curl -X POST https://api.markdownconverters.com/api/v1/convert \
 -H "X-API-Key: your_api_key_here" \
 -F "file=@document.pdf" \
 -F 'options={"ocr_type": "basic"}'

Base64 File Upload

JSON Request Body
{
 "source_type": "file",
 "file": "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPD4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQovQ29udGVudHMgNCAwIFIKPj4KZW5kb2JqCjQgMCBvYmoKPDwKL0xlbmd0aCAvRmlsdGVyIC9GbGF0ZURlY29kZQo+PgpzdHJlYW0KeAErVAhUKFQwULCyUsrPTSxTMFOw0lEoSCwGwvTk4lLFMo0FiQWJyQAA//8AAP//AwAKrQc0CmVuZHN0cmVhbQplbmRvYmoKNSAwIG9iago8PAovVHlwZSAvRm9udAovU3VidHlwZSAvVHlwZTEKL0Jhc2VGb250IC9IZWx2ZXRpY2EKPj4KZW5kb2JqCnhyZWYKMCA2CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAwOSAwMDAwMCBuIAowMDAwMDAwMDU4IDAwMDAwIG4gCjAwMDAwMDAxMTUgMDAwMDAgbiAKMDAwMDAwMDIwNCAwMDAwMCBuIAowMDAwMDAwMzEwIDAwMDAwIG4gCnRyYWlsZXIKPDwKL1NpemUgNgovUm9vdCAxIDAgUko+PgpzdGFydHhyZWYKNDA5CiUlRU9G",
 "options": {
 "ocr_type": "basic"
 }
}
cURL Command
curl -X POST https://api.markdownconverters.com/api/v1/convert \
 -H "X-API-Key: your_api_key_here" \
 -H "Content-Type: application/json" \
 -d '{
 "source_type": "file",
 "file": "base64_encoded_file_content",
 "options": {
 "ocr_type": "basic"
 }
 }'

URL-based Conversion

JSON Request Body
{
 "source_type": "url",
 "url": "https://example.com/document.pdf",
 "options": {
 "ocr_type": "advanced"
 }
}

Request Parameters

ParameterTypeRequiredDescription
source_typestringYesEither "file" or "url"
filestringConditionalBase64-encoded file content (required if source_type is "file")
urlstringConditionalURL to downloadable file (required if source_type is "url")
optionsobjectNoConversion options (see below)

Options Object

OptionTypeDefaultDescription
ocr_typestring"basic""basic" or "advanced" OCR processing
preserve_formattingbooleantrueMaintain original document formatting
output_formatstring"markdown"Output format (currently only "markdown")

Response Format

Successful Response (200 OK)
{
 "job_id": "conv_1234567890abcdef",
 "status": "completed",
 "markdown_content": "# Sample Document\n\nThis is the extracted text from your PDF document.\n\n## Section 1\n\nContent from the first section with **bold** and *italic* formatting preserved.\n\n- List item 1\n- List item 2\n- List item 3\n\n## Section 2\n\nAdditional content with proper heading structure for AI processing.",
 "metadata": {
 "source_type": "file",
 "file_size": 2048,
 "pages": 1,
 "processing_time_ms": 1250,
 "ocr_confidence": 0.98
 },
 "sas_url": "https://storage.azure.com/converted/conv_1234567890abcdef.md?sp=r&st=2024-01-01T00:00:00Z&se=2024-01-02T00:00:00Z&spr=https&sv=2022-11-02&sr=b&sig=...",
 "created_at": "2024-01-01T12:00:00Z",
 "expires_at": "2024-01-02T12:00:00Z"
}
FieldTypeDescription
job_idstringUnique identifier for this conversion job
statusstringJob status: "completed", "processing", or "failed"
markdown_contentstringExtracted content in Markdown format
metadataobjectProcessing metadata and statistics
sas_urlstringTemporary download URL for the converted file

Error Handling

Error Response (400 Bad Request)
{
 "error": "invalid_file_format",
 "message": "The provided file format is not supported",
 "details": {
 "field": "file",
 "code": "UNSUPPORTED_FORMAT",
 "suggestion": "Please use one of the supported formats: PDF, Word, Excel, PowerPoint, HTML, or images"
 },
 "request_id": "req_1234567890abcdef"
}

Common Errors

  • • 400: Invalid request format
  • • 401: Invalid API key
  • • 413: File too large (max 100MB for Starter, 1GB for Pro)
  • • 422: Unsupported file format
  • • 429: Rate limit exceeded

Success Codes

  • • 200: Conversion completed
  • • 202: Processing started (async)