# Advice Slip API
> Short pieces of advice via the open Advice Slip API — no key. The random endpoint returns a random advice slip; the advice endpoint fetches a specific slip by its id; and the search endpoint finds slips containing a phrase. Each slip carries its id and advice text. Real advice, with id lookups cached for speed — no key. 4 endpoints. Ideal for daily-advice widgets, chatbots, fortune-cookie features, loading screens and onboarding delight.

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

## Pricing
- **Free** (Free) — 7,400 calls/Mo, 2 req/s
- **Basic** ($5/Mo) — 99,500 calls/Mo, 8 req/s
- **Pro** ($20/Mo) — 563,500 calls/Mo, 20 req/s
- **Mega** ($60/Mo) — 2,740,000 calls/Mo, 50 req/s

## Endpoints

### Advice

#### `GET /v1/advice` — A slip by id

**Parameters:**
- `id` (query, required, string) — Numeric advice id Example: `42`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/advice-api/v1/advice?id=42"
```

**Response:**
```json
{
    "data": {
        "slip": {
            "id": 42,
            "advice": "Always double check you actually attached the file to the email."
        }
    },
    "meta": {
        "timestamp": "2026-06-08T09:48:44.959Z",
        "request_id": "64047de1-f695-4faf-8450-a390168c44cb"
    },
    "status": "ok",
    "message": "Advice retrieved successfully",
    "success": true
}
```

#### `GET /v1/random` — A random advice slip

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

**Response:**
```json
{
    "data": {
        "slip": {
            "id": 200,
            "advice": "Sarcasm is the lowest form of wit. Employ correctly with apt timing."
        }
    },
    "meta": {
        "timestamp": "2026-06-08T09:48:45.149Z",
        "request_id": "a7503edb-68ff-416e-a8ba-305527eeef16"
    },
    "status": "ok",
    "message": "Advice retrieved successfully",
    "success": true
}
```

#### `GET /v1/search` — Search the collection

**Parameters:**
- `q` (query, required, string) — Phrase to search for (min 2 chars) Example: `money`
- `limit` (query, optional, string) — Max results (1-100, default 20) Example: `20`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/advice-api/v1/search?q=money&limit=20"
```

**Response:**
```json
{
    "data": {
        "count": 1,
        "query": "money",
        "slips": [
            {
                "id": 122,
                "advice": "You spend half your life asleep or in bed. It's worth spending money on a good mattress, decent pillows and a comfy duvet."
            }
        ],
        "total": "1"
    },
    "meta": {
        "timestamp": "2026-06-08T09:48:45.382Z",
        "request_id": "7139d70d-e4fa-4b21-8165-98faac91dda3"
    },
    "status": "ok",
    "message": "Search results retrieved successfully",
    "success": true
}
```

### Meta

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

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

**Response:**
```json
{
    "data": {
        "service": "advice-api",
        "endpoints": {
            "GET /v1/meta": "This document.",
            "GET /v1/advice": "A specific slip by id (id=).",
            "GET /v1/random": "A random advice slip.",
            "GET /v1/search": "Search the collection for a phrase (q=, min 2 chars, limit=)."
        },
        "description": "Short pieces of advice via the open Advice Slip API: pull a random advice slip, fetch a specific slip by id, or search the collection for slips containing a phrase. Real advice, no key."
    },
    "meta": {
        "timestamp": "2026-06-08T09:48:45.475Z",
        "request_id": "617a0a75-21b2-4d00-8086-40aabda71bc0"
    },
    "status": "ok",
    "message": "Meta",
    "success": true
}
```


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