API Documentation
Integrate To-Markdown's powerful conversion capabilities into your applications with our REST API.
Authentication
To use the API, you'll need an API key. Include it in the Authorization header of your requests:
Authorization: Bearer YOUR_API_KEY
To get an API key, please contact our support team.
Rate Limits
- Free tier: 10 requests per hour
- Pro tier: 100 requests per hour
- Enterprise tier: Custom limits
Endpoints
Convert Document
Convert a document to Markdown format.
POST /api/v1/convert
Parameters
Name | Type | Description |
---|---|---|
file | File | The document to convert |
options | Object | Optional conversion settings |
Error Handling
The API uses conventional HTTP response codes to indicate the success or failure of an API request:
- 200: Success
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 429: Too Many Requests
- 500: Internal Server Error
Examples
cURL
curl -X POST https://api.to-markdown.com/v1/convert \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "[email protected]"
Python
import requests
url = 'https://api.to-markdown.com/v1/convert'
headers = {'Authorization': 'Bearer YOUR_API_KEY'}
files = {'file': open('document.pdf', 'rb')}
response = requests.post(url, headers=headers, files=files)
markdown = response.json()['markdown']
JavaScript
const formData = new FormData();
formData.append('file', file);
const response = await fetch('https://api.to-markdown.com/v1/convert', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
body: formData
});
const data = await response.json();
const markdown = data.markdown;