Getting Started

Welcome to the Pokemon API! This guide will help you get up and running quickly.

Your First Query

The simplest way to start is by fetching a single Pokemon using the

field:

query GetPikachu {
  pokemon(id: "025") {
    name
    types
    stats {
      hp
      attack
      defense
      speed
    }
  }
}
Loading tree-sitter...

The

type contains all the information about a Pokemon, including its
O Pokemon.stats
which provides detailed battle statistics.

Understanding Pokemon Types

Pokemon can have one or two elemental types (

enum) that determine their strengths and weaknesses. The
E Pokemon.types
field returns an array of these types:

query GetTypeMatchups {
  pokemon(id: "006") {  # Charizard
    name
    types  # [FIRE, FLYING]
  }
  
  waterPokemon: pokemon(id: "009") {  # Blastoise
    name
    types  # [WATER]
  }
}
Loading tree-sitter...

Listing Pokemon

Use the

query to browse Pokemon with filtering. This returns a
O PokemonConnection
type that supports pagination:

query ListElectricPokemon {
  pokemons(
    filter: { type: ELECTRIC }
    limit: 5
  ) {
    edges {
      node {
        name
        types
        stats {
          speed
        }
      }
    }
    totalCount
  }
}
Loading tree-sitter...

The

field contains the actual Pokemon data, while
O PokemonConnection.pageInfo
helps with pagination.

Working with Trainers

Trainers catch and train Pokemon. The

type includes information about their Pokemon team via the
O Trainer.pokemon
field:

query GetTrainer {
  trainer(id: "ash") {
    name
    hometown
    badges
    pokemon {
      name
      level
      types
    }
  }
}
Loading tree-sitter...

The

field shows their achievements, while
S Trainer.hometown
indicates where they started their journey.

Mutations: Catching Pokemon

If you have mutation access, you can use

to add Pokemon to a trainer's team:

mutation CatchWildPokemon {
  catchPokemon(input: {
    pokemonId: "133"  # Eevee
    trainerId: "ash"
  }) {
    id
    name
    trainer {
      name
    }
  }
}
Loading tree-sitter...

This mutation returns the updated

with its new
O Pokemon.trainer
relationship established.

Pagination

For large datasets, use cursor-based pagination with

:

query PaginatedPokemon {
  pokemons(limit: 10) {
    edges {
      cursor
      node {
        name
      }
    }
    pageInfo {
      hasNextPage
      endCursor
    }
  }
}
Loading tree-sitter...

The

boolean tells you if more data exists, and
S PageInfo.endCursor
provides the cursor for the next page.

Next Steps

Explore API Evolution to understand version differences
Check out Best Practices for advanced usage
Browse the API Reference for complete schema documentation
Try our Interactive Examples to experiment with queries