Skip to content


Repository files navigation


Actions Release Codecov Go Report Card GoDoc License

Wrapper for Poke API, written in Go. Supports PokeAPI v2.


Full API documentation can be found at Poke API.

Getting Started

go get
import ""




Get Berries

b := pokeapi.Resource("berry")

Get Berry

Must pass an ID (e.g. "1") or name (e.g. "cheri").

b := pokeapi.Berry("cheri")
Berry Firmness

Get Berry Firmnesses

b := pokeapi.Resource("berry-firmness")

Get Berry Firmness

Must pass an ID (e.g. "1") or name (e.g. "very-soft").

b := pokeapi.BerryFirmness("very-soft")
Berry Flavors

Get Berry Flavors

b := pokeapi.Resource("berry-flavor")

Get Berry Flavor

Must pass an ID (e.g. "1") or name (e.g. "spicy").

b := pokeapi.BerryFlavor("spicy")


Contest Types

Get Contest Types

c := pokeapi.Resource("berry")

Get Contest Type

Must pass an ID (e.g. "1") or name (e.g. "cool").

c := pokeapi.ContestType("cool")
Contest Effects

Get Contest Effects

c := pokeapi.Resource("contest-effect")

Get Contest Effect

Must pass an ID (e.g. "1").

c := pokeapi.ContestEffect("1")
Super Contest Effects

Get Super Contest Effects

c := pokeapi.Resource("super-contest-effect")

Get Super Contest Effect

Must pass an ID (e.g. "1").

c := pokeapi.SuperContestEffect("1")


Encounter Methods

Get Encounter Methods

e := pokeapi.Resource("encounter-method")

Get Encounter Method

Must pass an ID (e.g. "1") or name (e.g. "walk").

e := pokeapi.EncounterMethod("walk")
Encounter Conditions

Get Encounter Conditions

e := pokeapi.Resource("encounter-condition")

Get Encounter Condition

Must pass an ID (e.g. "1") or name (e.g. "swarm").

e := pokeapi.EncounterCondition("swarm")
Encounter Condition Values

Get Encounter Condition Values

e := pokeapi.Resource("encounter-condition-value")

Get Encounter Condition Value

Must pass an ID (e.g. "1") or name (e.g. "swarm-yes").

e := pokeapi.EncounterConditionValue("swarm-yes")


Evolution Chains

Get Evolution Chains

e := pokeapi.Resource("evolution-chain")

Get Evolution Chain

Must pass an ID (e.g. "1").

e := pokeapi.EvolutionChain("1")
Evolution Triggers

Get Evolution Triggers

e := pokeapi.Resource("evolution-trigger")

Get Evolution Trigger

Must pass an ID (e.g. "1") or name (e.g. "level-up").

e := pokeapi.EvolutionTrigger("level-up")



Get Generations

g := pokeapi.Resource("generation")

Get Generation

Must pass an ID (e.g. "1") or name (e.g. "generation-i").

g := pokeapi.Generation("generation-i")

Get All Pokedex

g := pokeapi.Resource("pokedex")

Get Single Pokedex

Must pass an ID (e.g. "1") or name (e.g. "national").

g := pokeapi.Pokedex("national")

Get Versions

g := pokeapi.Resource("version")

Get Version

Must pass an ID (e.g. "1") or name (e.g. "red").

g := pokeapi.Version("red")
Version Groups

Get Version Groups

g := pokeapi.Resource("version-group")

Get Version Group

Must pass an ID (e.g. "1") or name (e.g. "red-blue").

g := pokeapi.VersionGroup("red-blue")



Get Items

i := pokeapi.Resource("item")

Get Item

Must pass an ID (e.g. "1") or name (e.g. "master-ball").

i := pokeapi.Item("master-ball")
Item Attributes

Get Item Attributes

i := pokeapi.Resource("item-attribute")

Get Item Attribute

Must pass an ID (e.g. "1") or name (e.g. "countable").

i := pokeapi.ItemAttribute("countable")
Item Categories

Get Item Ctegories

i := pokeapi.Resource("item-category")

Get Item Category

Must pass an ID (e.g. "1") or name (e.g. "stat-boosts").

i := pokeapi.ItemCategory("stat-boosts")
Item Fling Effects

Get Item Fling Effects

i := pokeapi.Resource("item-fling-effect")

