SWAPI API

Beginner's Pick Video / No Auth Required Beginner HTTPS CORS
Free to Use
77 B
Measured Score 0 50 100 Speed 21/30 Consistency 17/20 Security 20/20 Browser access 15/15 Transparency 4/15 TESTED 2026-09-21

Overview

SWAPI (Star Wars API) is the classic beginner-friendly API providing data on Star Wars characters, planets, starships, species, films, and vehicles. No API key is required and it returns clean JSON instantly. It is one of the most commonly used practice APIs in web development tutorials worldwide.

Beginner Tip

SWAPI is one of the best first APIs to learn with — no keys, clean JSON, and great documentation at swapi.dev. Try fetching all people with /api/people/ and follow the "next" URL to paginate through results.

Measurement Record

What actually happened when we called this API from our own infrastructure. Every value below was recorded by the request, not copied from the provider's documentation.

Request
GET https://swapi.dev/api/people/1/
Result
HTTP 200 · application/json · 647 bytes
Response time
142 ms (median of 3) · fastest 130 ms
Transport
TLSv1.3 · TLS_AES_128_GCM_SHA256 · certificate issued by Amazon
Browser CORS
Allowed — Access-Control-Allow-Origin: *
Answered
6 of 8 weekly checks (75%, since 2026-07-31)
Recorded
2026-09-21

Fields Returned

Top-level fields present in the response we captured, with the type and value we actually received.

Field Type Value received
name string Luke Skywalker
height string 172
mass string 77
hair_color string blond
skin_color string fair
eye_color string blue
birth_year string 19BBY
gender string male
homeworld string (url) https://swapi.dev/api/planets/1/
films array [1 item]
species array [0 items]
vehicles array [1 item]
starships array [1 item]
created string (date) 2014-12-09T13:50:51.644000Z

Captured Response

Captured from a real request to https://swapi.dev/api/people/1/ on 2026-09-21. Long arrays and nested objects are truncated to keep the shape readable.

JSON Response · Captured
{
  "name": "Luke Skywalker",
  "height": "172",
  "mass": "77",
  "hair_color": "blond",
  "skin_color": "fair",
  "eye_color": "blue",
  "birth_year": "19BBY",
  "gender": "male",
  "homeworld": "https://swapi.dev/api/planets/1/",
  "films": [
    "https://swapi.dev/api/films/1/"
  ],
  "species": [],
  "vehicles": [
    "https://swapi.dev/api/vehicles/14/"
  ],
  "starships": [
    "https://swapi.dev/api/starships/12/"
  ],
  "created": "2014-12-09T13:50:51.644000Z",
  "…": "(2 more fields)"
}

Field Reference

name The name of the character, planet, or starship.

Implementation Example

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://swapi.dev/api/people/1/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

How This API Fails

We deliberately sent this API a broken request and recorded exactly what came back on 2026-09-21. Knowing the shape of an error before you hit it makes error handling much easier to write.

HTTP 404 Requesting a path that does not exist application/json
{
  "detail": "Not found."
}

Common Errors & Troubleshooting

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

Trailing slash required (404 Not Found) SWAPI requires a trailing slash on all endpoint URLs.
✓ Make sure your URL ends with a slash, e.g. /api/people/1/ not /api/people/1.
Paginated results — missing data SWAPI paginates collections and only returns 10 results per page.
✓ Follow the "next" URL in the response to retrieve subsequent pages until "next" is null.
HTTPS mixed-content warning Old bookmarks or tutorials may reference http:// instead of https://.
✓ Always use https://swapi.dev/ — the HTTP version may redirect or be blocked by browsers.

Measured Score Breakdown

Live HTTP request to the API endpoint

Speed 21/30
Consistency 17/20
Security 20/20
Browser access 15/15
Transparency 4/15
Endpoint Response Time 142ms

Fully tested on Sep 21, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS YES
Category Video
Difficulty Beginner
Endpoint last called: 2026-09-21

Related Tags

Similar APIs

View All →