{
  "openapi" : "3.1.0",
  "components" : {
    "schemas" : {
      "Film" : {
        "type" : "object",
        "description" : "A single Star Wars film",
        "properties" : {
          "title" : {
            "type" : "string",
            "description" : "Title of this film"
          },
          "episode_id" : {
            "type" : "integer",
            "format" : "int32",
            "description" : "Episode number of this film in the saga"
          },
          "opening_crawl" : {
            "type" : "string",
            "description" : "Opening crawl text at the beginning of this film"
          },
          "director" : {
            "type" : "string",
            "description" : "Director of this film"
          },
          "producer" : {
            "type" : "string",
            "description" : "Producer(s) of this film, comma-separated"
          },
          "release_date" : {
            "type" : "string",
            "description" : "Release date (ISO 8601 date) at original creator country"
          },
          "characters" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the people resources that appear in this film"
          },
          "planets" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the planet resources that appear in this film"
          },
          "starships" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the starship resources that appear in this film"
          },
          "vehicles" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the vehicle resources that appear in this film"
          },
          "species" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the species resources that appear in this film"
          },
          "created" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was created"
          },
          "edited" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was last edited"
          },
          "url" : {
            "type" : "string",
            "description" : "Canonical URL of this resource, built from the request's base URL"
          }
        }
      },
      "People" : {
        "type" : "object",
        "description" : "A person within the Star Wars universe",
        "properties" : {
          "name" : {
            "type" : "string",
            "description" : "Name of this person"
          },
          "height" : {
            "type" : "string",
            "description" : "Height in centimeters, as a string; \"unknown\" when not recorded"
          },
          "mass" : {
            "type" : "string",
            "description" : "Mass in kilograms, as a string; \"unknown\" when not recorded"
          },
          "hair_color" : {
            "type" : "string",
            "description" : "Hair color; \"n/a\" when the person has no hair"
          },
          "skin_color" : {
            "type" : "string",
            "description" : "Skin color"
          },
          "eye_color" : {
            "type" : "string",
            "description" : "Eye color"
          },
          "birth_year" : {
            "type" : "string",
            "description" : "Birth year, relative to the Battle of Yavin (BBY/ABY), e.g. \"19BBY\""
          },
          "gender" : {
            "type" : "string",
            "description" : "Gender; \"n/a\" for droids"
          },
          "homeworld" : {
            "type" : "string",
            "description" : "URL of the planet resource this person was born on"
          },
          "films" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the film resources this person appeared in"
          },
          "species" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the species resources this person belongs to"
          },
          "starships" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the starship resources this person has piloted"
          },
          "created" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was created"
          },
          "edited" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was last edited"
          },
          "url" : {
            "type" : "string",
            "description" : "Canonical URL of this resource, built from the request's base URL"
          }
        }
      },
      "Planet" : {
        "type" : "object",
        "description" : "A planet in the Star Wars universe",
        "properties" : {
          "name" : {
            "type" : "string",
            "description" : "Name of this planet"
          },
          "rotation_period" : {
            "type" : "string",
            "description" : "Rotation period in standard hours, as a string"
          },
          "orbital_period" : {
            "type" : "string",
            "description" : "Orbital period in standard days, as a string"
          },
          "diameter" : {
            "type" : "string",
            "description" : "Diameter in kilometers, as a string"
          },
          "climate" : {
            "type" : "string",
            "description" : "Climate(s), comma-separated"
          },
          "gravity" : {
            "type" : "string",
            "description" : "Gravity, where \"1 standard\" is Earth-like, e.g. \"1 standard\", \"2.5 standard\""
          },
          "terrain" : {
            "type" : "string",
            "description" : "Terrain type(s), comma-separated"
          },
          "surface_water" : {
            "type" : "string",
            "description" : "Percentage of the surface covered by water, as a string"
          },
          "population" : {
            "type" : "string",
            "description" : "Average population; \"unknown\" when not recorded"
          },
          "residents" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the people resources that live on this planet"
          },
          "films" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the film resources this planet appeared in"
          },
          "created" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was created"
          },
          "edited" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was last edited"
          },
          "url" : {
            "type" : "string",
            "description" : "Canonical URL of this resource, built from the request's base URL"
          }
        }
      },
      "Specie" : {
        "type" : "object",
        "description" : "A species in the Star Wars universe",
        "properties" : {
          "name" : {
            "type" : "string",
            "description" : "Name of this species"
          },
          "classification" : {
            "type" : "string",
            "description" : "Classification, e.g. \"mammal\", \"reptile\""
          },
          "designation" : {
            "type" : "string",
            "description" : "Designation, e.g. \"sentient\""
          },
          "average_height" : {
            "type" : "string",
            "description" : "Average height in centimeters, as a string"
          },
          "skin_colors" : {
            "type" : "string",
            "description" : "Common skin colors, comma-separated; \"none\" when skinless"
          },
          "hair_colors" : {
            "type" : "string",
            "description" : "Common hair colors, comma-separated; \"none\" when hairless"
          },
          "eye_colors" : {
            "type" : "string",
            "description" : "Common eye colors, comma-separated"
          },
          "average_lifespan" : {
            "type" : "string",
            "description" : "Average lifespan in standard years, as a string"
          },
          "homeworld" : {
            "type" : "string",
            "description" : "URL of the planet resource this species originates from"
          },
          "language" : {
            "type" : "string",
            "description" : "Language commonly spoken by this species"
          },
          "people" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the people resources that belong to this species"
          },
          "films" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the film resources this species appeared in"
          },
          "created" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was created"
          },
          "edited" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was last edited"
          },
          "url" : {
            "type" : "string",
            "description" : "Canonical URL of this resource, built from the request's base URL"
          }
        }
      },
      "Starship" : {
        "type" : "object",
        "description" : "A starship (transport with hyperdrive) in the Star Wars universe",
        "properties" : {
          "name" : {
            "type" : "string",
            "description" : "Common name of this starship"
          },
          "model" : {
            "type" : "string",
            "description" : "Model or official name, e.g. \"T-65 X-wing\""
          },
          "manufacturer" : {
            "type" : "string",
            "description" : "Manufacturer(s), comma-separated"
          },
          "cost_in_credits" : {
            "type" : "string",
            "description" : "Cost in galactic credits, as a string"
          },
          "length" : {
            "type" : "string",
            "description" : "Length in meters, as a string"
          },
          "max_atmosphering_speed" : {
            "type" : "string",
            "description" : "Maximum speed in atmosphere; \"n/a\" when incapable of atmospheric flight"
          },
          "crew" : {
            "type" : "string",
            "description" : "Number of personnel needed to run or pilot this starship"
          },
          "passengers" : {
            "type" : "string",
            "description" : "Number of non-essential people this starship can transport"
          },
          "cargo_capacity" : {
            "type" : "string",
            "description" : "Maximum cargo capacity in kilograms, as a string"
          },
          "consumables" : {
            "type" : "string",
            "description" : "Maximum time this starship can provide consumables for its crew"
          },
          "hyperdrive_rating" : {
            "type" : "string",
            "description" : "Hyperdrive rating class"
          },
          "MGLT" : {
            "type" : "string",
            "description" : "Maximum speed in megalights per hour"
          },
          "starship_class" : {
            "type" : "string",
            "description" : "Class of this starship, e.g. \"Starfighter\""
          },
          "pilots" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the people resources that have piloted this starship"
          },
          "films" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the film resources this starship appeared in"
          },
          "created" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was created"
          },
          "edited" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was last edited"
          },
          "url" : {
            "type" : "string",
            "description" : "Canonical URL of this resource, built from the request's base URL"
          }
        }
      },
      "Vehicle" : {
        "type" : "object",
        "description" : "A vehicle (transport without hyperdrive) in the Star Wars universe",
        "properties" : {
          "name" : {
            "type" : "string",
            "description" : "Common name of this vehicle"
          },
          "model" : {
            "type" : "string",
            "description" : "Model or official name, e.g. \"All-Terrain Attack Transport\""
          },
          "manufacturer" : {
            "type" : "string",
            "description" : "Manufacturer(s), comma-separated"
          },
          "cost_in_credits" : {
            "type" : "string",
            "description" : "Cost in galactic credits, as a string"
          },
          "length" : {
            "type" : "string",
            "description" : "Length in meters, as a string"
          },
          "max_atmosphering_speed" : {
            "type" : "string",
            "description" : "Maximum speed in atmosphere"
          },
          "crew" : {
            "type" : "string",
            "description" : "Number of personnel needed to run or pilot this vehicle"
          },
          "passengers" : {
            "type" : "string",
            "description" : "Number of non-essential people this vehicle can transport"
          },
          "cargo_capacity" : {
            "type" : "string",
            "description" : "Maximum cargo capacity in kilograms, as a string"
          },
          "consumables" : {
            "type" : "string",
            "description" : "Maximum time this vehicle can provide consumables for its crew"
          },
          "vehicle_class" : {
            "type" : "string",
            "description" : "Class of this vehicle, e.g. \"Wheeled\""
          },
          "pilots" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the people resources that have piloted this vehicle"
          },
          "films" : {
            "type" : "array",
            "items" : {
              "type" : "string"
            },
            "description" : "URLs of the film resources this vehicle appeared in"
          },
          "created" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was created"
          },
          "edited" : {
            "type" : "string",
            "description" : "ISO 8601 timestamp of when this resource was last edited"
          },
          "url" : {
            "type" : "string",
            "description" : "Canonical URL of this resource, built from the request's base URL"
          }
        }
      }
    }
  },
  "tags" : [ {
    "name" : "Films",
    "description" : "Star Wars films"
  }, {
    "name" : "People",
    "description" : "People within the Star Wars universe"
  }, {
    "name" : "Planets",
    "description" : "Planets in the Star Wars universe"
  }, {
    "name" : "Root",
    "description" : "API entry point"
  }, {
    "name" : "Species",
    "description" : "Species in the Star Wars universe"
  }, {
    "name" : "Starships",
    "description" : "Starships in the Star Wars universe"
  }, {
    "name" : "Vehicles",
    "description" : "Vehicles in the Star Wars universe"
  } ],
  "paths" : {
    "/api" : {
      "get" : {
        "summary" : "List all available resources",
        "description" : "Returns the URLs of every resource collection, built from the request's base URL.",
        "tags" : [ "Root" ],
        "responses" : {
          "200" : {
            "description" : "Map of resource name to collection URL",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/films" : {
      "get" : {
        "summary" : "List all films",
        "description" : "Returns every film, or only those whose title matches the search query.",
        "tags" : [ "Films" ],
        "parameters" : [ {
          "description" : "Filter by title (case-insensitive contains)",
          "example" : "hope",
          "name" : "search",
          "in" : "query",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "List of films",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/Film"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/films/random" : {
      "get" : {
        "summary" : "Get a random film",
        "tags" : [ "Films" ],
        "responses" : {
          "200" : {
            "description" : "A randomly selected film",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Film"
                }
              }
            }
          }
        }
      }
    },
    "/api/films/{id}" : {
      "get" : {
        "summary" : "Get a film by id",
        "tags" : [ "Films" ],
        "parameters" : [ {
          "description" : "Numeric id of the film",
          "example" : 1,
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "The film with the given id",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Film"
                }
              }
            }
          },
          "404" : {
            "description" : "No film exists with the given id",
            "content" : {
              "text/plain" : { }
            }
          }
        }
      }
    },
    "/api/people" : {
      "get" : {
        "summary" : "List all people",
        "description" : "Returns every person, or only those whose name matches the search query.",
        "tags" : [ "People" ],
        "parameters" : [ {
          "description" : "Filter by name (case-insensitive contains)",
          "example" : "luke",
          "name" : "search",
          "in" : "query",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "List of people",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/People"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/people/random" : {
      "get" : {
        "summary" : "Get a random person",
        "tags" : [ "People" ],
        "responses" : {
          "200" : {
            "description" : "A randomly selected person",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/People"
                }
              }
            }
          }
        }
      }
    },
    "/api/people/{id}" : {
      "get" : {
        "summary" : "Get a person by id",
        "tags" : [ "People" ],
        "parameters" : [ {
          "description" : "Numeric id of the person",
          "example" : 1,
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "The person with the given id",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/People"
                }
              }
            }
          },
          "404" : {
            "description" : "No person exists with the given id",
            "content" : {
              "text/plain" : { }
            }
          }
        }
      }
    },
    "/api/planets" : {
      "get" : {
        "summary" : "List all planets",
        "description" : "Returns every planet, or only those whose name matches the search query.",
        "tags" : [ "Planets" ],
        "parameters" : [ {
          "description" : "Filter by name (case-insensitive contains)",
          "example" : "tatooine",
          "name" : "search",
          "in" : "query",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "List of planets",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/Planet"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/planets/random" : {
      "get" : {
        "summary" : "Get a random planet",
        "tags" : [ "Planets" ],
        "responses" : {
          "200" : {
            "description" : "A randomly selected planet",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Planet"
                }
              }
            }
          }
        }
      }
    },
    "/api/planets/{id}" : {
      "get" : {
        "summary" : "Get a planet by id",
        "tags" : [ "Planets" ],
        "parameters" : [ {
          "description" : "Numeric id of the planet",
          "example" : 1,
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "The planet with the given id",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Planet"
                }
              }
            }
          },
          "404" : {
            "description" : "No planet exists with the given id",
            "content" : {
              "text/plain" : { }
            }
          }
        }
      }
    },
    "/api/species" : {
      "get" : {
        "summary" : "List all species",
        "description" : "Returns every species, or only those whose name matches the search query.",
        "tags" : [ "Species" ],
        "parameters" : [ {
          "description" : "Filter by name (case-insensitive contains)",
          "example" : "wookiee",
          "name" : "search",
          "in" : "query",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "List of species",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/Specie"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/species/random" : {
      "get" : {
        "summary" : "Get a random species",
        "tags" : [ "Species" ],
        "responses" : {
          "200" : {
            "description" : "A randomly selected species",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Specie"
                }
              }
            }
          }
        }
      }
    },
    "/api/species/{id}" : {
      "get" : {
        "summary" : "Get a species by id",
        "tags" : [ "Species" ],
        "parameters" : [ {
          "description" : "Numeric id of the species",
          "example" : 1,
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "The species with the given id",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Specie"
                }
              }
            }
          },
          "404" : {
            "description" : "No species exists with the given id",
            "content" : {
              "text/plain" : { }
            }
          }
        }
      }
    },
    "/api/starships" : {
      "get" : {
        "summary" : "List all starships",
        "description" : "Returns every starship, or only those whose name matches the search query.",
        "tags" : [ "Starships" ],
        "parameters" : [ {
          "description" : "Filter by name (case-insensitive contains)",
          "example" : "falcon",
          "name" : "search",
          "in" : "query",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "List of starships",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/Starship"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/starships/random" : {
      "get" : {
        "summary" : "Get a random starship",
        "tags" : [ "Starships" ],
        "responses" : {
          "200" : {
            "description" : "A randomly selected starship",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Starship"
                }
              }
            }
          }
        }
      }
    },
    "/api/starships/{id}" : {
      "get" : {
        "summary" : "Get a starship by id",
        "tags" : [ "Starships" ],
        "parameters" : [ {
          "description" : "Numeric id of the starship",
          "example" : 2,
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "The starship with the given id",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Starship"
                }
              }
            }
          },
          "404" : {
            "description" : "No starship exists with the given id",
            "content" : {
              "text/plain" : { }
            }
          }
        }
      }
    },
    "/api/vehicles" : {
      "get" : {
        "summary" : "List all vehicles",
        "description" : "Returns every vehicle, or only those whose name matches the search query.",
        "tags" : [ "Vehicles" ],
        "parameters" : [ {
          "description" : "Filter by name (case-insensitive contains)",
          "example" : "speeder",
          "name" : "search",
          "in" : "query",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "List of vehicles",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "array",
                  "items" : {
                    "$ref" : "#/components/schemas/Vehicle"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/vehicles/random" : {
      "get" : {
        "summary" : "Get a random vehicle",
        "tags" : [ "Vehicles" ],
        "responses" : {
          "200" : {
            "description" : "A randomly selected vehicle",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Vehicle"
                }
              }
            }
          }
        }
      }
    },
    "/api/vehicles/{id}" : {
      "get" : {
        "summary" : "Get a vehicle by id",
        "tags" : [ "Vehicles" ],
        "parameters" : [ {
          "description" : "Numeric id of the vehicle",
          "example" : 4,
          "name" : "id",
          "in" : "path",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "The vehicle with the given id",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/Vehicle"
                }
              }
            }
          },
          "404" : {
            "description" : "No vehicle exists with the given id",
            "content" : {
              "text/plain" : { }
            }
          }
        }
      }
    }
  },
  "info" : {
    "title" : "swapi.build — Star Wars API",
    "version" : "2.2.0",
    "description" : "RESTful public API with data about the Star Wars universe. All successful GETs return 200; nonexistent ids return 404. The same data is also exposed as an MCP server (Streamable HTTP) at /mcp.",
    "license" : {
      "name" : "Apache 2.0",
      "url" : "https://www.apache.org/licenses/LICENSE-2.0"
    }
  }
}