Skip to content
v3.0.0

API Reference

Every entity class maps one endpoint of pokeapi.co. Pass the class as the generic parameter of PokeApi.get() and the endpoint is resolved for you.

Suspending calls

PokeApi.get() and PokeApi.list() are suspend functions. Every one-liner on this page and on the 11 entity pages linked below is written exactly as it looks inside a coroutine โ€” without repeating that setup fifty times over โ€” but it will not compile at a plain call site. A real call site looks like this:

suspend fun main() {
    val pikachu = PokeApi.get<Pokemon>(name = "pikachu")
}

Calling from code with no coroutine in scope? Use the blocking counterpart instead:

val pikachu = PokeApi.getBlocking<Pokemon>(name = "pikachu")

See Methods for every get/list overload and its blocking twin.

48 endpoints are wired across 11 groups.

Asking for a class that is not mapped throws UnknownEndpointException.