# Cipher API
> Encode and decode classical ciphers and alphabets as an API — Morse code, ROT13, the Caesar shift (with any shift 1-25), Atbash, the NATO phonetic alphabet, leetspeak, A1Z26 (letters to numbers) and string reversal. Send text and a cipher and get the transformed string back, or decode it again — most are perfectly reversible. Everything runs locally, so it is fast and always available. Ideal for puzzle and escape-room games, ARGs, treasure hunts, education and coding lessons, retro and hacker-themed UIs, and chat bots. For base64/hex/URL encodings use the Encoding API; for cryptographic hashes use the Hash 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/cipher-api/..."
```

## Pricing
- **Free** (Free) — 16,000 calls/Mo, 2 req/s
- **Starter** ($2/Mo) — 235,000 calls/Mo, 8 req/s
- **Pro** ($8/Mo) — 920,000 calls/Mo, 20 req/s
- **Mega** ($28/Mo) — 3,800,000 calls/Mo, 50 req/s

## Endpoints

### Cipher

#### `GET /v1/decode` — Reverse a cipher

**Parameters:**
- `text` (query, required, string) — Encoded text, e.g. Uryyb Example: `Uryyb`
- `cipher` (query, required, string) — The cipher to reverse Example: `rot13`
- `shift` (query, optional, string) — Shift for the Caesar cipher (1-25)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cipher-api/v1/decode?text=Uryyb&cipher=rot13"
```

**Response:**
```json
{
    "data": {
        "input": "Uryyb",
        "cipher": "rot13",
        "result": "Hello",
        "operation": "decode",
        "reversible": true
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:26.499Z",
        "request_id": "29b63bbc-ce02-48f0-aee7-e29c05e8c3fc"
    },
    "status": "ok",
    "message": "Decoded",
    "success": true
}
```

#### `GET /v1/encode` — Apply a cipher to text

**Parameters:**
- `text` (query, required, string) — Text to encode, e.g. Hello Example: `Hello`
- `cipher` (query, required, string) — morse | rot13 | caesar | atbash | nato | leet | a1z26 | reverse Example: `morse`
- `shift` (query, optional, string) — Shift for the Caesar cipher (1-25, default 3)

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/cipher-api/v1/encode?text=Hello&cipher=morse"
```

**Response:**
```json
{
    "data": {
        "input": "Hello",
        "cipher": "morse",
        "result": ".... . .-.. .-.. ---",
        "operation": "encode"
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:26.575Z",
        "request_id": "1a4c586b-f0af-4160-8f70-3040f91efe83"
    },
    "status": "ok",
    "message": "Encoded",
    "success": true
}
```

### Reference

#### `GET /v1/ciphers` — The supported ciphers

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

**Response:**
```json
{
    "data": {
        "count": 8,
        "ciphers": [
            {
                "id": "morse",
                "reversible": true,
                "description": "International Morse code (dots/dashes)"
            },
            {
                "id": "rot13",
                "reversible": true,
                "description": "ROT13 letter rotation (self-inverse)"
            },
            {
                "id": "caesar",
                "reversible": true,
                "description": "Caesar shift cipher (shift= param, default 3)"
            },
            {
                "id": "atbash",
                "reversible": true,
                "description": "Atbash mirror cipher (self-inverse)"
            },
            {
                "id": "nato",
                "reversible": true,
                "description": "NATO phonetic alphabet"
            },
            {
                "id": "leet",
                "reversible": false,
                "description": "Leetspeak (l33t) — decode is best-effort"
            },
            {
                "id": "a1z26",
                "reversible": true,
                "description": "A1Z26 (letters ↔ numbers)"
            },
            {
                "id": "reverse",
                "reversible": true,
                "description": "Reverse the string (self-inverse)"
            }
        ]
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:26.644Z",
        "request_id": "d59a1124-b652-412b-9
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Usage notes

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

**Response:**
```json
{
    "data": {
        "note": "Classical ciphers & alphabets. /v1/encode = apply a cipher to text (cipher=morse|rot13|caesar|atbash|nato|leet|a1z26|reverse; caesar takes shift=1..25); /v1/decode = reverse it (where reversible — leet decode is best-effort); /v1/ciphers = the supported ciphers. Runs fully locally — fast and always available. For base64/hex/url use the Encoding API; for hashes use the Hash API.",
        "source": "local cipher engine",
        "ciphers": [
            "morse",
            "rot13",
            "caesar",
            "atbash",
            "nato",
            "leet",
            "a1z26",
            "reverse"
        ],
        "endpoints": [
            "/v1/encode",
            "/v1/decode",
            "/v1/ciphers",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:26.710Z",
        "request_id": "b64b225e-ca50-430d-93ea-d972bdc21c7e"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


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