// rest api

API Reference

Integrate data2md in your workflow with a single HTTP POST. Streamed conversion via pdftotext, max 500 MB per request.

Endpoint

POST https://data2md.ae8.com.br/api

Content-Type: multipart/form-data

Request fields

FieldTypeRequiredDescription
filefileYesThe file to convert. Max 500 MB.
formatstringNoFile format. Default: pdf. Currently supported: pdf.

Success response 201 Created

{
  "success": true,
  "hash": "a3f9c12b84e7d01",
  "original_name": "report.pdf",
  "format": "pdf",
  "lines": 148,
  "characters": 9342,
  "download_url": "/download?hash=a3f9c12b84e7d01",
  "markdown": "# Report Title\n\n..."
}

Error response 4xx · 5xx

{
  "success": false,
  "message": "Validation failed.",
  "errors": ["File content does not match allowed types for this format."]
}

Rate limits

20 requests per minute per IP. Exceeding returns 429 Too Many Requests with a Retry-After: 60 header.

Examples

cURL

curl -X POST https://data2md.ae8.com.br/api \
  -F "file=@document.pdf" \
  -F "format=pdf"

PHP

// stream a file via cURL
$ch = curl_init('https://data2md.ae8.com.br/api');
curl_setopt_array($ch, [
    CURLOPT_POST           => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POSTFIELDS     => [
        'file'   => new CURLFile('document.pdf', 'application/pdf', 'document.pdf'),
        'format' => 'pdf',
    ],
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
echo $data['markdown'];

Python

import requests

with open('document.pdf', 'rb') as f:
    r = requests.post('https://data2md.ae8.com.br/api', files={'file': f}, data={'format': 'pdf'})

data = r.json()
print(data['markdown'])