Skip to main content

Demographics

Stable
English and FrenchUS πŸ‡ΊπŸ‡Έ and Canada πŸ‡¨πŸ‡¦

Description​

Information about the population living around a given location or in a defined area can be retrieved using the v3/demographics endpoint.

Demographics data differs by country, but in both Canada and the United States, demographics data are available around a specific location, listing or address, or pre-aggregated according to specific borders representing neighborhoods, cities, and more, available in the Local Logic Geographies endpoint.

Data sources​

CountrySource
CanadaCensus 2021
USAAmerican Community Survey 2021

Data availability​

TypeCanadaUSA
Household Incomeβœ…βœ…
Individual incomeβœ…βŒ
Commute modeβœ…βœ…
Household compositionβœ…βœ…
Population ageβœ…βœ…
Housing tenancyβœ…βœ…
Language knowledgeβœ…βŒ
Educationβœ…βœ…
Housing typeβœ…βœ…
Mother tongueβœ…βŒ
Employment statusβŒβœ…
Children per Householdβœ…βŒ

GET v3/demographics​

The data returned describes a wide range of demographic variables, organized by categories. All populated areas in Canada and the US (50 states + District of Columbia) are covered.

GET v3/demographics

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 Getting Started.

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

QueryString​

The region to be queried by the endpoint can be defined two ways: (1) by specifying a lat/lng coordinate, with optional radius/radius_unit parameters, (2) or by providing a polygon parameter.

When using the lat/lng coordinate query method without specifying radius/radius_unit parameters, the endpoint will return data for residents living within a five minute walk of the coordinate. When including radius/radius_unit parameters, the resulting circular area around the lat/lng coordinate will be queried. radius_unit can be either meter or mile.

When using the polygon query method, the demographic data returned will cover residents of the region defined by the polygon area. Polygons are specified using the WKT format. The only accepted type is POLYGON, and holes are not supported. Each polygon point must be defined as a lng/lat coordinate.

API Limitations

  1. The polygon query string has been limited to 5000 chars.
  2. The max north/south east/west distance accepted is 0.5 degrees.
  3. The max count of north/south east/west level 6 geohashes is 1000.

Output Attributes and Sub-Variables​

