# Text Segmentation API
> Count and split text the way people actually read it, using Unicode-correct segmentation. The count endpoint returns the number of grapheme clusters — the real, user-perceived characters, so a family emoji counts as 1 (not 7) and an accented letter as 1 — alongside words, sentences, code points, UTF-16 code units (the naive string length that over-counts) and UTF-8 byte length. This is exactly what character-limit fields, tweet/SMS counters and validation need so the count agrees with what the user sees. The segment endpoint splits text into grapheme, word or sentence segments (word segments are flagged word-like versus punctuation and spaces) and is locale-aware, so Japanese, Chinese and Thai word boundaries come out right. Everything is computed locally with no network calls. A Unicode text segmenter — distinct from the Unicode codepoint database (unicode), the case/text-utilities toolkit (text) and string similarity (similarity). No upstream key, no cache.

## Authentication
All requests require your oanor API key in the `x-oanor-key` header. Get one at https://www.oanor.com/developer/keys.

```bash
curl -H "x-oanor-key: oanor_live_…" "https://api.oanor.com/segmenter-api/..."
```

## Pricing
- **Free** (Free) — 2,020 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 38,000 calls/Mo, 8 req/s
- **Pro** ($20/Mo) — 204,000 calls/Mo, 20 req/s
- **Mega** ($52/Mo) — 790,000 calls/Mo, 50 req/s

## Endpoints

### Segmentation

#### `GET /v1/count` — Emoji-safe character/word/sentence counts

**Parameters:**
- `text` (query, required, string) — The text Example: `Hello 👋 café`
- `locale` (query, optional, string) — BCP 47 locale (for word/sentence) Example: `en`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/segmenter-api/v1/count?text=Hello+%F0%9F%91%8B+caf%C3%A9&locale=en"
```

#### `GET /v1/segment` — Split into segments

**Parameters:**
- `text` (query, required, string) — The text Example: `The quick brown fox.`
- `granularity` (query, optional, string) — grapheme, word, sentence Example: `word`
- `locale` (query, optional, string) — BCP 47 locale Example: `en`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/segmenter-api/v1/segment?text=The+quick+brown+fox.&granularity=word&locale=en"
```

### Meta

#### `GET /v1/meta` — Granularities

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/segmenter-api/v1/meta"
```


---
Marketplace page: https://www.oanor.com/api/segmenter-api
OpenAPI spec: https://www.oanor.com/api/segmenter-api/openapi.json
