# Quiz & Trivia API
> A ready-to-use trivia engine with more than 44,000 multiple-choice questions across 20 categories — animals, brain teasers, celebrities, entertainment, kids, general knowledge, geography, history, hobbies, humanities, literature, movies, music, people, religion, science & technology, sports, television, video games and world. Pull a random question or a batch (optionally filtered by category, with the answer hidden for gameplay and the options shuffled), fetch a specific question by id, verify a submitted answer, search questions by keyword, and list every category with its question count. Every endpoint accepts input via the query string or the request body and returns lean JSON. Pure server-side data (no third-party upstream), so responses are instant and always available. Ideal for quiz and trivia games, pub-quiz and party apps, learning tools, chatbots and Discord/Slack bots.

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

## Pricing
- **Free** (Free) — 20,000 calls/Mo, 3 req/s
- **Basic** ($4/Mo) — 280,000 calls/Mo, 8 req/s
- **Pro** ($10/Mo) — 2,000,000 calls/Mo, 25 req/s
- **Mega** ($27/Mo) — 10,000,000 calls/Mo, 60 req/s

## Endpoints

### Quiz

#### `GET /v1/categories` — All categories with counts

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

**Response:**
```json
{
    "data": {
        "count": 20,
        "categories": [
            {
                "name": "animals",
                "questions": 1365
            },
            {
                "name": "brain-teasers",
                "questions": 198
            },
            {
                "name": "celebrities",
                "questions": 3160
            },
            {
                "name": "entertainment",
                "questions": 279
            },
            {
                "name": "for-kids",
                "questions": 751
            },
            {
                "name": "general",
                "questions": 3279
            },
            {
                "name": "geography",
                "questions": 842
            },
            {
                "name": "history",
                "questions": 1637
            },
            {
                "name": "hobbies",
                "questions": 1240
            },
            {
                "name": "humanities",
                "questions": 1092
            },
            {
                "name": "literature",
                "questions": 1269
            },
            {
                "name": "movies",
                "questions": 4256
            },
            {
                "name": "music",
                "questions": 5280
            },
            {
                "name": "people",
                "questions": 2739
            },
            {
                "name": "religion-fa
…(truncated, see openapi.json for full schema)
```

#### `GET /v1/check` — Verify an answer

**Parameters:**
- `id` (query, required, string) — Question id Example: `0`
- `answer` (query, required, string) — Submitted answer Example: `Sloth`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/quiz-api/v1/check?id=0&answer=Sloth"
```

**Response:**
```json
{
    "data": {
        "id": 0,
        "correct": true,
        "question": "Three of these animals hibernate. Which one does not?",
        "your_answer": "Sloth",
        "correct_answer": "Sloth"
    },
    "meta": {
        "timestamp": "2026-05-30T22:48:26.139Z",
        "request_id": "739c7ac3-4f8c-4d37-8ac8-216bc1b9ff7e"
    },
    "status": "ok",
    "message": "Answer checked",
    "success": true
}
```

#### `GET /v1/question` — Question by id

**Parameters:**
- `id` (query, required, string) — Question id Example: `0`
- `hide_answer` (query, optional, string) — Omit the correct answer Example: `false`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/quiz-api/v1/question?id=0&hide_answer=false"
```

**Response:**
```json
{
    "data": {
        "id": 0,
        "options": [
            "Frog",
            "Snake",
            "Mouse",
            "Sloth"
        ],
        "category": "animals",
        "question": "Three of these animals hibernate. Which one does not?",
        "correct_answer": "Sloth"
    },
    "meta": {
        "timestamp": "2026-05-30T22:48:26.209Z",
        "request_id": "f536c7f0-9e93-43fc-a30a-67ee84a69e00"
    },
    "status": "ok",
    "message": "Question retrieved",
    "success": true
}
```

#### `GET /v1/random` — Random question(s)

**Parameters:**
- `category` (query, optional, string) — Category slug Example: `science-technology`
- `count` (query, optional, string) — 1..50 (default 1) Example: `1`
- `hide_answer` (query, optional, string) — Omit the correct answer Example: `true`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/quiz-api/v1/random?category=science-technology&count=1&hide_answer=true"
```

**Response:**
```json
{
    "data": {
        "id": 29108,
        "options": [
            "cytology",
            "cellogy",
            "ecology",
            "protozoology"
        ],
        "category": "science-technology",
        "question": "Which of these is the study of cells?"
    },
    "meta": {
        "timestamp": "2026-05-30T22:48:26.278Z",
        "request_id": "4e396c0c-0dbf-4f67-a3e6-c167671d3964"
    },
    "status": "ok",
    "message": "Random question retrieved",
    "success": true
}
```

#### `GET /v1/search` — Search questions

**Parameters:**
- `q` (query, optional, string) — Text query Example: `planet`
- `category` (query, optional, string) — Category slug Example: `science-technology`
- `limit` (query, optional, string) — 1..100 (default 20) Example: `20`
- `offset` (query, optional, string) — Offset Example: `0`
- `hide_answer` (query, optional, string) — Omit answers Example: `true`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/quiz-api/v1/search?q=planet&category=science-technology&limit=20&offset=0&hide_answer=true"
```

**Response:**
```json
{
    "data": {
        "count": 20,
        "limit": 20,
        "query": "planet",
        "total": 98,
        "offset": 0,
        "results": [
            {
                "id": 28052,
                "options": [
                    "Uranus",
                    "Mars",
                    "Saturn",
                    "Venus"
                ],
                "category": "science-technology",
                "question": "This planet is slightly smaller than Earth and its closest neighbor (excluding the Moon)."
            },
            {
                "id": 28053,
                "options": [
                    "Neptune",
                    "Saturn",
                    "Venus",
                    "Mars"
                ],
                "category": "science-technology",
                "question": "This planet is has the largest  group of moons - 31, but it is best known for its ring system."
            },
            {
                "id": 28054,
                "options": [
                    "Pluto",
                    "Uranus",
                    "Neptune",
                    "Mercury"
                ],
                "category": "science-technology",
                "question": "This planet of the Solar System was named after a Greek god of the sea and earthquakes. The name is actually the Roman translation of the gods name."
            },
            {
                "id": 28055,
                "options": [
                    "Mercury",
    
…(truncated, see openapi.json for full schema)
```


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