AttributeVariableTypeDescription
commute_modeCommute mode
commute_modebicyclepercentBicycle
commute_modedrivepercentCar
commute_modefootpercentFoot
commute_modeotherpercentOther
commute_modetransitpercentPublic transit
education_levelHighest level of education achieved
education_levelbachelor_degreepercentBachelor degree
education_levelcollege_certificatepercentCollege certificate
education_levelhigh_schoolpercentHigh school
education_levelno_high_schoolpercentDid not graduate high school
education_levelpost_graduate_degreepercentPost graduate degree
education_leveltrade_certificatepercentTrade certificate
education_leveluniversity_certificatepercentUniversity certificate
household_childrenNumber of children per household
household_childrenavg_children_per_householdaverageAverage number of children per household
household_compositionHousehold composition
household_compositionmulti_familypercentMulti family
household_compositionmulti_personpercentMulti person
household_compositionsingle_familypercentSingle family
household_compositionsingle_personpercentSingle person
housing_tenancyOwners vs Renters
housing_tenancyownerspercentOwners
housing_tenancyrenterspercentRenters
housing_typeHousing type
housing_typeapartment_1_to_4_floorspercentApartment 1-4 floors
housing_typeapartment_5_plus_floorspercentApartment 5 or more floors
housing_typeduplexpercentDuplex
housing_typerow_housespercentRow houses
housing_typesemi_detachedpercentSemi detached
housing_typesingle_detachedpercentSingle detached
incomeIncome
incomeavg_household_incomestandaloneAverage household income
incomeavg_individual_incomestandaloneAverage individual income
mother_tongueMother tongue
mother_tongueafrikaanspercentAfrikaans
mother_tonguealbanianpercentAlbanian
mother_tongueamharicpercentAmharic
mother_tonguearabicpercentArabic
mother_tonguearmenianpercentArmenian
mother_tongueatikamekwpercentAtikamekw
mother_tonguebengalipercentBengali
mother_tongueblackfootpercentBlackfoot
mother_tonguechaldean_neo_aramaicpercentChaldean Neo Aramaic
mother_tongueczechpercentCzech
mother_tonguedaripercentDari
mother_tonguedutchpercentDutch
mother_tongueenglish_and_frenchpercentEnglish and French
mother_tongueenglish_and_non_official_language_spercentEnglish and non-official language(s)
mother_tongueenglish_french_and_non_official_language_spercentEnglish, French and non-official language(s)
mother_tongueenglishpercentEnglish
mother_tonguefrench_and_non_official_language_spercentFrench and non-official language(s)
mother_tonguefrenchpercentFrench
mother_tonguegermanpercentGerman
mother_tonguegreekpercentGreek
mother_tonguegujaratipercentGujarati
mother_tonguehindipercentHindi
mother_tongueililimowin_moose_creepercentIlilimowin Moose Cree
mother_tongueinu_ayimun_southern_east_creepercentInu Ayimun Southern East Cree
mother_tongueinuktitutpercentInuktitut
mother_tongueiranian_persianpercentIranian Persian
mother_tongueitalianpercentItalian
mother_tongueiyiyiw_ayimiwin_northern_east_creepercentIyiyiw Ayimiwin Northern East Cree
mother_tonguejapanesepercentJapanese
mother_tonguekoreanpercentKorean
mother_tonguelow_german_nospercentLow German Nos
mother_tonguemalayalampercentMalayalam
mother_tonguemandarinpercentMandarin
mother_tonguendebelepercentNdebele
mother_tonguenehinawewin_swampy_creepercentNehinawewin Swampy Cree
mother_tonguenehiyawewin_plains_creepercentNehiyawewin Plains Cree
mother_tongueniger_congo_languagespercentNiger Congo Languages
mother_tonguenihithawiwin_woods_creepercentNihithawiwin Woods Cree
mother_tongueoneidapercentOneida
mother_tongueoriya_nospercentOriya Nos
mother_tongueoromopercentOromo
mother_tonguepennsylvania_germanpercentPennsylvania German
mother_tongueplautdietschpercentPlautdietsch
mother_tonguepolishpercentPolish
mother_tongueportuguesepercentPortuguese
mother_tongueportuguesepercentPortuguese
mother_tonguepunjabi_panjabipercentPunjabi Panjabi
mother_tongueromanianpercentRomanian
mother_tonguerussianpercentRussian
mother_tonguesomalipercentSomali
mother_tonguespanishpercentSpanish
mother_tongueswiss_germanpercentSwiss German
mother_tonguetagalog_pilipino_filipinopercentTagalog Pilipino Filipino
mother_tonguetelugupercentTelugu
mother_tonguetlicho_dogribpercentTlicho Dogrib
mother_tongueukrainianpercentUkrainian
mother_tongueurdupercentUrdu
mother_tonguevietnamesepercentVietnamese
mother_tongueyue_cantonesepercentYue Cantonese
official_language_knowledgeOfficial language knowledge
official_language_knowledgeen_and_frpercentEnglish and French
official_language_knowledgeen_onlypercentEnglish only
official_language_knowledgefr_onlypercentFrench only
official_language_knowledgeotherpercentOther
population_agePopulation age
population_age0_to_4percent0 to 4
population_age5_to_9percent5 to 9
population_age10_to_14percent10 to 14
population_age15_to_19percent15 to 19
population_age20_to_34percent20 to 34
population_age35_to_49percent35 to 49
population_age50_to_64percent50 to 64
population_age65_to_79percent65 to 79
population_age80_pluspercent80 and over
population_totalTotal
population_totaltotal_individualsstandaloneTotal individuals
warning

WKT works on x/y planes. Therefore, the coordinates must be sent as lng/lat instead of lat/lng.

