# Entropy API
> Measure the information content of text. The analyze endpoint computes the Shannon entropy in bits per symbol, the total information in bits and bytes, the maximum possible entropy for the alphabet that was actually used, and a normalized 0–1 score that says how uniform (random-looking) the distribution is — over Unicode code points or raw UTF-8 bytes. The frequency endpoint returns the full character-frequency distribution, most common symbol first, with counts and percentages, showing control characters escaped and bytes as hex. It is exact, deterministic and runs entirely locally with no network calls, so it is instant and private. Ideal for randomness and password-quality checks, estimating how compressible data is, language and classical-cipher analysis, spotting low-variety or repetitive input, and feature extraction for text classification. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This measures information content; for password-strength scoring use a password API, for number statistics use a statistics API, and for grapheme/character counts use a text-segmentation API.

## 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/entropy-api/..."
```

## Pricing
- **Free** (Free) — 4,335 calls/Mo, 2 req/s
- **Starter** ($6/Mo) — 13,850 calls/Mo, 8 req/s
- **Pro** ($26/Mo) — 189,500 calls/Mo, 20 req/s
- **Mega** ($64/Mo) — 990,000 calls/Mo, 50 req/s

## Endpoints

### Entropy

#### `GET /v1/analyze` — Shannon entropy

**Parameters:**
- `text` (query, required, string) — The text Example: `Tr0ub4dor&3`
- `unit` (query, optional, string) — char (default) or byte

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/entropy-api/v1/analyze?text=Tr0ub4dor%263"
```

**Response:**
```json
{
    "data": {
        "unit": "char",
        "length": 11,
        "normalized": 0.98666,
        "total_bits": 36.053748,
        "total_bytes": 4.506718,
        "unique_symbols": 10,
        "max_entropy_bits": 3.321928,
        "entropy_bits_per_symbol": 3.277613
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:21.424Z",
        "request_id": "215cabc7-0f0e-4048-99fe-2b6b5235de7d"
    },
    "status": "ok",
    "message": "Shannon entropy",
    "success": true
}
```

#### `GET /v1/frequency` — Symbol frequency

**Parameters:**
- `text` (query, required, string) — The text Example: `hello world`
- `unit` (query, optional, string) — char (default) or byte
- `top` (query, optional, string) — Keep only the N most frequent

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/entropy-api/v1/frequency?text=hello+world"
```

**Response:**
```json
{
    "data": {
        "unit": "char",
        "length": 11,
        "frequencies": [
            {
                "count": 3,
                "symbol": "l",
                "percent": 27.272727,
                "codepoint": 108
            },
            {
                "count": 2,
                "symbol": "o",
                "percent": 18.181818,
                "codepoint": 111
            },
            {
                "count": 1,
                "symbol": "h",
                "percent": 9.090909,
                "codepoint": 104
            },
            {
                "count": 1,
                "symbol": "e",
                "percent": 9.090909,
                "codepoint": 101
            },
            {
                "count": 1,
                "symbol": " ",
                "percent": 9.090909,
                "codepoint": 32
            },
            {
                "count": 1,
                "symbol": "w",
                "percent": 9.090909,
                "codepoint": 119
            },
            {
                "count": 1,
                "symbol": "r",
                "percent": 9.090909,
                "codepoint": 114
            },
            {
                "count": 1,
                "symbol": "d",
                "percent": 9.090909,
                "codepoint": 100
            }
        ],
        "unique_symbols": 8
    },
    "meta": {
        "timestamp": "2026-06-03T17:42:21.536Z",
        "request_id": "71f65bd7-014d-481
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Spec

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

**Response:**
```json
{
    "data": {
        "name": "Entropy API",
        "notes": "Shannon entropy H = −Σ p·log2(p) over symbol probabilities; total bits = H × length. Normalized = H ÷ log2(unique symbols). This measures information content — for password strength use a password API, for number statistics use a statistics API, and for grapheme/character counts use a text-segmentation API. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/analyze",
                "params": {
                    "text": "the text (required)",
                    "unit": "char (Unicode code points, default) or byte"
                },
                "returns": "Shannon entropy, total bits/bytes, max entropy and normalized score"
            },
            {
                "path": "/v1/frequency",
                "params": {
                    "top": "keep only the N most frequent symbols (default all)",
                    "text": "the text (required)",
                    "unit": "char (default) or byte"
                },
                "returns": "the symbol-frequency distribution"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Measure the information content of text. The analyze endpoint computes the Shannon entropy in bits per symbol, the total information in bits and bytes, the maximum possible e
…(truncated, see openapi.json for full schema)
```


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