Skip to content

Geographies

Stable
Available in the US and Canada

GET v3/geographies

Use this endpoint to retrieve the names and IDs of geographies (e.g. neighbourhoods, cities) associated with a specific location (lat/lng). The geography IDs (e.g. g10_f25dyhcn) in the returned dictionary can be used to query the Local Profiles, and Scores APIs by geog_id.

GET v3/geographies

V3 Header Request Parameters

This API uses JWT token based authentication. This JWT Bearer token is what is used to populate the Authorization header below.

Instructions on how to retrieve this token can be found at Accessing the API → V3 API Authorization.

HeaderStatusDescription
AuthorizationrequiredYour bearer token retrieved from our authorization API, ex. Bearer eyJhbGci...
AcceptrequiredThe datatype to request, this API will return application/json.

V3 QueryString Request Parameters

ParameterStatusDescription
latrequiredA decimal number between -90 and 90 (Latitude)
lngrequiredA decimal number between -180 and 180 (Longitude)

V3 NodeJS example

require('node-fetch')('https://api.locallogic.co/v3/geographies?' + new URLSearchParams({
lat: 41.847206,
lng: -87.668825,
}), {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: 'Bearer eyJhbGciOiJ...'
}
})
.then(response => response.json())
.then(body => {
console.log(body)
})
.catch(error => {
console.log(error)
})

V3 200 - Response example

{
"data": {
"type": "geographies",
"geographies": {
"g10_f25dyhcn": {
"name": {
"fr": "Le Faubourg Saint-Laurent",
"en": "Le Faubourg Saint-Laurent"
},
"level_type": {
"fr": "quartier",
"en": "neighbourhood"
},
"level": 10
},
"g20_f25dyhf3": {
"name": {
"en": "Ville-Marie",
"fr": "Ville-Marie"
},
"level_type": {
"en": "borough",
"fr": "arrondissement"
},
"level": 20
},
"g30_f25dfkes": {
"name": {
"en": "Montréal",
"fr": "Montréal"
},
"level_type": {
"en": "city",
"fr": "ville"
},
"level": 30
}
}
},
"meta": {
"order": [
"g10_f25dyhcn",
"g20_f25dyhf3",
"g30_f25dfkes"
]
}
}

GET v1/geographies

⚠️ The v1/geographies API is deprecated.

Use this endpoint to retrieve the names and IDs of geographies (e.g. neighbourhoods, cities) associated with a specific location (lat/lng). The geography IDs (e.g. g10_f25dyhcn) in the returned dictionary can be used to query the Local Profiles by geog_id.

GET v1/geographies

V1 QueryString Request Parameters

ParameterStatusDescription
latrequiredA decimal number between -90 and 90 (Latitude)
lngrequiredA decimal number between -180 and 180 (Longitude)
keyrequiredThe API Key provided for you

V1 NodeJS example

require('request')({
method: 'GET',
url: 'https://api.locallogic.co/v1/geographies',
qs: {
lat: 45.5017,
lng: -73.5656,
key: 'YOUR_API_KEY'
}
}, function (err, response, body) {
// See response example
})

V1 200 - Response example

{
"data": {
"attributes": {
"g10_f25dyhcn": {
"name": {
"fr": "Le Faubourg Saint-Laurent",
"en": "Le Faubourg Saint-Laurent"
},
"level_type": {
"fr": "quartier",
"en": "neighbourhood"
},
"level": 10
},
"g20_f25dyhf3": {
"name": {
"en": "Ville-Marie",
"fr": "Ville-Marie"
},
"level_type": {
"en": "borough",
"fr": "arrondissement"
},
"level": 20
},
"g30_f25dfkes": {
"name": {
"en": "Montréal",
"fr": "Montréal"
},
"level_type": {
"en": "city",
"fr": "ville"
},
"level": 30
}
}
},
"meta": {
"order": [
"g10_f25dyhcn",
"g20_f25dyhf3",
"g30_f25dfkes"
]
}
}