# Lines API
> Operate on text line by line. The transform endpoint sorts lines (natural / numeric-aware, ascending or descending, case-insensitive), removes duplicate lines, reverses their order, numbers them, trims whitespace and drops blank lines — and the operations chain in the order you list them, so trim → remove blanks → dedupe → sort happens in a single call. The count endpoint reports line statistics: total, blank, non-blank, unique and duplicate counts plus the longest, shortest and average line length. Perfect for cleaning up lists and logs, deduplicating, preparing data and tidying pasted text. Pure local computation — no key, no third-party service, instant; up to 500,000 characters via POST. Live, nothing stored. 3 endpoints. Distinct from word wrapping, sorting of JSON lists and CSV tooling.

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

## Pricing
- **Free** (Free) — 1,225 calls/Mo, 2 req/s
- **Starter** ($3/Mo) — 10,650 calls/Mo, 8 req/s
- **Pro** ($23/Mo) — 157,500 calls/Mo, 20 req/s
- **Mega** ($61/Mo) — 830,000 calls/Mo, 50 req/s

## Endpoints

### Lines

#### `GET /v1/count` — Line statistics

**Parameters:**
- `text` (query, required, string) — The text Example: `banana
apple

banana
cherry`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lines-api/v1/count?text=banana%0Aapple%0A%0Abanana%0Acherry"
```

**Response:**
```json
{
    "data": {
        "lines": 5,
        "blank_lines": 1,
        "unique_lines": 4,
        "duplicate_lines": 1,
        "non_blank_lines": 4,
        "average_line_length": 4.6,
        "longest_line_length": 6,
        "shortest_line_length": 0
    },
    "meta": {
        "timestamp": "2026-06-03T09:25:08.346Z",
        "request_id": "3ad89680-c455-40fc-a8dc-129b49e03937"
    },
    "status": "ok",
    "message": "Line statistics",
    "success": true
}
```

#### `GET /v1/transform` — Transform lines

**Parameters:**
- `text` (query, required, string) — The text Example: `banana
apple

banana
cherry`
- `operations` (query, required, string) — Comma list: trim,remove_blank,unique,sort,reverse,number Example: `trim,remove_blank,unique,sort`
- `order` (query, optional, string) — asc|desc (for sort)
- `case_insensitive` (query, optional, string) — for sort/unique
- `number_start` (query, optional, string) — for number
- `number_separator` (query, optional, string) — for number (default '. ')

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/lines-api/v1/transform?text=banana%0Aapple%0A%0Abanana%0Acherry&operations=trim%2Cremove_blank%2Cunique%2Csort"
```

**Response:**
```json
{
    "data": {
        "result": "apple\nbanana\ncherry",
        "lines_in": 5,
        "lines_out": 3,
        "operations": [
            "trim",
            "remove_blank",
            "unique",
            "sort"
        ]
    },
    "meta": {
        "timestamp": "2026-06-03T09:25:08.447Z",
        "request_id": "a90d7dd6-7214-4bcf-83bb-8246ed512b23"
    },
    "status": "ok",
    "message": "Transform lines",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "name": "Lines API",
        "notes": "Operations are applied left to right, e.g. operations=trim,remove_blank,unique,sort. Sorting is natural (numeric-aware). Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/transform",
                "params": {
                    "text": "the text (required)",
                    "order": "asc|desc (for sort)",
                    "operations": "comma list: trim,remove_blank,unique,sort,reverse,number (required)",
                    "number_start": "for number",
                    "case_insensitive": "for sort/unique",
                    "number_separator": "for number (default '. ')"
                },
                "returns": "the transformed text"
            },
            {
                "path": "/v1/count",
                "params": {
                    "text": "the text (required)"
                },
                "returns": "line statistics (total, blank, unique, lengths)"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Operate on text line by line — sort (natural, asc/desc, case-insensitive), remove duplicate lines, reverse the order, number the lines, trim whitespace and drop blank lines. Operations chain in order, so you can trim, drop blanks, dedupe and sort in one call. A count endpoint repo
…(truncated, see openapi.json for full schema)
```


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