Information about the kinds of people who live near a specific location can be retrieved using the v1/demographics
and v2/demographics
endpoints. These endpoints take a lat
/lng
coordinate pair as inputs, and returns a wide range of demographic variables, organized by categories.
The demographic data returned describes residents who live within a five-minute walk of the given address and can be retrieved using a latitude/longitude request.
All populated areas in Canada and the US (50 states + District of Columbia) are covered.
GET v3/demographics
Type | Canada | USA |
---|---|---|
Household Income | ✅ | ✅ |
Individual income | ✅ | · |
Commute mode | ✅ | ✅ |
Household composition | ✅ | ✅ |
Population age | ✅ | ✅ |
Housing tenancy | ✅ | ✅ |
Language knowledge | ✅ | · |
Education | ✅ | ✅ |
Housing type | ✅ | ✅ |
Family composition | ✅ | · |
Mother tongue | ✅ | · |
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.
Header | Status | Description |
---|---|---|
Authorization | required | Your bearer token retrieved from our authorization API, ex. Bearer eyJhbGci... |
Accept | required | The datatype to request, this API will return application/json . |
Parameter | Status | Description |
---|---|---|
lat | required | A decimal number between -90 and 90 (Latitude) |
lng | required | A decimal number between -180 and 180 (Longitude) |
lang | optional | The language that demographic variable labels will be returned in. Available: en , fr . Default: en |
require('node-fetch')('https://api.locallogic.co/v3/demographics?' + new URLSearchParams({lat: 41.847206,lng: -87.668825,lang: 'en',}), {method: 'GET',headers: {Accept: 'application/json',Authorization: 'Bearer eyJhbGciOiJ...'}}).then(response => response.json()).then(body => {console.log(body)}).catch(error => {console.log(error)})
import requestsresponse = requests.get("https://api.locallogic.co/v3/demographics",headers={"Accept": "application/json","Authorization": "Bearer eyJhbGciOiJ..."},params={"lat": 45.5017,"lng": -73.5656,"lang": "en"})print(response.json())# See response example below
{"data": {"type": "demographics","attributes": {"income": {"label": "Income","type": "standalone","variables": [{"variable": "avg_household_income","value": 88555.1858,"label": "Average household income"},{"variable": "avg_individual_income","value": 39706.2035,"label": "Average individual income"}]},"commute_mode": {"label": "Commute mode","type": "percent","variables": [{"variable": "transit","value": 0.3483,"label": "Public transit"},{"variable": "foot","value": 0.271,"label": "Foot"},{"variable": "bicycle","value": 0.115,"label": "Bicycle"},{"variable": "drive","value": 0.2339,"label": "Car"},{"variable": "other","value": 0.0318,"label": "Other"}]}}}}
In the above example of returned data, there are two categories of demographic data (“Income” and “Commute mode”). These categories have the following fields:
label
type: which can be either of the following:
percent
: this category’s variables are directly related; their values are percentages and theoretically should add up to 1.0 (100%). In practice, values may not add to 100% in all cases due to rounding.standalone
: this category’s variables are separate valuesvariables: A list of several variables for the category, each with the following:
variable
, a programmatic key that will be constant regardless of languagevalue
, the actual demographic valuelabel
, a language-specific description which can be used for display purposesIn the above example:
The average household income of the surrounding area is $88,555The average individual income is $39,70634.8% of people commute by transit27.1% of people commute by foot11.5% of people commute by bicycle23.4% of people commute by car3.2% of people commute by other modes
GET v2/demographics
Type | Canada | USA |
---|---|---|
Household Income | ✅ | ✅ |
Individual income | ✅ | · |
Commute mode | ✅ | ✅ |
Household composition | ✅ | ✅ |
Population age | ✅ | ✅ |
Housing tenancy | ✅ | ✅ |
Language knowledge | ✅ | · |
Education | ✅ | ✅ |
Housing type | ✅ | ✅ |
Family composition | ✅ | · |
Mother tongue | ✅ | · |
Parameter | Status | Description |
---|---|---|
lat | required | A decimal number between -90 and 90 (Latitude) |
lng | required | A decimal number between -180 and 180 (Longitude) |
key | required | The API Key provided for you |
lang | optional | The language that demographic variable labels will be returned in. Available: en , fr . Default: en |
require('request')({method: 'GET',url: 'https://api.locallogic.co/v2/demographics', // note the v2qs: {lat: 45.5017,lng: -73.5656,key: 'YOUR_API_KEY'}}, function (err, response, body) {// See response example})
{"data": {"type": "Demographics","attributes": {"income": {"label": "Income","type": "standalone","variables": [{"variable": "avg_household_income","value": 88555.1858,"label": "Average household income"},{"variable": "avg_individual_income","value": 39706.2035,"label": "Average individual income"}]},"commute_mode": {"label": "Commute mode","type": "percent","variables": [{"variable": "transit","value": 0.3483,"label": "Public transit"},{"variable": "foot","value": 0.271,"label": "Foot"},{"variable": "bicycle","value": 0.115,"label": "Bicycle"},{"variable": "drive","value": 0.2339,"label": "Car"},{"variable": "other","value": 0.0318,"label": "Other"}]}}}}
In the above example of returned data, there are two categories of demographic data (“Income” and “Commute mode”). These categories have the following fields:
label
type: which can be either of the following:
percent
: this category’s variables are directly related; their values are percentages and theoretically should add up to 1.0 (100%). In practice, values may not add to 100% in all cases due to rounding.standalone
: this category’s variables are separate valuesvariables: A list of several variables for the category, each with the following:
variable
, a programmatic key that will be constant regardless of languagevalue
, the actual demographic valuelabel
, a language-specific description which can be used for display purposesIn the above example:
The average household income of the surrounding area is $88,555The average individual income is $39,70634.8% of people commute by transit27.1% of people commute by foot11.5% of people commute by bicycle23.4% of people commute by car3.2% of people commute by other modes