SWAPI - Star Wars API Starships API

Hyperdrive-capable starships (X-wings, Star Destroyers, Death Stars).

OpenAPI Specification

swapi-starships-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: SWAPI - Star Wars Films Starships API
  description: "SWAPI (Star Wars API) is a free, open Star Wars REST API. It exposes canonical\nStar Wars data — films, people, planets, species, starships, and vehicles — across\nthe original and prequel trilogies and the Clone Wars era. SWAPI is widely used\nas a teaching API for REST clients, framework demos, MCP server tutorials, and\nJSON parser benchmarks.\n\nTwo community mirrors are commonly used:\n  - swapi.dev   (Python/Django port maintained by @juriy)\n  - www.swapi.tech (Node/MongoDB port maintained by @semperry)\n\nThe original swapi.co project (by Paul Hallett / @phalt) is no longer maintained.\nThis OpenAPI describes the swapi.dev surface, which preserves the canonical SWAPI\nresponse shape (count / next / previous / results paginators and the flat resource\nschemas). The swapi.tech mirror wraps the same payloads inside `result.properties`.\n"
  version: '1.0'
  termsOfService: https://swapi.dev/
  contact:
    name: SWAPI Community
    url: https://github.com/Juriy/swapi
  license:
    name: BSD-3-Clause
    url: https://github.com/Juriy/swapi/blob/master/LICENSE
  x-generated-from: documentation
  x-last-validated: '2026-05-29'
servers:
- url: https://swapi.dev/api
  description: swapi.dev — Python/Django mirror (primary)
- url: https://www.swapi.tech/api
  description: swapi.tech — Node/MongoDB mirror (alternate)
tags:
- name: Starships
  description: Hyperdrive-capable starships (X-wings, Star Destroyers, Death Stars).
paths:
  /starships/:
    get:
      tags:
      - Starships
      operationId: listStarships
      summary: List All Starships
      description: Returns a paginated list of hyperdrive-capable starships.
      parameters:
      - $ref: '#/components/parameters/SearchParam'
      - $ref: '#/components/parameters/PageParam'
      responses:
        '200':
          description: A page of starships.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StarshipList'
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
  /starships/{id}/:
    get:
      tags:
      - Starships
      operationId: getStarship
      summary: Get Starship By Id
      description: Returns a single starship by its numeric SWAPI id.
      parameters:
      - $ref: '#/components/parameters/IdParam'
      responses:
        '200':
          description: A single starship resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Starship'
        '404':
          $ref: '#/components/responses/NotFound'
      x-microcks-operation:
        delay: 0
        dispatcher: FALLBACK
components:
  parameters:
    IdParam:
      name: id
      in: path
      required: true
      description: Numeric SWAPI identifier for the resource.
      schema:
        type: integer
        minimum: 1
        example: 1
    PageParam:
      name: page
      in: query
      required: false
      description: One-based page number for paginated list responses (10 items per page).
      schema:
        type: integer
        minimum: 1
        example: 1
    SearchParam:
      name: search
      in: query
      required: false
      description: Case-insensitive partial match against the resource's main name/title field.
      schema:
        type: string
        example: luke
  schemas:
    StarshipList:
      allOf:
      - $ref: '#/components/schemas/Pagination'
      - type: object
        properties:
          results:
            type: array
            items:
              $ref: '#/components/schemas/Starship'
    Starship:
      type: object
      description: A hyperdrive-capable starship.
      required:
      - name
      - url
      properties:
        name:
          type: string
          example: Death Star
        model:
          type: string
          example: DS-1 Orbital Battle Station
        manufacturer:
          type: string
        cost_in_credits:
          type: string
        length:
          type: string
          description: Length of the starship in meters.
        max_atmosphering_speed:
          type: string
        crew:
          type: string
        passengers:
          type: string
        cargo_capacity:
          type: string
          description: Maximum cargo this starship can transport in kilograms.
        consumables:
          type: string
          description: Maximum length of time the starship can provide consumables for its entire crew without resupply.
        hyperdrive_rating:
          type: string
        MGLT:
          type: string
          description: Maximum number of Megalights this starship can travel in a standard hour.
        starship_class:
          type: string
          example: Deep Space Mobile Battlestation
        pilots:
          type: array
          items:
            type: string
            format: uri
        films:
          type: array
          items:
            type: string
            format: uri
        created:
          type: string
          format: date-time
        edited:
          type: string
          format: date-time
        url:
          type: string
          format: uri
    Pagination:
      type: object
      required:
      - count
      - results
      properties:
        count:
          type: integer
          description: Total number of resources in the collection.
          example: 82
        next:
          type: string
          nullable: true
          format: uri
          description: URL of the next page, or null if this is the last page.
          example: https://swapi.dev/api/people/?page=2
        previous:
          type: string
          nullable: true
          format: uri
          description: URL of the previous page, or null if this is the first page.
          example: null
    Error:
      type: object
      properties:
        detail:
          type: string
          example: Not found.
  responses:
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
externalDocs:
  description: SWAPI Documentation (swapi.dev)
  url: https://swapi.dev/documentation