Star Wars API
Documentation

Introduction

Welcome to the Star Wars API documentation! This API demonstrates the Backend for Frontend (BFF) pattern, making it easy to build Star Wars-themed applications without multiple waterfall requests.

Documentation Structure

Getting Started

Essential concepts to begin using the API

Advanced

Deep dive into technical details
TypeScript Types (coming soon)Zod Validation (coming soon)

Quick Example

Get all Jedi with their homeworlds in a single request:

Request
GET https://sw-next-api.vercel.app/api/v1/people?isJedi=true&expand=homeworld

Response Structure

All list endpoints return paginated responses
{
  "page": 1,
  "limit": 10,
  "total": 15,
  "pages": 2,
  "results": [
    {
      "entityId": 1,
      "id": "luke-skywalker",
      "name": "Luke Skywalker",
      "homeworld": {
        "entityId": 1,
        "id": "tatooine",
        "name": "Tatooine",
        "climate": "arid",
        "terrain": "desert"
      },
      "meta": {
        "isJedi": true,
        "faction": "rebels"
      }
    }
  ]
}

Key Features

Expand

Controlled Expansion

Request related data in a single call. Supports nested expansion up to 2 levels deep.

Learn more →

Filter

Advanced Filtering

Filter by any field including custom metadata like Force abilities and faction allegiance.

Learn more →

Sort

Flexible Sorting

Sort results by any field in ascending or descending order.

Learn more →

Common Use Cases

Get all Jedi characters sorted alphabetically with their homeworld data

Request
GET https://sw-next-api.vercel.app/api/v1/people?isJedi=true&sort=name&expand=homeworld