/api/v1/reading-timeReading time API
WPM + image + code-aware estimate.
POST /api/v1/reading-time estimates reading time from words, images, and code lines independently — more honest than the standard 'words divided by 200' calculation. All multipliers are configurable.
Overview
Estimate reading time more honestly than 'words ÷ 200'. Prose runs at a configurable WPM (default 200); images add a fixed scan-time (default 12s); code lines add a fixed parse-time (default 2s). All three knobs are tunable.
Request
Authenticate with Authorization: Bearer YOUR_API_KEY and send a JSON body containing the parameters below. Pick your language:
curl -X POST 'https://trymarkdownviewer.com/api/v1/reading-time' \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"markdown":"# Hello\n\nA short paragraph."}'Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
| markdown | string | required | Markdown source. |
| wpm | number | optional | Words per minute. Default 200. |
| imageSeconds | number | optional | Seconds per image. Default 12. |
| codeLineSeconds | number | optional | Seconds per code line. Default 2. |
Response
Success responses are wrapped in a data field. Errors use { error: { code, message } } with an appropriate HTTP status — see the error reference.
{
"data": {
"words": 4,
"imageSeconds": 0,
"codeLines": 0,
"codeSeconds": 0,
"totalSeconds": 1,
"totalMinutes": 1,
"formatted": "1 sec read"
}
}Use cases
'X min read' chips
Render a reading-time chip alongside every article.
Related endpoints
Try in browser
Free tools that run the same logic locally — no API key, no upload.
Try it
Send a real request against your account in the API playground. Errors there link straight back to the error reference.