Get Item Fling Effect

Must pass an ID (e.g. "1") or name (e.g. "badly-poison").

i := pokeapi.ItemFlingEffect("badly-poison")
Item Pockets

Get Item Pockets

i := pokeapi.Resource("item-pocket")

Get Item Pocket

Must pass an ID (e.g. "1") or name (e.g. "misc").

i := pokeapi.ItemPocket("misc")



Get Locations

l := pokeapi.Resource("location")

Get Location

Must pass an ID (e.g. "1") or name (e.g. "canalave-city").

l := pokeapi.Location("canalave-city")
Location Areas

Get Location Areas

l := pokeapi.Resource("location-area")

Get Location Area

Must pass an ID (e.g. "1") or name (e.g. "canalave-city-area").

l := pokeapi.LocationArea("canalave-city-area")
Pal Park Areas

Get Pal Park Areas

l := pokeapi.Resource("pal-park-area")

Get Pal Park Area

Must pass an ID (e.g. "1") or name (e.g. "forest").

l := pokeapi.PalParkArea("forest")

Get Regions

l := pokeapi.Resource("region")

Get Region

Must pass an ID (e.g. "1") or name (e.g. "kanto").

l := pokeapi.Region("kanto")



Get Machines

m := pokeapi.Resource("machine")

Get Machine

Must pass an ID (e.g. "1").

m := pokeapi.Machine("1")



Get Moves

m := pokeapi.Resource("move")

Get Move

Must pass an ID (e.g. "1") or name (e.g. "pound").

m := pokeapi.Move("pound")
Move Ailments

Get Move Ailments

m := pokeapi.Resource("move-ailment")

Get Move Ailment

Must pass an ID (e.g. "1") or name (e.g. "paralysis").

m := pokeapi.MoveAilment("paralysis")
Move Battle Styles

Get Move Battle Styles

m := pokeapi.Resource("move-battle-style")

Get Move Battle Style

Must pass an ID (e.g. "1") or name (e.g. "attack").

m := pokeapi.MoveBattleStyle("attack")
Move Categories

Get Move Categories

m := pokeapi.Resource("move-catgory")

Get Move Category

Must pass an ID (e.g. "1") or name (e.g. "ailment").

m := pokeapi.MoveCategory("ailment")
Move Damage Classes

Get Move Damage Classes

m := pokeapi.Resource("move-damage-class")

Get Move Damage Class

Must pass an ID (e.g. "1") or name (e.g. "status").

m := pokeapi.MoveDamageClass("status")
Move Learn Methods

Get Move Learn Methods

m := pokeapi.Resource("move-learn-method")

Get Move Learn Method

Must pass an ID (e.g. "1") or name (e.g. "level-up").

m := pokeapi.MoveLearnMethod("level-up")
Move Targets

Get Move Targets

m := pokeapi.Resource("move-target")

Get Move Target

Must pass an ID (e.g. "1") or name (e.g. "specific-move").

m := pokeapi.MoveTarget("specific-move")



Get Abilities

p := pokeapi.Resource("ability")

Get Ability

Must pass an ID (e.g. "1") or name (e.g. "stench").

p := pokeapi.Ability("stench")

Get Characteristics

p := pokeapi.Resource("characteristic")

Get Characteristic

Must pass an ID (e.g. "1").

p := pokeapi.Characteristic("1")
Egg Groups

Get Egg Groups

p := pokeapi.Resource("egg-group")

Get Egg Group

Must pass an ID (e.g. "1") or name (e.g. "monster").

p := pokeapi.EggGroup("monster")

Get Genders

p := pokeapi.Resource("gender")

Get Gender

Must pass an ID (e.g. "1") or name (e.g. "female").

p := pokeapi.Gender("female")
Growth Rates

Get Growth Rates

p := pokeapi.Resource("growth-rate")

Get Growth Rate

Must pass an ID (e.g. "1") or name (e.g. "slow").

p := pokeapi.GrowthRate("slow")

Get Natures

p := pokeapi.Resource("nature")

Get Nature

Must pass an ID (e.g. "1") or name (e.g. "hardy").

p := pokeapi.Nature("hardy")
Pokeathlon Stats

Get Pokeathlon Stats

p := pokeapi.Resource("pokeathlon-stat")

Get Pokeathlon Stat

Must pass an ID (e.g. "1") or name (e.g. "speed").

