01

Quickstart

No account or API key is required. Send JSON to a versioned endpoint:

curl -X POST https://textanalysis.tools/api/v1/analyze \
  -H "Content-Type: application/json" \
  -d '{
    "sourceType": "text",
    "source": "Bag of Words turns text into countable features.",
    "language": "auto",
    "focus": ["bag of words"],
    "top": 20
  }'
Machine-readable contract

Import /openapi.json into an agent or API client. The specification includes every available operation and its input and response schemas.

02

Analyze text or a webpage

POST /api/v1/analyze accepts raw text, HTML, or a public HTTP(S) URL. Set sourceType to text or url.

sourcerequired string

The text, HTML, or URL to analyze.

languageauto · en · ru · uk · es

Defaults to automatic detection.

focusstring or string[]

Up to 100 non-empty, analyzable phrases to count and report per 1,000 words. Each phrase may contain at most 200 characters; separate string values with commas.

top5–100

Maximum number of word and bigram rows.

tolerance1.2–4

Threshold for above/below-model diagnostics.

keepStopwordsboolean

Keep common language stop words when true.

03

Use a focused frequency, vector, or density endpoint

POST /api/v1/word-frequency returns vocabulary rows with raw count and normalized rates. POST /api/v1/keyword-density returns unigram, bigram, trigram, and exact tracked-phrase tables. POST /api/v1/ngram-analyzer returns n-gram tables for an explicit phrase length.

POST /api/v1/bag-of-words builds term vectors with token count, frequency, and normalized rates.

{
  "source": "Keyword density can be measured without chasing a target density.",
  "language": "en",
  "trackedKeywords": "keyword density, target density",
  "limit": 500
}
{
  "source": "Text analysis turns words into countable features.",
  "language": "en",
  "keepStopwords": false,
  "limit": 1000
}

The density endpoint accepts trackedKeywords as a comma, semicolon, or newline-separated string, while n-gram analysis accepts ngramSize (1-10). Set limit from 1 to 5,000 and offset from 0 to 250,000. Follow nextOffset until it is null to retrieve the complete ordered table.

{
  "source": "search engines rank useful pages higher when content stays focused on intent",
  "language": "en",
  "ngramSize": 2,
  "keepStopwords": false,
  "limit": 500
}

04

Compare versions A and B

POST /api/v1/compare accepts two complete analysis inputs and returns both results plus metric and word-frequency differences. To inspect the same result manually, open the Text Analysis Comparison tool.

{
  "a": { "sourceType": "text", "source": "First text version..." },
  "b": { "sourceType": "text", "source": "Updated text version..." }
}

wordChanges is ordered by the largest absolute change in share, useful for revision and QA workflows. Apply the same limit and offset to the ordered word and bigram change tables, then follow nextOffset while hasMore is true.

05

Weighting and similarity checks

POST /api/v1/tf-idf computes TF-IDF tables for 2–10 documents and returns global inverse-document frequencies. POST /api/v1/similarity returns cosine similarity and contribution rows for BoW or TF-IDF vectors.

For these operations, top controls per-document or contribution rows, while limit and offset page the supporting idfTable. Follow nextIdfOffset while hasMoreIdfRows is true. A BoW similarity response has no IDF table, but still validates the shared request contract.

{
  "documents": [
    { "source": "Text analysis turns words into countable features." },
    { "source": "Text similarity uses cosine overlap across vectors." }
  ],
  "top": 50,
  "limit": 1000
}
{
  "a": { "source": "Text analysis is useful for editorial review.", "language": "en" },
  "b": { "source": "Similarity compares weighted terms across versions.", "language": "en" },
  "method": "tf-idf",
  "top": 50,
  "limit": 1000
}

06

Response fields

tokenCount / wordCount

Words used as the result denominator after the endpoint's documented cleanup rule.

vocabularySize

Number of distinct analyzed words.

rows / unigrams

Words with counts, percentages, and per-1,000 values.

totalRows / returnedRows / truncated

Table-size metadata that makes an applied result limit explicit.

offset / nextOffset / hasMore

Stable pagination metadata for complete ordered vocabulary, density, n-gram, or comparison tables. IDF tables use the corresponding idfOffset fields.

bigrams / trigrams

Two- and three-word phrase tables where supported.

focusCoverage / trackedKeywords

Exact phrase counts and occurrences per 1,000 words.

fittedExponent

Estimated frequency-curve exponent returned by the Bag of Words analyzer.

tf / idf / tfidf / cosine

Term and pair-level weighting diagnostics for direct model usage.

Successful responses identify apiVersion and storage as none. Errors use a stable error.code and a human-readable error.message. Every response exposes a random X-Request-ID for support correlation.

07

Limits and safe use

  • Each raw text field is limited to 500,000 characters and 100,000 analyzable words.
  • focus accepts at most 100 non-empty, analyzable phrases of no more than 200 characters each.
  • Remote response bodies are limited to 2,000,000 bytes under one 12-second DNS, redirect, and download deadline.
  • Only public HTTP and HTTPS pages are accepted; connections use the validated public address and revalidate every redirect.
  • Compare, similarity, and TF-IDF requests share limits of 2,000,000 pasted characters, 250,000 analyzable words, 5,000,000 remote bytes, and three concurrent downloads.
  • Generated result tables return no more than 5,000 rows per page; density tables default to 2,000 rows, while explicitly requested tracked phrases are limited to 100 and are preserved.
  • Serialized JSON responses are limited to 5,000,000 bytes.
  • The public service allows 30 cost units per minute. Request cost is 1 + one unit per source after the first + two units per URL + one unit per full 100,000 pasted-text characters, capped at 30.
  • Responses expose rate-limit limit, remaining, reset, and retry headers to browser clients.
  • Use the results as editorial diagnostics, not as guarantees of search ranking.

08

Agent discovery and health

Agents can read /llms.txt for a concise capability map and /openapi.json for the callable contract. Both resources and every versioned API endpoint support cross-origin access. Liveness monitors can call GET /api/health; it returns bounded service metadata and a rateLimit state of shared, local, or degraded without testing or exposing submitted content.

For exact browser, API, CLI, MCP, storage, logging, and analytics boundaries, read Privacy and Data Handling.

FREE · STATELESS

Analyze through HTTP or keep the workflow local

Call the API from an application, use the web interface manually, or run the npm CLI against local files and stdin.

Read the CLI documentation