Welcome to the Pokemon API! This guide will help you get up and running quickly.
The simplest way to start is by fetching a single Pokemon using the O Query.pokemon
query GetPikachu {
pokemon(id: "025") {
name
types
stats {
hp
attack
defense
speed
}
}
}The O PokemonO Pokemon.stats
Pokemon can have one or two elemental types (E PokemonTypeE Pokemon.types
query GetTypeMatchups {
pokemon(id: "006") { # Charizard
name
types # [FIRE, FLYING]
}
waterPokemon: pokemon(id: "009") { # Blastoise
name
types # [WATER]
}
}Use the O Query.pokemonsO PokemonConnection
query ListElectricPokemon {
pokemons(
filter: { type: ELECTRIC }
limit: 5
) {
edges {
node {
name
types
stats {
speed
}
}
}
totalCount
}
}The O PokemonConnection.edgesO PokemonConnection.pageInfo
Trainers catch and train Pokemon. The O TrainerO Trainer.pokemon
query GetTrainer {
trainer(id: "ash") {
name
hometown
badges
pokemon {
name
level
types
}
}
}The S Trainer.badgesS Trainer.hometown
If you have mutation access, you can use O Mutation.catchPokemon
mutation CatchWildPokemon {
catchPokemon(input: {
pokemonId: "133" # Eevee
trainerId: "ash"
}) {
id
name
trainer {
name
}
}
}This mutation returns the updated O PokemonO Pokemon.trainer
For large datasets, use cursor-based pagination with O PageInfo
query PaginatedPokemon {
pokemons(limit: 10) {
edges {
cursor
node {
name
}
}
pageInfo {
hasNextPage
endCursor
}
}
}The S PageInfo.hasNextPageS PageInfo.endCursor