p := pokeapi.PokeathlonStat("speed")

Get All Pokemon

l := pokeapi.Resource("pokemon")

Get Single Pokemon

Must pass an ID (e.g. "1") or name (e.g. "bulbasaur").

l := pokeapi.Pokemon("bulabsaur")
Pokemon Colors

Get Pokemon Colors

p := pokeapi.Resource("pokemon-color")

Get Pokemon Color

Must pass an ID (e.g. "1") or name (e.g. "black").

p := pokeapi.PokemonColor("black")
Pokemon Forms

Get Pokemon Forms

p := pokeapi.Resource("pokemon-form")

Get Pokemon Form

Must pass an ID (e.g. "1") or name (e.g. "bulbasaur").

p := pokeapi.PokemonForm("bulabsaur")
Pokemon Habitats

Get Pokemon Habitats

p := pokeapi.Resource("pokemon-habitat")

Get Pokemon Habitat

Must pass an ID (e.g. "1") or name (e.g. "cave").

p := pokeapi.PokemonHabitat("cave")
Pokemon Shapes

Get Pokemon Shapes

p := pokeapi.Resource("pokemon-shape")

Get Pokemon Shape

Must pass an ID (e.g. "1") or name (e.g. "ball").

p := pokeapi.PokemonShape("ball")
Pokemon Species

Get All Pokemon Species

p := pokeapi.Resource("pokemon-species")

Get Single Pokemon Species

Must pass an ID (e.g. "1") or name (e.g. "bulbasaur").

p := pokeapi.PokemonSpecies("bulabsaur")

Get Stats

p := pokeapi.Resource("stat")

Get Stat

Must pass an ID (e.g. "1") or name (e.g. "hp").

p := pokeapi.Stat("hp")

Get Types

p := pokeapi.Resource("type")

Get Type

Must pass an ID (e.g. "1") or name (e.g. "normal").

p := pokeapi.Type("normal")



Get Languages

u := pokeapi.Resource("language")

Get Language

Must pass an ID (e.g. "1") or name (e.g. "en").

u := pokeapi.Language("en")

Additional Options

Resource List Parameters

When calling pokeapi.Resource() for any resource list, you can optionally pass up to two integers. The first will be an offset (defaults to zero), and the second will be the limit (defaults two twenty).

r := pokeapi.Resource("pokemon")
fmt.Println(len(r.Results)) // 20
fmt.Println(r.Results[0].Name) // "bulbasaur"
r := pokeapi.Resource("pokemon", 3)
fmt.Println(len(r.Results)) // 20
fmt.Println(r.Results[0].Name) // "charmander"
Offset and Limit
r := pokeapi.Resource("pokemon", 6, 10)
fmt.Println(len(r.Results)) // 10
fmt.Println(r.Results[0].Name) // "squirtle"

Resource List Filters

As an alternative to pokeapi.Resource(), you can use Search to filter resource lists. Pass the endpoint, followed by the search term. Or pass a string starting with ^ to search for items starting with the search team.

result.Count is updated after the search with the new total (to get the full count, use pokeapi.Resource().

s := pokeapi.Search("pokemon", "saur")
fmt.Println(len(s.Results)) // 4
fmt.Println(s.Results[3].Name) // venusaur-mega
Starts With
s := pokeapi.Search("pokemon", "^a")
fmt.Println(len(s.Results)) // 44
fmt.Println(s.Results[0].Name) // arbok
s := pokeapi.Search("pokemon", "^bulb")
fmt.Println(len(s.Results)) // 1
fmt.Println(s.Results[0].Name) // bulbasaur


Calls are automatically cached to cut down on API traffic to PokeAPI, with subsequent calls returning local data.

Clearing Cache

// Clear all existing cache entries.

Custom Expiration

Custom cache expiration remains for all calls until changed or unset.

// Set cache expiration to twenty minutes.
pokeapi.CacheSettings.CustomExpire = 20
// Turn custom expiration back off.
pokeapi.CacheSettings.CustomExpire = 0

Disable Cache

Please be considerate of PokeAPI and be sure to always operate within this requested limits.

As with custom expiration, this setting remains for all calls until changed or unset.

// Disable checking for cached data
pokeapi.CacheSettings.UseCache = false
// Re-enable checking for cached data
pokeapi.CacheSettings.UseCache = true