API Reference

Documentation

Simple, predictable API for extracting markdown from any URL.

POST/extract

Extract markdown content from a URL

Request Body

JSON
{
  "url": "https://example.com/article"
}
urlThe URL to extract content from. Must be HTTP or HTTPS.

Success Response (200)

JSON
{
  "success": true,
  "version": "1.0.0",
  "extractionPolicyVersion": "2026-02-13.v1",
  "url": "https://example.com/article",
  "canonicalUrl": "https://example.com/article",
  "title": "Article Title",
  "markdown": "# Article Title\n\nContent here...",
  "contentHash": "a1b2c3d4e5f6...",
  "extractedAt": "2025-02-13T10:00:00Z",
  "diagnostics": {
    "strictMode": true,
    "contentType": "text/html",
    "contentLength": 4523,
    "redirectCount": 0
  }
}

Response Fields

FieldTypeDescription
successbooleanWhether extraction succeeded
versionstringAPI version
urlstringOriginal requested URL
canonicalUrlstringCanonical URL from page metadata
titlestringPage title (from <title> or <h1>)
markdownstringExtracted content as markdown
contentHashstringSHA-256 hash of markdown (for deduplication)
extractedAtstringISO 8601 timestamp
diagnosticsobjectExtraction metadata

Error Codes

CodeStatusDescription
invalid_url400URL is missing, malformed, or uses an unsupported protocol
blocked_url400URL points to a blocked hostname (localhost, private IP, internal domain)
fetch_failed400Failed to fetch the URL (network error or upstream HTTP error status)
too_many_redirects400Redirect chain exceeded maximum allowed redirects
timeout400Request exceeded the 30-second timeout limit
too_large400Response body exceeded the 10MB size limit
unsupported_content_type400Content-Type is not HTML, markdown, or plain text
empty_content400Response body was empty after filtering
unauthorized401Missing or invalid API key when key auth is enabled
rate_limited429Request quota exceeded for current key and window
idempotency_conflict409Idempotency key reused with a different URL
invalid_request400Request body is invalid JSON
internal_error500Unhandled server error
unsupported_api_version400Requested API version is not supported

Error Response Format

400 Bad Request
{
  "success": false,
  "code": "invalid_url",
  "message": "URL is required and must be a string",
  "requestId": "7f1c9f34-3b56-4a3a-9d65-1bb09a9fc431"
}

Limits & Guardrails

Request timeout30 seconds
Max response size10 MB
Max redirects5
Rate limit (Free)100 requests/hour
Rate limit (Paid)Based on plan

OpenAPI Specification

Download the complete machine-readable OpenAPI 3.0 specification for programmatic integration.

Examples

cURL

bash
curl -X POST https://api.markdownforagents.com/extract \
  -H "x-api-key: YOUR_KEY" \
  -H "Idempotency-Key: req-123" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/article"}'

JavaScript

javascript
const response = await fetch('https://api.markdownforagents.com/extract', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_KEY',
    'Idempotency-Key': 'req-123'
  },
  body: JSON.stringify({ url: 'https://example.com/article' })
});

const data = await response.json();
if (data.success) {
  console.log(data.markdown);
  console.log('Content hash:', data.contentHash);
}

Try it yourself

Test the API with our interactive demo.

Open Demo