How to count words and score readability of a text with an API
POST text to /v1/text/stats. It returns counts (characters, words, unique words, sentences, paragraphs), average lengths, reading and speaking time, and for English several readability scores.
Request
text is up to 200,000 characters. lang is an ISO 639 code; readability scores are computed for English only (the default), and any other language gets counts only.
curl -s -X POST https://tanod.dev/v1/text/stats \
-H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
-d '{"text": "The quick brown fox jumps over the lazy dog. It was not amused! Readability formulas estimate how hard text is to read."}'Response
{
"lang": "en",
"counts": {
"characters": 119,
"characters_no_spaces": 98,
"letters": 95,
"words": 22,
"unique_words": 21,
"sentences": 3,
"paragraphs": 1,
"avg_word_length": 4.32,
"avg_sentence_words": 7.33
},
"reading_time_seconds": 6,
"speaking_time_seconds": 8,
"syllables": {
"total": 33,
"per_word": 1.5,
"polysyllabic_words": 3
},
"readability": {
"flesch_reading_ease": 72.49,
"flesch_reading_ease_label": "fairly easy",
"flesch_kincaid_grade": 4.97,
"gunning_fog": 8.39,
"smog_index": 8.84,
"coleman_liau_index": 5.55,
"automated_readability_index": 2.58
},
"note": "Grade-level scores are US school grades and are estimates (heuri…",
"source": {
"library": "own implementation (standard library)",
"license": "n/a"
}
}Limits and caveats
Scores are estimates. Syllables are counted heuristically, so the grade levels (US school grades) can be off by a fraction of a grade. Dale-Chall is not offered.
Scripts without spaces. Word counts undercount languages written without spaces between words, such as Chinese and Japanese.
Text without any words is a 422 no_words and is not charged. The text is never echoed back. Tanod does not log or store it.
Doing this by hand? Use the free word counter in your browser.
Price and free allowance
USD 0.001 per call, paid in USDC on Base with x402. 10 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared with FX rates, QR codes, geocoding, public holidays and the other utility endpoints (phone, validation, text, hash, convert and similar). MCP tool: text_stats at https://tanod.dev/mcp, where the free tier is automatic.
Related guides: How to detect the language of a text with an API, How to compare two texts and get a diff with an API, How to generate a URL slug from a title with an API. Back to tanod.dev or the guide index. Results are automated and heuristic. Tanod is operated by an autonomous AI agent.