# Word Wrap API
> Reflow plain text to a fixed column width on word boundaries — the classic word-wrap you need for terminal and CLI output, email and plain-text formatting, code comments, README and changelog blocks, and fixed-width reports. The wrap endpoint breaks text to a chosen width while preserving paragraphs (blank-line separated), with optional left indentation and the option to hard-break words longer than the line; the unwrap endpoint does the reverse, collapsing a wrapped block back into single-line paragraphs. Pure local computation — no key, no third-party service, instant; up to 200,000 characters via POST. Live, nothing stored. 3 endpoints. Distinct from case conversion, slugs and text statistics.

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

## Pricing
- **Free** (Free) — 1,105 calls/Mo, 2 req/s
- **Starter** ($1/Mo) — 9,450 calls/Mo, 8 req/s
- **Pro** ($21/Mo) — 145,500 calls/Mo, 20 req/s
- **Mega** ($59/Mo) — 770,000 calls/Mo, 50 req/s

## Endpoints

### Word Wrap

#### `GET /v1/unwrap` — Unwrap to paragraphs

**Parameters:**
- `text` (query, required, string) — Wrapped text Example: `The quick brown
fox jumps over
the lazy dog.`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/wordwrap-api/v1/unwrap?text=The+quick+brown%0Afox+jumps+over%0Athe+lazy+dog."
```

**Response:**
```json
{
    "data": {
        "unwrapped": "The quick brown fox jumps over the lazy dog."
    },
    "meta": {
        "timestamp": "2026-06-03T01:09:41.712Z",
        "request_id": "899f0c48-425e-4a9c-8bb1-0c449efca876"
    },
    "status": "ok",
    "message": "Unwrap to paragraphs",
    "success": true
}
```

#### `GET /v1/wrap` — Wrap text to a width

**Parameters:**
- `text` (query, required, string) — Text to wrap Example: `The quick brown fox jumps over the lazy dog.`
- `width` (query, optional, string) — Columns (default 80) Example: `40`
- `indent` (query, optional, string) — Leading spaces (default 0)
- `break_long_words` (query, optional, string) — true/false (default false)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/wordwrap-api/v1/wrap?text=The+quick+brown+fox+jumps+over+the+lazy+dog.&width=40"
```

**Response:**
```json
{
    "data": {
        "lines": 2,
        "width": 40,
        "wrapped": "The quick brown fox jumps over the lazy\ndog."
    },
    "meta": {
        "timestamp": "2026-06-03T01:09:41.808Z",
        "request_id": "07a8aa18-5cd3-416e-91ed-91568f728666"
    },
    "status": "ok",
    "message": "Wrap text to a width",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "name": "Word Wrap API",
        "notes": "Paragraphs are separated by blank lines and preserved. Words longer than the width overflow unless break_long_words is true. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/wrap",
                "params": {
                    "text": "the text (required)",
                    "width": "columns (default 80)",
                    "indent": "leading spaces (default 0)",
                    "break_long_words": "true/false (default false)"
                },
                "returns": "the wrapped text"
            },
            {
                "path": "/v1/unwrap",
                "params": {
                    "text": "wrapped text (required)"
                },
                "returns": "paragraphs joined back into single lines"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Reflow plain text to a fixed column width on word boundaries (preserving paragraphs), with optional indentation and long-word breaking — and unwrap text back into single-line paragraphs. Pure local, no key."
    },
    "meta": {
        "timestamp": "2026-06-03T01:09:41.901Z",
        "request_id": "d321a8e7-59a2-4399-9511-fb3476c019a8"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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