Skip to content

Get location

GET
/api/v2/location/{id}/
const url = 'https://pokeapi.co/api/v2/location/1/';
const options = {method: 'GET'};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}

Locations that can be visited within the games. Locations make up sizable portions of regions, like cities or routes.

id
required
string

This parameter can be a string or an integer.

Examples

Example1
Terminal window
1
Media typeapplication/json
object
id
required

The identifier for this resource.

integer
name
required

The name for this resource.

string
<= 200 characters
region
required

The region this location can be found in.

One of:
object
name
required

The name of the referenced resource.

string
<= 200 characters
url
required

The URL of the referenced resource.

string format: uri
names
required

The name of this resource listed in different languages.

Array<object>
object
name
required

The localized name for an API resource in a specific language.

string
<= 200 characters
language
required

The language this name is in.

object
name
required

The name of the referenced resource.

string
<= 200 characters
url
required

The URL of the referenced resource.

string format: uri
game_indices
required

A list of game indices relevent to this location by generation.

Array<object>
object
game_index
required

The internal id of an API resource within game data.

integer
<= 2147483647
generation
required

The generation relevent to this game index.

object
name
required

The name of the referenced resource.

string
<= 200 characters
url
required

The URL of the referenced resource.

string format: uri
areas
required

Areas that can be found within this location.

Array<object>
object
name
required

The name of the referenced resource.

string
<= 200 characters
url
required

The URL of the referenced resource.

string format: uri

Example

Terminal window
{
"id": 1,
"name": "canalave-city",
"region": {
"name": "sinnoh",
"url": "https://pokeapi.co/api/v2/region/4/"
},
"names": [
{
"name": "Canalave City",
"language": {
"name": "en",
"url": "https://pokeapi.co/api/v2/language/9/"
}
}
],
"game_indices": [
{
"game_index": 7,
"generation": {
"name": "generation-iv",
"url": "https://pokeapi.co/api/v2/generation/4/"
}
}
],
"areas": [
{
"name": "canalave-city-area",
"url": "https://pokeapi.co/api/v2/location-area/1/"
}
]
}