# xkcd API
> Randall Munroe's legendary webcomic xkcd as an API. Fetch the latest comic, any comic by its number (e.g. #353 "Python"), or a random one — each with the title, the famous hover (alt) text, the full transcript, the image URL, the publication date and links to both xkcd and explainxkcd. A clean JSON wrapper over xkcd.com with no scraping and no surprises. Ideal for Discord and Slack bots, "comic of the day" widgets, dashboards and screensavers, newsletters, and any app that wants a daily dose of xkcd.

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

## Pricing
- **Free** (Free) — 13,500 calls/Mo, 2 req/s
- **Starter** ($3/Mo) — 195,000 calls/Mo, 8 req/s
- **Pro** ($9/Mo) — 840,000 calls/Mo, 20 req/s
- **Mega** ($30/Mo) — 3,450,000 calls/Mo, 50 req/s

## Endpoints

### Comics

#### `GET /v1/comic` — A comic by number

**Parameters:**
- `number` (query, required, string) — Comic number, e.g. 353 Example: `353`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/xkcd-api/v1/comic?number=353"
```

#### `GET /v1/latest` — The most recent comic

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

#### `GET /v1/random` — A random comic

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

### Meta

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

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


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