Documentation

Markdown SaaS API Documentation

Learn how to integrate our powerful file-to-markdown conversion API into your applications.

Authentication

All API requests require authentication using an API key. You can obtain your API key from the dashboard.

Authorization Header

Authorization: Bearer YOUR_API_KEY

Upload File

Upload a file (PDF, DOCX, JPG, PNG, etc.) to convert it directly to markdown format.

POST
/api/files/upload
curl -X POST https://markdown-saas.onrender.com/api/files/upload \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "[email protected]"

Response

{
  "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"
}

Upload URL

Submit a URL to fetch its content and convert it directly to markdown format.

POST
/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"}'

Response

{
  "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"
}

Error Handling

Our API uses conventional HTTP response codes to indicate the success or failure of an API request.

2xx - Success

  • 200 - OK: Request succeeded
  • 201 - Created: Resource created
  • 202 - Accepted: Processing in progress

4xx - Client Error

  • 400 - Bad Request: Invalid parameters
  • 401 - Unauthorized: Invalid API key
  • 404 - Not Found: Resource not found
  • 429 - Too Many Requests: Rate limit exceeded

Error Response Format

{
"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
}
}

Example Use Cases

1. Convert a Single PDF to Markdown

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);
}

2. Convert Webpage Content to Markdown

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);
}