
Text Analytics API
Content
Analyze text for detailed statistics including word count, character analysis, top letters, vowel counts, and frequency analysis.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
120 requests per minute
Endpoints
1 endpoint available
Overview
Count what is in a block of text: words, characters (with and without whitespace), letters, vowels, consonants, sentences and paragraphs, plus the average word length and the five most common letters and words. Fields are returned at the top level of the response.
How things are counted
- wordCount: runs of non-whitespace.
- letterCount, vowelCount, consonantCount: ASCII letters A to Z only (y counts as a consonant).
- sentenceCount: runs of . ! or ?, or 1 if the text has none.
- paragraphCount: blocks separated by a blank line.
- avgWordLength, topWords: based on word characters (letters, digits, underscore), case-insensitive.
avgWordLengthis rounded to 2 decimals. - topLetters, topWords: up to 5 entries, most frequent first.
Text can be up to 100,000 characters.
Endpoints
POST
https://opentools.ca/api/v1/tools/text-analyticsGet counts and frequency stats for a text
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| text | string | Required | The text to analyze (1 to 100,000 characters). |
Response Example
{
"success": true,
"wordCount": 10,
"charCount": 41,
"charCountNoSpaces": 31,
"letterCount": 29,
"vowelCount": 11,
"consonantCount": 18,
"sentenceCount": 2,
"paragraphCount": 2,
"avgWordLength": 2.9,
"topLetters": [
{
"letter": "t",
"count": 8
},
{
"letter": "a",
"count": 4
},
{
"letter": "o",
"count": 4
},
{
"letter": "h",
"count": 3
},
{
"letter": "e",
"count": 3
}
],
"topWords": [
{
"word": "the",
"count": 3
},
{
"word": "sat",
"count": 2
},
{
"word": "cat",
"count": 1
},
{
"word": "on",
"count": 1
},
{
"word": "mat",
"count": 1
}
]
}Error Codes
400
Invalid request. Validation problems are listed in details.401
Missing or invalid API key403
API key is deactivated or expired, or this IP address is not allowed for the key429
Rate limit exceeded (120 requests per minute per key)500
Internal server errorCode Examples
curl -X POST https://opentools.ca/api/v1/tools/text-analytics \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "The cat sat on the mat.\n\nThe dog sat too."}'Rather use it in your browser? Open the Text Analytics