ParameterStatusDescription
latoptionalA decimal number between -90 and 90 (Latitude)
lngoptionalA decimal number between -180 and 180 (Longitude)
radiusoptionalA positive float number (Circle radius)
radius_unitoptionalThe unit type of the radius.
Available: meter, mile.
Default: meter
polygonoptionalList of 2D lng/lat points that define a 2D polygon, using the WKT representation
languageoptionalThe language that demographic variable labels will be returned in.
Available: en, fr.
Default: en

Usage examples​

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

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": "cmtr_transt",
"value": 0.23562293,
"label": "Transit"
},
{
"variable": "cmtr_foot",
"value": 0.011240746,
"label": "Foot"
},
{
"variable": "cmtr_cycle",
"value": 0.019079289,
"label": "Bike"
},
{
"variable": "cmtr_drive",
"value": 0.60276959,
"label": "Drive"
},
{
"variable": "cmtr_other",
"value": 0.016329394,
"label": "Other"
},
{
"variable": "cmtr_none",
"value": 0.11495802,
"label": "None"
}
]
}
},
"meta": {
"country_code": "US",
"language": "en",
"version": "2.0.0"
},
},
"meta": {
"message": "Successfully called v3/demographics API.",
"statusCode": 200,
"type": "LocalLogic.API.Success"
}
}

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

  • A display label to describe this category

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 values

variables: A list of several variables for the category, each with the following:

  • variable, a programmatic key that will be constant regardless of language
  • value, the actual demographic value
  • label, a language-specific description which can be used for display purposes

In the above example:

The average household income of the surrounding area is $88,555
The average individual income is $39,706
60.2% of people commute by car
23.5% of people commute by transit
11.4% of people commute by other modes
1.9% of people commute by bicycle
1.1% of people commute by foot

GET v3/demographics/{geog_id}​

Fetches demographics data aggregated to the level of Local Logic geographies or neighborhoods, with confidence intervals driven by margin of error in the source data. The data returned describes a wide range of demographic variables, organized by categories. All populated areas in Canada and the US (50 states + District of Columbia) are covered, and data exists for neighborhoods all the way up to metro areas (geography levels 10, 20, 30, and 40).

GET v3/demographics/{geog_id}

Header​

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 Getting Started.

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

QueryString​

ParameterStatusDescription
languageoptionalThe language in which to return the neighborhood names.
Accepted values: en, fr
Default: en

Output Attributes and Sub-Variables​

