How to Get Started with PokéAPI
Updated
PokéAPI is a free, open-source RESTful API that serves Pokémon data. To start using it, send an HTTP GET request to https://pokeapi.co/api/v2/ followed by a resource path, such as pokemon/ditto or type/3, and you'll receive a JSON response. No API key or authentication is mentioned on the site, so you can begin with a browser or any HTTP client. This guide covers the base URL, your first requests, pagination, and how to explore the rest of the API.
Understand the Base URL and Response Format
Every request starts with the base resource URL:
https://pokeapi.co/api/v2/
Append a resource and identifier to it. The site's own examples include:
| Resource path | What it returns |
|---|---|
pokemon/ditto |
Data for the Pokémon Ditto |
pokemon-species/aegislash |
Species-level data for Aegislash |
type/3 |
Data for the type with ID 3 |
ability/battle-armor |
Data for the Battle Armor ability |
Responses are JSON. For example, requesting https://pokeapi.co/api/v2/pokemon/ditto returns an object containing fields such as abilities, base_experience, forms, game_indices, height, and held_items. Nested objects typically include both a name and a url, so you can follow links to related resources without guessing endpoint paths.
Make Your First Request
You can test the API in three common ways.
In a browser
Paste a full URL such as https://pokeapi.co/api/v2/pokemon/ditto into the address bar. The browser displays the raw JSON. This is the fastest way to confirm the API is reachable and to inspect the shape of a response.
With a command-line tool
Using curl:
curl https://pokeapi.co/api/v2/pokemon/ditto
The expected result is the same JSON object printed to your terminal. If you get an error instead, check that the resource path is spelled correctly.
In code
Any HTTP library works. For example, in JavaScript:
const res = await fetch("https://pokeapi.co/api/v2/pokemon/ditto");
const data = await res.json();
console.log(data.name, data.height);
The input is the URL; the action is a GET request; the expected result is a parsed JSON object you can read fields from.
Use Pagination with limit and offset
List endpoints return many records, so PokéAPI supports limit and offset query parameters. The site's hint shows a request for a very large page:
https://pokeapi.co/api/v2/pokemon?limit=100000&offset=0
limitsets how many records to return.offsetsets where to start in the list.
To page through results, request a modest limit and increase offset by that amount each time. For example, ?limit=20&offset=0, then ?limit=20&offset=20, and so on. The response for list endpoints typically includes a count of total records plus a next and previous URL, which you can follow instead of building offsets manually.
Explore the Documentation for Full Endpoint Details
The homepage only shows a handful of example paths. For the complete set of resources and the fields each returns, follow the site's "Check out the docs!" link. The docs are where you confirm:
- Which resource names exist and what identifiers they accept (names or numeric IDs).
- The full field list for each response type.
- Any nested resources you may want to fetch next.
A practical workflow is to start from a known example like pokemon/ditto, inspect the url values inside the response, and then request those URLs directly. This lets you move from a Pokémon to its abilities, forms, or game indices without memorizing the endpoint list.
Common Sticking Points
- Wrong path spelling. Resource names are lowercase and hyphenated where needed (for example,
pokemon-species,battle-armor). A typo returns an error rather than data. - Assuming a fixed schema. Fields vary by resource; always inspect the actual response before writing parsing code.
- Fetching everything at once. Large
limitvalues work, but for apps it's usually better to paginate so responses stay manageable. - Forgetting the trailing structure. The base URL ends in
/api/v2/; requests are built by appending paths to it, not by replacing it.
Once you can retrieve pokemon/ditto and page through a list endpoint, you have everything needed to explore the rest of PokéAPI using its documentation and the url links embedded in each response.