Whether you're building a demo, running a workshop, or just learning how GraphQL works, it's always easier with real examples. While Apollo Server makes spinning up your own API smooth, sometimes you just want something ready to go.
Good news: there are several public GraphQL APIs you can use for free. Here are eight of them, complete with sample queries to get you started.
1. SpaceX API
Get information about past launches, rockets, and more.
Example Query:
{
launchesPast(limit: 10) {
mission_name
launch_date_local
launch_site {
site_name_long
}
links {
article_link
video_link
}
rocket {
rocket_name
}
}
}
2. SWAPI (Star Wars API)
For Star Wars fans. Great for showing how GraphQL handles nested relationships.
Example Query:
{
allFilms {
films {
title
}
}
}
3. Rick and Morty API
Fetch characters, episodes, and locations from the Rick and Morty universe.
Example Query:
{
characters(page: 2, filter: { name: "rick" }) {
info {
count
}
results {
name
}
}
}
4. Countries API
Get info on country names, codes, and emoji.
Example Query:
{
countries {
code
name
emoji
}
}
5. PokeAPI (GraphQL Wrapper)
All the data needed for a Pokédex. Rate-limited and free for non-commercial use.
Example Query:
{
gen1_species: pokemon_v2_pokemonspecies(
where: { pokemon_v2_generation: { name: { _eq: "generation-i" } } }
order_by: { id: asc }
) {
name
id
}
}
6. DexAPI
Another Pokémon API, fast and great for quick queries. Still in early development.
Example Query:
{
allPokemon {
name
}
}
7. Anilist API
Access thousands of anime titles. Free for non-commercial use with generous rate limits.
Example Query:
{
Page {
media {
siteUrl
title {
english
native
}
description
}
}
}
8. GitHub API
A robust API perfect for real-world GraphQL exploration. Supports queries and mutations.
Note: You’ll need a personal access token and must add an Authorization header in Apollo Explorer.
Example Query:
{
viewer {
login
repositories(last: 10) {
nodes {
name
}
}
}
}
These public APIs are perfect for practicing GraphQL without setup headaches. Whether you're exploring schema design or teaching a class, these options have you covered.
Happy Coding...
Top comments (0)