AttributeVariableTypeDescription
commute_modeCommute mode
commute_modecommute_mode_totalcountNumber of individuals in employed labour force aged 15 years and over
commute_modebicyclepercentBicycle
commute_modedrivepercentCar
commute_modefootpercentFoot
commute_modeotherpercentOther
commute_modetransitpercentPublic transit
commute_timeCommute time
commute_timecommute_time_totalcountNumber of individuals in employed labour force aged 15 years and over
commute_timecommute_time_00_to_14_minutespercent0 to 14 Minutes
commute_timecommute_time_15_to_29_minutespercent15 to 29 Minutes
commute_timecommute_time_30_to_44_minutespercent30 to 44 Minutes
commute_timecommute_time_45_to_59_minutespercent45 to 59 Minutes
commute_timecommute_time_60_plus_minutespercent60 Minutes or Longer
education_levelHighest level of education achieved
education_leveleducation_level_totalcountNumber of individuals aged 15 years and over
education_levelbachelor_degreepercentBachelor's degree
education_levelcollege_certificatepercentCollege certificate
education_leveldoctoratepercentDoctorate
education_levelhigh_schoolpercentHigh school
education_levelmasters_degreepercentMaster's degree
education_levelmedical_degreepercentMedical degree
education_levelno_high_schoolpercentDid not graduate high school
education_leveltrade_certificatepercentTrade certificate
education_leveluniversity_certifcatepercentUniversity certificate
employment_statusEmployment status
employment_statusemployment_totalcountNumber of individuals in the labour force
employment_statusemployment_employedpercentEmployed
employment_statusemployment_unemployedpercentUnemployed
household_compositionHousehold composition
household_compositionhousehold_size_total_countcountNumber of private households
household_compositionhousehold_size_1_person_percentpercent1 person
household_compositionhousehold_size_2_people_percentpercent2 people
household_compositionhousehold_size_3_people_percentpercent3 people
household_compositionhousehold_size_4_people_percentpercent4 people
household_compositionhousehold_size_5_plus_people_percentpercent5 people or more
householdsTotal Households
householdshouseholds_totalcountTotal number of private dwellings
households_childrenChildren in household
households_childrenavg_children_per_householdstandaloneAverage number of children in families with children
households_childrenhome_households_totalcountTotal number of census families in private households
households_childrenhome_kidspercentWith Children
households_childrenhome_no_kidspercentWithout Children
housing_bedroom_countNumber of bedrooms per household
housing_bedroom_counthousing_units_totalcountNumber of occupied private dwellings
housing_bedroom_counthousing_0_bedroompercentStudio
housing_bedroom_counthousing_1_bedroompercent1 bedroom
housing_bedroom_counthousing_2_bedroomspercent2 bedrooms
housing_bedroom_counthousing_3_bedroomspercent3 bedrooms
housing_bedroom_counthousing_4_plus_bedroomspercent4 or more bedrooms
housing_construction_yearHousing construction year
housing_construction_yearhousing_units_totalcountNumber of occupied private dwellings
housing_construction_yearhousing_construction_year_before_1961percentBefore 1961
housing_construction_yearhousing_construction_year_1961_to_1980percent1961 to 1980
housing_construction_yearhousing_construction_year_1981_to_1990percent1981 to 1990
housing_construction_yearhousing_construction_year_1991_to_2000percent1991 to 2000
housing_construction_yearhousing_construction_year_2001_to_2010percent2001 to 2010
housing_construction_yearhousing_construction_year_2011_to_2015percent2011 to 2015
housing_construction_yearhousing_construction_year_2016_to_2021percent2016 to 2021
housing_tenancyOwners vs. renters
housing_tenancyprop_occupied_units_totalcountNumber of occupied private dwellings
housing_tenancyownerspercentOwner
housing_tenancyrenterspercentRenter
housing_typeHousing type
housing_typeunits_totalcountNumber of occupied private dwellings
housing_typeapartment_1_to_4_floorspercentApartment 1-4 floors
housing_typeapartment_5_plus_floorspercentApartment 5 or more floors
housing_typeduplexpercentDuplex
housing_typemobilepercentMobile
housing_typerow_housespercentRow houses
housing_typesemi_detachedpercentSemi detached
housing_typesingle_detachedpercentSingle detatched
incomeIncome
incomemedian_household_incomemedianMedian household income
incomemedian_individual_incomemedianMedian per capita income
incomeincome_bracket_totalcountNumber of private households
incomeincome_bracket_0_10percent$0 to $9,999
incomeincome_bracket_10_15percent$10,000 to $14,999
incomeincome_bracket_15_20percent$15,000 to $19,999
incomeincome_bracket_20_25percent$20,000 to $24,999
incomeincome_bracket_25_30percent$25,000 to $29,999
incomeincome_bracket_30_35percent$30,000 to $34,999
incomeincome_bracket_35_40percent$35,000 to $39,999
incomeincome_bracket_40_45percent$40,000 to $44,999
incomeincome_bracket_45_50percent$45,000 to $49,999
incomeincome_bracket_50_60percent$50,000 to $59,999
incomeincome_bracket_60_70percent$60,000 to $69,999
incomeincome_bracket_70_80percent$70,000 to $79,999
incomeincome_bracket_80_90percent$80,000 to $89,999
incomeincome_bracket_90_100percent$90,000 to $99,999
incomeincome_bracket_100_125percent$100,000 to $124,999
incomeincome_bracket_125_150percent$125,000 to $149,999
incomeincome_bracket_150_200percent$150,000 to $199,999
incomeincome_bracket_200_pluspercent$200,000 or more
mother_tongueMother tongue
mother_tonguetotal_mother_tonguecountTotal Individuals
mother_tongueafrikaanspercentAfrikaans
mother_tonguealbanianpercentAlbanian
mother_tongueamharicpercentAmharic
mother_tonguearabicpercentArabic
mother_tonguearmenianpercentArmenian
mother_tongueatikamekwpercentAtikamekw
mother_tonguebengalipercentBengali
mother_tongueblackfootpercentBlackfoot
mother_tonguechaldean_neo_aramaicpercentChaldean Neo Aramaic
mother_tongueczechpercentCzech
mother_tonguedaripercentDari
mother_tonguedutchpercentDutch
mother_tongueenglish_and_frenchpercentEnglish and French
mother_tongueenglish_and_non_official_languagespercentEnglish and non-official language(s)
mother_tongueenglish_french_and_non_official_languagespercentEnglish, French and non-official language(s)
mother_tongueenglishpercentEnglish
mother_tonguefrench_and_non_official_languagespercentFrench and non-official language(s)
mother_tonguefrenchpercentFrench
mother_tonguegermanpercentGerman
mother_tonguegreekpercentGreek
mother_tonguegujaratipercentGujarati
mother_tonguehaitian_creolepercentHaitian Creole
mother_tonguehindipercentHindi
mother_tongueililimowin_moose_creepercentIlilimowin Moose Cree
mother_tongueinu_ayimun_southern_east_creepercentInu Ayimun Southern East Cree
mother_tongueinuktitutpercentInuktitut
mother_tongueiranian_persianpercentIranian Persian
mother_tongueitalianpercentItalian
mother_tongueiyiyiw_ayimiwin_northern_east_creepercentIyiyiw Ayimiwin Northern East Cree
mother_tonguejapanesepercentJapanese
mother_tonguekoreanpercentKorean
mother_tonguelow_german_nospercentLow German Nos
mother_tonguemalayalampercentMalayalam
mother_tonguemandarinpercentMandarin
mother_tonguendebelepercentNdebele
mother_tonguenehinawewin_swampy_creepercentNehinawewin Swampy Cree
mother_tonguenehiyawewin_plains_creepercentNehiyawewin Plains Cree
mother_tongueniger_congo_languagespercentNiger Congo Languages
mother_tonguenihithawiwin_woods_creepercentNihithawiwin Woods Cree
mother_tongueoneidapercentOneida
mother_tongueoriya_nospercentOriya Nos
mother_tongueoromopercentOromo
mother_tonguepennsylvania_germanpercentPennsylvania German
mother_tongueplautdietschpercentPlautdietsch
mother_tonguepolishpercentPolish
mother_tongueportuguesepercentPortuguese
mother_tongueportuguesepercentPortuguese
mother_tonguepunjabi_panjabipercentPunjabi Panjabi
mother_tongueromanianpercentRomanian
mother_tonguerussianpercentRussian
mother_tonguesomalipercentSomali
mother_tonguespanishpercentSpanish
mother_tongueswiss_germanpercentSwiss German
mother_tonguetagalog_pilipino_filipinopercentTagalog Pilipino Filipino
mother_tonguetelugupercentTelugu
mother_tonguetlicho_dogribpercentTlicho Dogrib
mother_tongueukrainianpercentUkrainian
mother_tongueurdupercentUrdu
mother_tonguevietnamesepercentVietnamese
mother_tongueyue_cantonesepercentYue Cantonese
official_language_knowledgeOfficial language knowledge
official_language_knowledgeofficial_language_knowledge_totalcountTotal Individuals
official_language_knowledgeofficial_language_knoweldge_neitherpercentNeither English nor French
official_language_knowledgeofficial_language_knowledge_bilingualpercentEnglish and French
official_language_knowledgeofficial_language_knowledge_englishpercentEnglish only
official_language_knowledgeofficial_language_knowledge_frenchpercentFrench only
population_agePopulation age
population_agepopn_age_medianmedianMedian Population Age
population_age0_to_4percent0 to 4
population_age5_to_9percent5 to 9
population_age10_to_14percent10 to 14
population_age15_to_19percent15 to 19
population_age20_to_24percent20 to 24
population_age25_to_29percent25 to 29
population_age30_to_34percent30 to 34
population_age35_to_39percent35 to 39
population_age40_to_44percent40 to 44
population_age45_to_49percent45 to 49
population_age50_to_54percent50 to 54
population_age55_to_59percent55 to 59
population_age60_to_64percent60 to 64
population_age65_to_69percent65 to 69
population_age70_to_74percent70 to 74
population_age75_to_79percent75 to 79
population_age80_to_84percent80 to 84
population_age85_pluspercent85 and over
population_totalTotal
population_totaltotal_individualscountTotal Individuals

