Text Statistics API

Count words, characters, sentences, paragraphs and lines, estimate reading and speaking time, and list the most frequent words of a text.

POSThttps://apibox.io.vn/v1/text-stats

Send a text (JSON or form field, or raw text body) and get its statistics: characters (Unicode code points), characters_no_spaces, bytes_utf8, words, unique_words, sentences, paragraphs, lines and average_word_length. Words are counted with Unicode letters and digits, so Vietnamese and other non-English texts are handled correctly.

reading_time_seconds is based on wpm words per minute (default 230, range 50-1000) and speaking_time_seconds on 150 words per minute. top_words lists the most frequent words longer than 2 characters (case-insensitive); set top from 0 to 100 (default 10).

The text may contain up to 2,000,000 characters (request body up to 5 MB).

Parameters

NameInTypeRequiredDefault
textbodystringyesText to analyze (max 2,000,000 characters). Can also be sent as a raw text body.
wpmbody|querynumberno230Reading speed in words per minute (50-1000).
topbody|querynumberno10Number of most frequent words to return (0-100).

Example

curl -X POST "https://apibox.io.vn/v1/text-stats" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"APIBox offers small developer APIs. They run on Cloudflare Workers!\n\nEach API is fast and simple. APIs are easy to use.","top":5}'

Response

{
  "characters": 119,
  "characters_no_spaces": 98,
  "bytes_utf8": 119,
  "words": 21,
  "unique_words": 20,
  "sentences": 4,
  "paragraphs": 2,
  "lines": 3,
  "reading_time_seconds": 6,
  "speaking_time_seconds": 9,
  "average_word_length": 4.48,
  "top_words": [
    {
      "word": "apis",
      "count": 2
    },
    {
      "word": "apibox",
      "count": 1
    },
    {
      "word": "offers",
      "count": 1
    },
    {
      "word": "small",
      "count": 1
    },
    {
      "word": "developer",
      "count": 1
    }
  ]
}

Use cases

  • Show word count and reading time on blog posts
  • Check length limits of essays, descriptions or SMS
  • Find the most used keywords of an article for SEO
  • Estimate the duration of a speech or video script

FAQ

How is reading time calculated?

Words divided by the reading speed, 230 words per minute by default, rounded up to seconds. Change it with wpm.

Does it count Vietnamese words correctly?

Yes. Words are sequences of Unicode letters and digits, so accented characters are part of the word.

Are stop words excluded from top words?

Only words of 1 or 2 characters are excluded; there is no stop-word list, so frequent words like "the" may appear.

Related APIs

Start with 1,000 free requests every month. Get free API key →