SWAPI (The Star Wars API) is one of the most popular free APIs for learning REST APIs in React, Vue, or vanilla JS — but it only returns JSON text. There are no images for Luke Skywalker, Tatooine, or the Millennium Falcon.

Furthermore, the old image host frequently used in tutorials (starwars-visualguide.com) currently has broken SSL certificates, failing to load across modern browsers.

To solve this, I created a free static image API where every image matches the exact same ID used by SWAPI:

https://starwarsgallery.netlify.app/assets/{category}/{id}.jpg

It covers 238 images across 5 categories: people, planets, species, starships, and vehicles.

How to Use It (JavaScript)

 javascript const getSwapiImage = (category, swapiUrl) => { const id = swapiUrl.split('/').filter(Boolean).pop(); return `https://starwarsgallery.netlify.app/assets/${category}/${id}.jpg`; }; // Fetch data from SWAPI const res = await fetch('https://swapi.dev/api/people/1/'); const luke = await res.json(); // Get the matching image const imageUrl = getSwapiImage('people', luke.url); console.log(imageUrl); // Output: "https://starwarsgallery.netlify.app/assets/people/1.jpg"