Usage examples​

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

Response example​

{
"data": {
"type": "demographics",
"attributes": {
"commute_mode": {
"variables": [
{
"variable": "cmtr_workers_total",
"type": "count",
"value": 16792,
"label": "Number of workers 16 years and over",
"confidence_interval": {
"high_estimate": 17861,
"low_estimate": 15728,
"confidence_level": 0.9
}
},
{
"variable": "cmtr_foot",
"type": "percent",
"value": 0.105347784659,
"label": "Foot",
"confidence_interval": {
"high_estimate": 0.13018103858980467,
"low_estimate": 0.08093139590281085,
"confidence_level": 0.9
}
},
{
"variable": "cmtr_cycle",
"type": "percent",
"value": 0.020366841353,
"label": "Bike",
"confidence_interval": {
"high_estimate": 0.027751310147689376,
"low_estimate": 0.013101476893758932,
"confidence_level": 0.9
}
},
{
"variable": "cmtr_transt",
"type": "percent",
"value": 0.537339209147,
"label": "Transit",
"confidence_interval": {
"high_estimate": 0.5784897570271558,
"low_estimate": 0.4964268699380657,
"confidence_level": 0.9
}
},
{
"variable": "cmtr_drive",
"type": "percent",
"value": 9.9452120057,
"label": "Drive",
"confidence_interval": {
"high_estimate": 0.12696522153406384,
"low_estimate": 0.07479752262982372,
"confidence_level": 0.9
}
},
{
"variable": "cmtr_other",
"type": "percent",
"value": 0,
"label": "Other",
"confidence_interval": {
"high_estimate": 0.0026798475464506905,
"low_estimate": 0,
"confidence_level": 0.9
}
},
{
"variable": "cmtr_none",
"type": "percent",
"value": 0.190090519294,
"label": "None",
"confidence_interval": {
"high_estimate": 0.21712720343020486,
"low_estimate": 0.16335159599809433,
"confidence_level": 0.9
}
}
],
"label": "Commute mode"
},
"household_income": {
"variables": [
{
"variable": "inc_25_30",
"type": "percent",
"value": 0.015357867284,
"label": "$25,000 to $30,000",
"confidence_interval": {
"high_estimate": 0.022602144305998264,
"low_estimate": 0.008113590263691683,
"confidence_level": 0.9
}
},
{
"variable": "inc_200_plus",
"type": "percent",
"value": 0.0208780063749,
"label": "$200,000 or more",
"confidence_interval": {
"high_estimate": 0.23362793393219356,
"low_estimate": 0.1841495218777166,
"confidence_level": 0.9
}
},
{
"variable": "inc_households_total",
"type": "count",
"value": 13804,
"label": "Total Households",
"confidence_interval": {
"high_estimate": 14523,
"low_estimate": 13088,
"confidence_level": 0.9
}
}
],
"label": "Household income"
},
"income_stats": {
"variables": [
{
"variable": "inc_home",
"type": "median",
"value": 112647,
"label": "Median Household Income",
"confidence_interval": {
"high_estimate": 156106,
"low_estimate": 69189,
"confidence_level": 0.9
}
},
{
"variable": "inc_person",
"type": "median",
"value": 68560,
"label": "Median Per Capita Income",
"confidence_interval": {
"high_estimate": 89703,
"low_estimate": 47418,
"confidence_level": 0.9
}
}
],
"label": "Per capita income"
},
},
"meta": {
"language": "en",
"country_code": "US"
}
},
"meta": {
"message": "Successfully called v3/demographics API.",
"type": "LocalLogic.API.Success",
"statusCode": 200
}
}

