# Maze API
> Generate and solve mazes — entirely locally and reproducibly. The generate endpoint builds a perfect maze (exactly one path between any two cells, no loops) of the width and height you choose, using either a recursive-backtracker algorithm (long, winding corridors) or Prim's algorithm (more branching, shorter dead-ends), and returns it as ready-to-print ASCII art plus a compact per-cell wall-bitmask grid, with the start marked top-left and the exit bottom-right. Every maze is fully reproducible: pass a seed and you always get exactly the same maze on any machine, and the seed is returned when you omit it so you can recreate it later. The solve endpoint re-creates the maze from the same seed, width, height and algorithm and returns the shortest path from start to finish, both as an ordered list of cells and drawn onto the maze. Everything is computed locally and deterministically, so it is instant and private. Ideal for games and puzzles, procedural level generation, teaching algorithms and graph search, printable activity sheets, and creative coding. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints.

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

## Pricing
- **Free** (Free) — 3,735 calls/Mo, 2 req/s
- **Starter** ($5/Mo) — 13,250 calls/Mo, 8 req/s
- **Pro** ($25/Mo) — 183,500 calls/Mo, 20 req/s
- **Mega** ($63/Mo) — 960,000 calls/Mo, 50 req/s

## Endpoints

### Maze

#### `GET /v1/generate` — Generate a maze

**Parameters:**
- `width` (query, optional, string) — Cells wide (2–40, default 10) Example: `10`
- `height` (query, optional, string) — Cells tall (2–40, default 10) Example: `10`
- `algorithm` (query, optional, string) — backtracker (default) or prim
- `seed` (query, optional, string) — Integer for a reproducible maze Example: `42`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/maze-api/v1/generate?width=10&height=10&seed=42"
```

**Response:**
```json
{
    "data": {
        "end": [
            9,
            9
        ],
        "grid": [
            [
                11,
                13,
                1,
                5,
                5,
                3,
                9,
                5,
                5,
                3
            ],
            [
                12,
                3,
                8,
                3,
                13,
                6,
                12,
                1,
                7,
                10
            ],
            [
                9,
                6,
                10,
                12,
                5,
                5,
                5,
                6,
                9,
                2
            ],
            [
                10,
                13,
                4,
                3,
                9,
                3,
                9,
                5,
                6,
                10
            ],
            [
                12,
                5,
                3,
                10,
                10,
                14,
                10,
                11,
                9,
                6
            ],
            [
                13,
                3,
                10,
                12,
                6,
                9,
                6,
                10,
                10,
                11
            ],
            [
                9,
                6,
                12,
      
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/solve` — Solve a maze

**Parameters:**
- `width` (query, optional, string) — Cells wide (2–40) Example: `10`
- `height` (query, optional, string) — Cells tall (2–40) Example: `10`
- `algorithm` (query, optional, string) — backtracker (default) or prim
- `seed` (query, required, string) — Seed of the maze to solve Example: `42`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/maze-api/v1/solve?width=10&height=10&seed=42"
```

**Response:**
```json
{
    "data": {
        "path": [
            [
                0,
                0
            ],
            [
                0,
                1
            ],
            [
                1,
                1
            ],
            [
                1,
                2
            ],
            [
                0,
                2
            ],
            [
                0,
                3
            ],
            [
                0,
                4
            ],
            [
                1,
                4
            ],
            [
                2,
                4
            ],
            [
                2,
                5
            ],
            [
                2,
                6
            ],
            [
                3,
                6
            ],
            [
                3,
                7
            ],
            [
                2,
                7
            ],
            [
                2,
                8
            ],
            [
                3,
                8
            ],
            [
                3,
                9
            ],
            [
                4,
                9
            ],
            [
                5,
                9
            ],
            [
                5,
                8
            ],
            [
                5,
                7
            ],
            [
                4,
                7
            ],
            [

…(truncated, see openapi.json for full schema)
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "name": "Maze API",
        "notes": "Mazes are 'perfect' (no loops, one unique route). Pass the same seed, width, height and algorithm to generate and solve to get matching mazes. Grid bitmask bits: 1=N wall, 2=E, 4=S, 8=W. Nothing is stored.",
        "version": "v1",
        "endpoints": [
            {
                "path": "/v1/generate",
                "params": {
                    "seed": "integer for a reproducible maze (random if omitted)",
                    "width": "cells wide (2–40, default 10)",
                    "height": "cells tall (2–40, default 10)",
                    "algorithm": "backtracker (default) or prim"
                },
                "returns": "the maze as ASCII and a wall-bitmask grid, plus the seed"
            },
            {
                "path": "/v1/solve",
                "params": {
                    "seed": "the seed of the maze to solve (required to match a generated one)",
                    "width": "as generate",
                    "height": "as generate",
                    "algorithm": "as generate"
                },
                "returns": "the shortest path from start to end and the solved ASCII"
            },
            {
                "path": "/v1/meta",
                "params": [],
                "returns": "this document"
            }
        ],
        "description": "Generate and solve mazes. The generate endpoint builds a perfect maze (exactly one path between any
…(truncated, see openapi.json for full schema)
```


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