Get U.S. Census Tract demographics covering population, income, housing, and more.

Request Details

Example Request Url
https://geodata.cdxtech.com/api/geotract?key={key}&query={query}&format={format}

Description Required Default Value Example
key Authentication Key key=dd76pxfi4feydh4bz_dtrjyf6flu4-987asdjhajkd555usds28ad984yhz
query Tract Number/ID query=48201311000
format Output Formatting json format=json (supported formats: json, xml)

Coding Examples

Here are some coding examples to get you started. Please feel free to contact support if you need additional assistance.



string key = "{your-key}";
string query = "48201311000"
string format = "json";

HttpResponseMessage message = null;

using (HttpClient client = new HttpClient())
{
    client.BaseAddress = new Uri(Settings.Net.BaseHttpsUrl);

    StringBuilder url = new StringBuilder("/api/census/geotract?");
    url.Append("key=").Append(key);
    url.Append("&query=").Append(query);
    url.Append("&format=").Append(format);

    message = client.GetAsync(url.ToString()).Result;
}



import requests

def get_census_geotract(api_key, query, response_format="json"):
    """Fetch tract geolocation data from the Census API endpoint."""
    base_url = "https://geodata.cdxtech.com"
    endpoint = "/api/census/geotract"
    url = f"{base_url}{endpoint}"
    params = {
        "key": api_key,
        "query": query,
        "format": response_format,
    }
    response = requests.get(url, params=params)
    response.raise_for_status()
    try:
        return response.json()
    except ValueError:
        return response.text

if __name__ == "__main__":
    key = "{your-key}"
    query = "48201311000"
    format = "json"
    data = get_census_geotract(key, query, format)
    import json
    if isinstance(data, (dict, list)):
        print(json.dumps(data, indent=2))
    else:
        print(data)



// Cargo.toml
// [dependencies]
// reqwest = { version = "0.11", features = ["blocking", "json"] }
// serde = { version = "1.0", features = ["derive"] }
// serde_json = "1.0"

use std::error::Error;

fn get_census_geotract(
    api_key: &str,
    query: &str,
    response_format: &str,
) -> Result> {
    let client = reqwest::blocking::Client::new();
    let resp = client
        .get("https://geodata.cdxtech.com/api/census/geotract")
        .query(&[
            ("key", api_key),
            ("query", query),
            ("format", response_format),
        ])
        .send()?
        .error_for_status()?;

    let json: serde_json::Value = resp.json()?;
    Ok(json)
}

fn main() -> Result<(), Box> {
    let api_key = "{your-key}";
    let query = "48201311000";
    let format = "json";

    match get_census_geotract(api_key, query, format) {
        Ok(data) => println!("Response JSON:\n{}", serde_json::to_string_pretty(&data)?),
        Err(err) => eprintln!("Error fetching data: {}", err),
    }

    Ok(())
}



async function getCensusGeotract({ key, query, format = "json" }) {
    const baseUrl = "https://geodata.cdxtech.com";
    const endpoint = "/api/census/geotract";
    const params = new URLSearchParams({ key, query, format });
    const url = `${baseUrl}${endpoint}?${params.toString()}`;
    const response = await fetch(url);
    if (!response.ok) {
        throw new Error(`HTTP error! Status: ${response.status}`);
    }
    const text = await response.text();
    try {
        return JSON.parse(text);
    } catch {
        return text;
    }
}

// Example usage:
(async () => {
    const key = "{your-key}";
    const query = "48201311000";
    const format = "json";
    try {
        const data = await getCensusGeotract({ key, query, format });
        console.log("Response:", data);
    } catch (err) {
        console.error("Error fetching data:", err);
    }
})();



Dim key As String = "{your-key}"
Dim query As String = "48201311000"
Dim format As String = "json"
Dim message As HttpResponseMessage = Nothing

Using client As New HttpClient()
	client.BaseAddress = New Uri("https://geodata.cdxtech.com")
	
	Dim url As New StringBuilder("/api/census/geotract?")
	url.Append("key=").Append(key)
	url.Append("&query=").Append(query)
	url.Append("&format=").Append(format)
	message = client.GetAsync(url.ToString()).Result
End Using



Dim Client As New WebClient
Dim Request As New WebRequest
Dim key As String
Dim query As String
Dim format As String
key = "{your-key}"
query = "48201311000"
format = "json"
Client.BaseUrl = "https://geodata.cdxtech.com/api/"
Request.Method = WebMethod.HttpGet
Request.ResponseFormat = WebFormat.Json
Request.Resource = "census/geotract?key={key}&query={query}&format={format}"
Request.AddUrlSegment "key", key
Request.AddUrlSegment "query", query
Request.AddUrlSegment "format", format 
	
Set Response = Client.Execute(Request)

Output Examples

Here are some output data examples. You can also use the Report Generator tab to export specific data files.



{
	"service": "GeoLocateCensus",
	"url": "https://localhost:44388/api/census/geolocate/single?key={your-key}&query=2%20west%20hanover%20ave,%20randolph,%20nj&format=json",
	"status": "Success",
	"tokenCharge": 1,
	"message": null,
	"totalResults": 1,
	"results": {
		"bestMatch": "2 W Hanover Ave, RANDOLPH, NJ, 07869",
		"latitude": "40.827526",
		"longitude": "-74.56732",
		"latitudeAndLongitude": "40.827526|-74.56732",
		"street": "2 W Hanover Ave",
		"city": "RANDOLPH",
		"state": "NJ",
		"zip": "7869",
		"county": "Morris",
		"tract": "045703"
	},
	"usage": {
		"used": 10075,
		"usedPercentage": 5.30472555,
		"remaining": 189925,
		"remainingPercentage": 94.69527445
	},
	"duration": 0.3983131,
	"timeStamp": "2020-05-07T13:18:17.5560905-04:00"
}



<Root>
  <Service>GeoLocateCensus</Service>
  <Url>https://localhost:44388/api/census/geolocate/single?key={your-key}&query=2%20west%20hanover%20ave,%20randolph,%20nj&format=xml</Url>
  <Status>Success</Status>
  <TokenCharge>1</TokenCharge>
  <Message />
  <TotalResults>1</TotalResults>
  <Results>
    <BestMatch>2 W Hanover Ave, RANDOLPH, NJ, 07869</BestMatch>
    <Latitude>40.827526</Latitude>
    <Longitude>-74.56732</Longitude>
    <LatitudeAndLongitude>40.827526|-74.56732</LatitudeAndLongitude>
    <Street>2 W Hanover Ave</Street>
    <City>RANDOLPH</City>
    <State>NJ</State>
    <Zip>7869</Zip>
    <County>Morris</County>
    <Tract>045703</Tract>
  </Results>
  <Usage>
    <Used>10075</Used>
    <UsedPercentage>5.30472555</UsedPercentage>
    <Remaining>189925</Remaining>
    <RemainingPercentage>94.69527445</RemainingPercentage>
  </Usage>
  <Duration>0.3255845</Duration>
  <TimeStamp>2020-05-07T13:18:22.5839266-04:00</TimeStamp>
</Root>