In the above example of returned data, there are three categories of demographic data (β€œCommute mode”, "Household income" and "Per capita income"). These categories have the following fields:

label

  • A display label to describe this category

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.
  • count: this category’s variables are separate values

variables: A list of several variables for the category, each with the following:

  • variable, a programmatic key that will be constant regardless of language
  • value, the actual demographic value
  • label, a language-specific description which can be used for display purposes
  • confidence_interval, which describes a range and the confidence level (as a ratio) for how often we estimate the true value will fall in the given range

In the above example:

9.9% of people commute by car
53.7% of people commute by transit
10.5% of people commute by foot
2.0% of people commute by bicycle
0.0% of people commute by other modes
The median household income is $112,647 (between $69,189 and $156,106 90% of the time)

SDK Implementations​

Demographics is used by two SDKs:

SDKDescription
Local Demographics SDKRetrieves the demographics information near a provided location.
NeighborhoodDemographics SDKRetrieves the demographics information within a given neighborhood.

Error codes​

When calling Local Logic’s API, you may receive an HTTP error code. These errors are explained below. In general, error codes starting with β€œ4” are due to an invalid API call and can be fixed on your end, whereas error codes starting with β€œ5” are due to server errors (that is, problems on our end). If you receive something not described here, please contact us at support@locallogic.co.

