Learn how to integrate our powerful file-to-markdown conversion API into your applications.
All API requests require authentication using an API key. You can obtain your API key from the dashboard.
Authorization: Bearer YOUR_API_KEY
Upload a file (PDF, DOCX, JPG, PNG, etc.) to convert it directly to markdown format.
/api/files/upload
curl -X POST https://markdown-saas.onrender.com/api/files/upload \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "[email protected]"
{
"file_id": "unique-file-id-123",
"original_filename": "document.pdf",
"markdown_text": "# Document Title\n\nThis is the converted markdown content...",
"mime_type": "application/pdf",
"file_size": 123456,
"timestamp": "2023-10-27T10:30:00Z"
}
Submit a URL to fetch its content and convert it directly to markdown format.
/api/urls/upload
curl -X POST https://markdown-saas.onrender.com/api/urls/upload \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/article"}'
{
"url": "https://example.com/article",
"markdown_text": "# Article Title\n\nThis is the markdown content extracted from the URL...",
"timestamp": "2023-10-27T10:35:00Z"
}
Our API uses conventional HTTP response codes to indicate the success or failure of an API request.
{
"success": false,
"error": {
"code": "invalid_file_type",
"message": "The file type is not supported. Please upload a PDF, DOCX, JPG, or PNG file.",
"status": 400
}
}
Upload a PDF file and get the markdown content directly.
// 1. Upload the PDF file
const pdfFile = // Your PDF file object here
const form = new FormData();
form.append('file', pdfFile);
const response = await fetch('https://markdown-saas.onrender.com/api/files/upload', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
},
body: form
});
if (response.ok) {
const data = await response.json();
console.log('File ID:', data.file_id);
console.log('Markdown Content:', data.markdown_text);
} else {
console.error('Upload failed:', response.statusText);
}
Submit a URL and receive its content converted to markdown.
// 1. Send the URL
const targetUrl = 'https://example.com/blog/post';
const response = await fetch('https://markdown-saas.onrender.com/api/urls/upload', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ url: targetUrl })
});
if (response.ok) {
const data = await response.json();
console.log('Original URL:', data.url);
console.log('Markdown Content:', data.markdown_text);
} else {
console.error('URL processing failed:', response.statusText);
}