---
title: "Use this when you need exact word, character, sentence, and paragraph counts instead of estimating."
method: POST
path: "/v1/count_text"
tags: ["text"]
---

# Use this when you need exact word, character, sentence, and paragraph counts instead of estimating.

`POST /v1/count_text`

## Request

- Base URL: `https://api.clean.tools`
- URL: `https://api.clean.tools/v1/count_text`
- Auth: none declared

Use this when you need exact word, character, sentence, and paragraph counts instead of estimating. Deterministic: same input, same output. Uses Unicode-aware segmentation (Intl.Segmenter): characters are grapheme clusters, so an emoji or an accented letter counts as one; words are word-like segments; sentence splitting is abbreviation-aware (Dr., etc., won't end a sentence). charactersNoSpaces counts graphemes after stripping whitespace, and paragraphs are blocks separated by blank lines. Example: "Café 👩‍💻!" -> words 1, characters 7, charactersNoSpaces 6, sentences 1, paragraphs 1. Empty input returns all zeros.

## Request body

- object
  - `text` string, required: Text to analyze.

## Response `200`

Structured tool result.

- object
  - `tool` string
  - `result` object
    - `words` integer, required: Count of word-like segments.
    - `characters` integer, required: Count of grapheme clusters (user-perceived characters), including whitespace.
    - `charactersNoSpaces` integer, required: Grapheme count after removing all whitespace.
    - `sentences` integer, required: Sentence count using abbreviation-aware segmentation.
    - `paragraphs` integer, required: Count of non-empty blocks separated by blank lines.

## Other responses

- `400`: Invalid input or the tool reported an error.
- `413`: Request body exceeds the 128 KB limit.
- `429`: Rate limit exceeded; the response carries Retry-After and RateLimit-* headers — honor them and add jitter.

---

[API](https://skmtc.dev/clean/apis/clean-tools-api.md) · [All operations](https://skmtc.dev/clean/apis/clean-tools-api/llms.txt) · [OpenAPI document](https://skmtc.dev/clean/apis/clean-tools-api/revisions/a24a01d2833c?raw)
