# Star Wars API
> The Star Wars universe as an API — every character, planet, film, starship, vehicle and species from the saga. Look up a record by id (e.g. people 1 → Luke Skywalker: 172 cm, born 19 BBY, homeworld Tatooine), search any category by name (e.g. people q=skywalker → Luke, Anakin and Shmi), or list whole categories with paging. Each record carries the full canonical data — physical traits and affiliations for characters; climate, terrain, gravity and population for planets; crew, hyperdrive rating, cargo and cost for starships and vehicles; titles, directors, opening crawls and release dates for the films — with cross-references between them. Backed by swapi.tech. Ideal for fan sites, quizzes and trivia games, Discord bots, learning projects and any Star Wars app.

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

## Pricing
- **Free** (Free) — 7,000 calls/Mo, 2 req/s
- **Starter** ($4/Mo) — 100,000 calls/Mo, 8 req/s
- **Pro** ($12/Mo) — 500,000 calls/Mo, 20 req/s
- **Mega** ($34/Mo) — 2,400,000 calls/Mo, 50 req/s

## Endpoints

### Star Wars

#### `GET /v1/get` — Full detail by category + id

**Parameters:**
- `type` (query, required, string) — Category, e.g. people Example: `people`
- `id` (query, required, string) — Record id, e.g. 1 (Luke Skywalker) Example: `1`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/starwars-api/v1/get?type=people&id=1"
```

**Response:**
```json
{
    "data": {
        "type": "people",
        "result": {
            "uid": "1",
            "url": "https://www.swapi.tech/api/people/1",
            "mass": "77",
            "name": "Luke Skywalker",
            "films": [
                "https://www.swapi.tech/api/films/1",
                "https://www.swapi.tech/api/films/2",
                "https://www.swapi.tech/api/films/3",
                "https://www.swapi.tech/api/films/6"
            ],
            "edited": "2026-05-31T05:22:39.375Z",
            "gender": "male",
            "height": "172",
            "created": "2026-05-31T05:22:39.375Z",
            "vehicles": [
                "https://www.swapi.tech/api/vehicles/14",
                "https://www.swapi.tech/api/vehicles/30"
            ],
            "eye_color": "blue",
            "homeworld": "https://www.swapi.tech/api/planets/1",
            "starships": [
                "https://www.swapi.tech/api/starships/12",
                "https://www.swapi.tech/api/starships/22"
            ],
            "birth_year": "19BBY",
            "hair_color": "blond",
            "skin_color": "fair",
            "description": "A person within the Star Wars universe"
        }
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:37.777Z",
        "request_id": "e74e7699-5878-4261-87c0-3c763dded202"
    },
    "status": "ok",
    "message": "Resource retrieved",
    "success": true
}
```

#### `GET /v1/list` — List a category (paginated; films whole)

**Parameters:**
- `type` (query, required, string) — people | planets | films | starships | vehicles | species Example: `people`
- `page` (query, optional, string) — Page number (default 1) Example: `1`
- `limit` (query, optional, string) — Page size (1-100, default 10) Example: `10`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/starwars-api/v1/list?type=people&page=1&limit=10"
```

**Response:**
```json
{
    "data": {
        "page": 1,
        "type": "people",
        "count": 10,
        "total": 82,
        "results": [
            {
                "uid": "1",
                "name": "Luke Skywalker"
            },
            {
                "uid": "2",
                "name": "C-3PO"
            },
            {
                "uid": "3",
                "name": "R2-D2"
            },
            {
                "uid": "4",
                "name": "Darth Vader"
            },
            {
                "uid": "5",
                "name": "Leia Organa"
            },
            {
                "uid": "6",
                "name": "Owen Lars"
            },
            {
                "uid": "7",
                "name": "Beru Whitesun lars"
            },
            {
                "uid": "8",
                "name": "R5-D4"
            },
            {
                "uid": "9",
                "name": "Biggs Darklighter"
            },
            {
                "uid": "10",
                "name": "Obi-Wan Kenobi"
            }
        ],
        "total_pages": 9
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:38.362Z",
        "request_id": "af0393c7-32fc-4d0b-83bd-7d3d1c5bb808"
    },
    "status": "ok",
    "message": "Resources listed",
    "success": true
}
```

#### `GET /v1/search` — Search a category by name

**Parameters:**
- `type` (query, required, string) — people | planets | starships | vehicles | species Example: `people`
- `q` (query, required, string) — Name to search, e.g. skywalker Example: `skywalker`

**Example:**
```bash
curl -H "x-oanor-key: $KEY" \
  "https://api.oanor.com/starwars-api/v1/search?type=people&q=skywalker"
```

**Response:**
```json
{
    "data": {
        "type": "people",
        "count": 3,
        "query": "skywalker",
        "results": [
            {
                "uid": "1",
                "url": "https://www.swapi.tech/api/people/1",
                "mass": "77",
                "name": "Luke Skywalker",
                "films": [
                    "https://www.swapi.tech/api/films/1",
                    "https://www.swapi.tech/api/films/2",
                    "https://www.swapi.tech/api/films/3",
                    "https://www.swapi.tech/api/films/6"
                ],
                "edited": "2026-05-31T05:22:39.375Z",
                "gender": "male",
                "height": "172",
                "created": "2026-05-31T05:22:39.375Z",
                "vehicles": [
                    "https://www.swapi.tech/api/vehicles/14",
                    "https://www.swapi.tech/api/vehicles/30"
                ],
                "eye_color": "blue",
                "homeworld": "https://www.swapi.tech/api/planets/1",
                "starships": [
                    "https://www.swapi.tech/api/starships/12",
                    "https://www.swapi.tech/api/starships/22"
                ],
                "birth_year": "19BBY",
                "hair_color": "blond",
                "skin_color": "fair",
                "description": "A person within the Star Wars universe"
            },
            {
                "uid": "11",
                "url": "https://www.swapi.tech/api/people/1
…(truncated, see openapi.json for full schema)
```

### Meta

#### `GET /v1/meta` — Categories & usage notes

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

**Response:**
```json
{
    "data": {
        "note": "The Star Wars universe. /v1/list = a category (type=people|planets|films|starships|vehicles|species, paged; films returned whole); /v1/get = full detail by type + id (e.g. type=people&id=1 → Luke Skywalker); /v1/search = search a category by name (e.g. type=people&q=skywalker). Records carry the full SWAPI property set with cross-references.",
        "types": [
            "people",
            "planets",
            "films",
            "starships",
            "vehicles",
            "species"
        ],
        "source": "swapi.tech (Star Wars API)",
        "endpoints": [
            "/v1/list",
            "/v1/get",
            "/v1/search",
            "/v1/meta"
        ]
    },
    "meta": {
        "timestamp": "2026-06-01T00:04:38.666Z",
        "request_id": "89268484-4bc0-443e-8533-cf2c1b805b3c"
    },
    "status": "ok",
    "message": "Meta retrieved",
    "success": true
}
```


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