# Queueing Theory API
> Queueing-theory maths as an API, computed locally and deterministically. The littles-law endpoint applies Little's law, L = λ·W — the average number in a system equals the arrival rate times the average time in the system — and solves for whichever of the three you leave out; it holds for any stable system, from a checkout line to a request pipeline. The mm1 endpoint gives the full steady-state metrics of a single-server M/M/1 queue from the arrival rate λ and the service rate μ: the utilization ρ = λ/μ, the average number in the system and in the queue, the average time in the system and waiting, and the probability the system is empty — and it flags an unstable queue when ρ ≥ 1. The mmc endpoint extends this to a multi-server M/M/c queue with the Erlang-C waiting probability, returning the offered load in erlangs, the per-server utilization, the chance an arrival has to wait, and the same length and time metrics. Rates must share a time unit, and the times come out in that unit. Everything is computed locally and deterministically, so it is instant and private. Ideal for capacity-planning and operations tools, call-centre and staffing apps, server and throughput sizing, and operations-research education. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This is queueing theory; for descriptive statistics on a list of numbers use a statistics 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/queue-api/..."
```

## Pricing
- **Free** (Free) — 2,000 calls/Mo, 2 req/s
- **Starter** ($9/Mo) — 40,000 calls/Mo, 5 req/s
- **Pro** ($24/Mo) — 250,000 calls/Mo, 15 req/s
- **Mega** ($75/Mo) — 1,543,000 calls/Mo, 40 req/s

## Endpoints

### Queue

#### `GET /v1/littles-law` — Little's law (L = λ·W)

**Parameters:**
- `number_in_system` (query, optional, string) — Average number in system L Example: `10`
- `arrival_rate` (query, optional, string) — Arrival rate λ Example: `2`
- `time_in_system` (query, optional, string) — Average time in system W Example: `5`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/queue-api/v1/littles-law?number_in_system=10&arrival_rate=2&time_in_system=5"
```

**Response:**
```json
{
    "data": {
        "law": "L = λ · W",
        "note": "Little's law holds for any stable system: average number in system = arrival rate × average time in system.",
        "solved_for": "W",
        "arrival_rate": 2,
        "time_in_system_W": 5,
        "number_in_system_L": 10
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:02.710Z",
        "request_id": "0e288407-1c59-4324-af34-a91347c218a4"
    },
    "status": "ok",
    "message": "Little's law (L = λ·W)",
    "success": true
}
```

#### `GET /v1/mm1` — M/M/1 single-server queue

**Parameters:**
- `arrival_rate` (query, required, string) — Arrival rate λ Example: `8`
- `service_rate` (query, required, string) — Service rate μ Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/queue-api/v1/mm1?arrival_rate=8&service_rate=10"
```

**Response:**
```json
{
    "data": {
        "note": "Steady-state M/M/1: ρ=λ/μ, L=ρ/(1−ρ), Lq=ρ²/(1−ρ), W=1/(μ−λ), Wq=λ/(μ(μ−λ)). Requires ρ<1.",
        "model": "M/M/1",
        "utilization": 0.8,
        "arrival_rate": 8,
        "service_rate": 10,
        "avg_time_in_queue_Wq": 0.4,
        "avg_time_in_system_W": 0.5,
        "prob_system_empty_P0": 0.2,
        "avg_number_in_queue_Lq": 3.2,
        "avg_number_in_system_L": 4
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:02.805Z",
        "request_id": "996e50bc-d17f-414f-a8bd-e9f2ac76aa57"
    },
    "status": "ok",
    "message": "M/M/1 single-server queue",
    "success": true
}
```

#### `GET /v1/mmc` — M/M/c multi-server queue

**Parameters:**
- `arrival_rate` (query, required, string) — Arrival rate λ Example: `8`
- `service_rate` (query, required, string) — Service rate μ (per server) Example: `5`
- `servers` (query, required, string) — Number of servers c Example: `2`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/queue-api/v1/mmc?arrival_rate=8&service_rate=5&servers=2"
```

**Response:**
```json
{
    "data": {
        "note": "Steady-state M/M/c with Erlang-C waiting probability. ρ=λ/(c·μ); requires ρ<1.",
        "model": "M/M/c",
        "servers": 2,
        "utilization": 0.8,
        "arrival_rate": 8,
        "service_rate": 5,
        "prob_wait_erlang_c": 0.711111,
        "avg_time_in_queue_Wq": 0.355556,
        "avg_time_in_system_W": 0.555556,
        "offered_load_erlangs": 1.6,
        "prob_system_empty_P0": 0.111111,
        "avg_number_in_queue_Lq": 2.844444,
        "avg_number_in_system_L": 4.444444
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:02.900Z",
        "request_id": "9b8cd2ee-9dc6-42ae-94ae-0309ee711097"
    },
    "status": "ok",
    "message": "M/M/c multi-server queue",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "api": "queue",
        "note": "Queueing-theory maths (Little's law, M/M/1, M/M/c) — computed locally and deterministically, no key, no third-party service. Rates must share a time unit.",
        "endpoints": [
            "/v1/littles-law",
            "/v1/mm1",
            "/v1/mmc",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-04T01:59:02.997Z",
        "request_id": "ff69b06e-cced-4cb6-9cc8-462ff3e71bae"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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