400 - BadRequest

This error code happens when the request inputs are incorrect. Use the detail field of the response for clarification. Example:

{
"code": "LocalLogic.API.BadRequest",
"detail": "ValidationErrors: AroundEndpoint is invalid:\n\tinclude is invalid: \"bad_input\" is not an acceptable value: \"groceries\", \"restaurants\", \"nightlife\", \"cafes\", \"shopping\", \"daycares\", \"primary_schools\", \"high_schools\""
}

401 - Unauthorized

This error code happens when your API key cannot access specific resources or locations. For example, some API keys can only access certain countries / states / provinces. Feel free to contact us for more information. Example:

{
"code": "LocalLogic.API.Unauthorized",
"detail": "Your API KEY doesn't support this region"
}

403 - Forbidden

This error code happens when you forgot to include security credentials with your request or you are requesting a parameter that you do not have access to. Example:

{
"message": "Forbidden"
}

404 - NotFound

This error code happens when we don’t have data for the requested location. For example, if you send a lat/lng pair for a location in Antarctica, we will return this error as we don’t have data for Antarctica (yet!). Example:

{
"code": "LocalLogic.API.NotFound",
"detail": "No Location Scores found for this location."
}

422 - Unprocessable Entity

This error code is returned when the correct parameters have been sent however, the data they contain is not valid. For example, if you send a lat/lng pair and the latitude is invalid (ie. not in the range [-90, 90]) and/or the longitude is invalid (ie. not in the range [-180, 180]).

{
"message": "Latitude must be within [-90, 90], Longitude must be within [-180, 180], Requires at least lat/lng pair, or geography_ids. None supplied.",
"code": "LocalLogic.API.BadRequest",
"statusCode": 422
}

500 - ServerError

This error code means that an error occurred on our end. Feel free to retry the same request to see if the problem persists. If you received a lot of these errors, please contact us at support@locallogic.co Example:

{
"code": "LocalLogic.API.ServerError",
"detail": "No Location Scores found for this location."
}

502 - BadGateway

This error code means that an error came from our cloud provider. Feel free to retry the same request to see if the problem persists. Example:

{
"message": "Internal server error"
}