Text Analysis API: Word Count, Reading Time & Keyword Frequency

Counting words, measuring reading time, or extracting keyword frequencies from user-generated content usually means pulling in an NLP library and writing boilerplate parsing code. The Apixies Text Analyzer API handles all of that in a single POST request -- send text in, get structured metrics back as JSON.

What the API Returns

The Text Analyzer endpoint accepts a block of text and returns a detailed breakdown:

Metric Description
words Total word count
characters Total character count (including spaces)
characters_no_spaces Character count without spaces
sentences Number of sentences detected
paragraphs Number of paragraphs
lines Number of lines
avg_word_length Average word length in characters
reading_time_min Estimated reading time in minutes
speaking_time_min Estimated speaking time in minutes
top_words Most frequent words with counts

Authentication

Pass your API key in the X-API-Key header. Anonymous requests work at 20 requests/day. A free registered account bumps you to 75 requests/day -- enough for development and moderate production use.

curl -X POST "https://apixies.io/api/v1/analyze-text" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Your text content here."}'

Get a free API key to raise your daily limit.

Step-by-Step: Your First Text Analysis

Step 1 -- Send a Simple Request

Start with a basic cURL call:

curl -X POST "https://apixies.io/api/v1/analyze-text" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "The quick brown fox jumps over the lazy dog. This classic sentence contains every letter of the English alphabet."}'

The response contains all computed metrics:

{
  "status": "success",
  "data": {
    "words": 19,
    "characters": 110,
    "characters_no_spaces": 92,
    "sentences": 2,
    "paragraphs": 1,
    "lines": 1,
    "avg_word_length": 4.8,
    "reading_time_min": 0.1,
    "speaking_time_min": 0.1,
    "top_words": { "the": 2 }
  }
}

Step 2 -- Analyze Longer Content

The API handles multi-paragraph text. Line breaks and paragraph structure are detected automatically:

curl -X POST "https://apixies.io/api/v1/analyze-text" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "First paragraph about API design.\n\nSecond paragraph discussing implementation details and best practices for REST endpoints."}'

Step 3 -- Use the Top Words Data

The top_words field returns the most frequent words in the text, which is useful for keyword extraction, content tagging, and SEO analysis. Common stop words (the, a, is, etc.) are typically included in the counts -- you can filter them client-side if needed.

Code Examples

JavaScript (Node.js)

async function analyzeText(text) {
  const response = await fetch("https://apixies.io/api/v1/analyze-text", {
    method: "POST",
    headers: {
      "X-API-Key": process.env.APIXIES_KEY,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ text }),
  });

  if (!response.ok) {
    throw new Error(`Analysis failed: ${response.status}`);
  }

  return await response.json();
}

const result = await analyzeText("Your article or blog post content here.");
console.log(`Words: ${result.data.words}`);
console.log(`Reading time: ${result.data.reading_time_min} min`);
console.log(`Top words:`, result.data.top_words);

Python

import requests
import os

api_key = os.environ["APIXIES_KEY"]

def analyze_text(text):
    response = requests.post(
        "https://apixies.io/api/v1/analyze-text",
        json={"text": text},
        headers={"X-API-Key": api_key},
    )
    response.raise_for_status()
    return response.json()["data"]

stats = analyze_text("Your article content goes here.")
print(f"Words: {stats['words']}")
print(f"Reading time: {stats['reading_time_min']} min")
print(f"Top words: {stats['top_words']}")

PHP

$apiKey = getenv('APIXIES_KEY');

function analyzeText(string $text): array
{
    global $apiKey;

    $ch = curl_init('https://apixies.io/api/v1/analyze-text');
    curl_setopt_array($ch, [
        CURLOPT_POST           => true,
        CURLOPT_HTTPHEADER     => [
            "X-API-Key: {$apiKey}",
            'Content-Type: application/json',
        ],
        CURLOPT_POSTFIELDS     => json_encode(['text' => $text]),
        CURLOPT_RETURNTRANSFER => true,
    ]);

    $body   = curl_exec($ch);
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($status !== 200) {
        throw new RuntimeException("Analysis failed: {$status}");
    }

    return json_decode($body, true)['data'];
}

$stats = analyzeText('Your content here.');
echo "Words: {$stats['words']}\n";
echo "Reading time: {$stats['reading_time_min']} min\n";

Common Use Cases

  • Blog / CMS word count -- Display word count and reading time on articles automatically.
  • Content guidelines -- Enforce minimum or maximum word counts in user submissions.
  • SEO keyword density -- Use top_words to check keyword frequency against target keywords.
  • Form validation -- Verify that text fields meet length requirements before saving.
  • Readability scoring -- Combine avg_word_length and sentences to estimate reading level.
  • Translation estimates -- Use word count to estimate translation costs at per-word rates.

Next Steps

Get your free API key and start analyzing text in minutes.

Try the Text Analyzer API

Free tier is for development & small projects. 75 requests/day with a registered account.

Getting Started

Explore

Resources

Get Started Free

Free for development and small projects.

Get Free API Key