Core Concepts
Master the essential features that make this API flexible and powerful. All concepts work together and can be combined in a single request.
Quick Navigation
Pagination
Control how many results you get per page and navigate through large datasets efficiently.
Parameters
pageCurrent page number (default: 1, min: 1)
limitItems per page (default: 10, min: 1, max: 100)
Basic Usage
Default (first page, 10 items):
GET https://sw-next-api.vercel.app/api/v1/people
Navigate pages with custom limit:
GET https://sw-next-api.vercel.app/api/v1/people?page=2&limit=20
Response Format
Every paginated response includes metadata:
{
"page": 2, // Current page number
"limit": 20, // Items per page
"total": 82, // Total items across all pages
"pages": 5, // Total number of pages
"results": [...] // Array of items for current page
}
Expansion
Include related data in a single request instead of making multiple requests. Maximum depth: 2 levels.
Basic Expansion
Expand one relation:
GET https://sw-next-api.vercel.app/api/v1/people/1?expand=homeworld
Expand multiple relations:
GET https://sw-next-api.vercel.app/api/v1/people/1?expand=homeworld,films
Nested Expansion
Expand relations of relations (up to 2 levels deep):
GET https://sw-next-api.vercel.app/api/v1/people/1?expand=films.characters
This expands films, and within each film, expands the characters array.
Available Expansions by Resource
People
homeworld - Home planetfilms - Films appeared inspecies - Speciesvehicles - Vehicles pilotedstarships - Starships pilotedFilms
characters - Characters in filmplanets - Planets featuredspecies - Species featuredvehicles - Vehicles featuredstarships - Starships featuredPlanets
residents - Planet residentsfilms - Films featured inSpecies
homeworld - Homeworld planetpeople - Members of speciesfilms - Films featured inFiltering
Filter results by any field to find exactly what you need.
Search by Name
Search across name/title fields:
GET https://sw-next-api.vercel.app/api/v1/people?search=skywalker
Filter by Standard Fields
Filter by any field in the response:
GET https://sw-next-api.vercel.app/api/v1/people?gender=female
Filter by Metadata
Use custom metadata fields for advanced filtering:
People metadata:
GET https://sw-next-api.vercel.app/api/v1/people?isJedi=trueGET https://sw-next-api.vercel.app/api/v1/people?isForceUser=trueGET https://sw-next-api.vercel.app/api/v1/people?faction=rebels
Starships metadata:
GET https://sw-next-api.vercel.app/api/v1/starships?is_military=trueGET https://sw-next-api.vercel.app/api/v1/starships?faction=empire
Combine Multiple Filters
All filters work together:
GET https://sw-next-api.vercel.app/api/v1/people?gender=female&faction=rebels&isForceUser=true
Filters are case-insensitive and work with partial matches for text fields. Boolean filters (isJedi, isForceUser) accept "true" or "false".
Sorting
Sort results by any field in ascending or descending order.
Ascending Order
Sort alphabetically or numerically:
GET https://sw-next-api.vercel.app/api/v1/people?sort=nameGET https://sw-next-api.vercel.app/api/v1/people?sort=heightCm
Descending Order
Use - prefix for reverse order:
GET https://sw-next-api.vercel.app/api/v1/people?sort=-nameGET https://sw-next-api.vercel.app/api/v1/people?sort=-heightCm
Common Sort Examples
People
sort=name - Alphabetical A-Zsort=-name - Alphabetical Z-Asort=heightCm - Shortest firstsort=-heightCm - Tallest firstsort=birthYearBBY - Oldest firstFilms
sort=episode - Episode ordersort=-episode - Reverse episodesort=release_year - Release ordersort=title - AlphabeticalCombining Everything
The real power comes from combining all these features in a single request:
GET https://sw-next-api.vercel.app/api/v1/people?search=skywalker&isJedi=true&sort=name&page=1&limit=5&expand=homeworld,films
This request:
- ๐ Searches for "skywalker"
- โ Filters for Jedi only
- โฌ๏ธ Sorts alphabetically by name
- ๐ Returns 5 results on page 1
- ๐ Expands homeworld and films data
Start simple and add complexity as needed. Begin with basic pagination, then add filtering, sorting, and expansion only when your UI requires it.