GET/v1/geocode
Geocode one US address
Forward geocoding. Returns the best match first with an honest accuracy_type: rooftop (an address point),
range_interpolation (placed along the street's house-number range), nearest_rooftop_match, street_center,
place, zip, county or state. Results may be stored indefinitely.
PARAMETERS
- qquery · string
- Free-form address, e.g. '1600 Pennsylvania Ave NW, Washington, DC 20500'
- streetquery · string
- Structured alternative to q: house number and street
- cityquery · string
- Structured: city
- statequery · string
- Structured: two-letter state code
- postal_codequery · string
- Structured: five-digit ZIP code
- fieldsquery · string
- Comma-separated appends: census, cd, stateleg, school, timezone, or all
- limitquery · integer
- How many candidates to return, best firste.g. 1
REQUEST
curl "https://api.geocode.net/v1/geocode" \ -H "X-API-Key: YOUR_KEY"
import requests
r = requests.get("https://api.geocode.net/v1/geocode", headers={"X-API-Key": "YOUR_KEY"})
print(r.status_code, r.headers.get("X-Gw-Remaining"))
print(r.json())
const r = await fetch("https://api.geocode.net/v1/geocode", {
headers: { "X-API-Key": "YOUR_KEY" }
});
console.log(r.status, r.headers.get("X-Gw-Remaining"));
console.log(await r.json());
RESPONSE
200Successful Response
{
"query": "1600 Pennsylvania Ave NW, Washington, DC 20500",
"results": [
{
"formatted": "1600 Pennsylvania Ave NW, Washington, DC 20500",
"components": {
"number": "1600",
"street": "Pennsylvania",
"suffix": "Ave",
"postdirectional": "NW",
"city": "Washington",
"county": "District of Columbia",
"state": "DC",
"zip": "20500",
"country": "US"
},
"location": {
"lat": 38.897675,
"lng": -77.036545
},
"accuracy": 1.0,
"accuracy_type": "rooftop",
"source": "nad",
"fields": {
"census": {
"state_fips": "11",
"county_fips": "11001",
"county": "District of Columbia",
"county_subdivision": {
"geoid": "1100150000",
"name": "Washington city"
},
"place": {
"geoid": "1150000",
"name": "Washington"
},
"tract": "11001980000",
"block_group": "110019800001",
"zcta": "20006",
"vintage": "2020 geographies, TIGER/Line 2025"
},
"timezone": {
"name": "America/New_York",
"abbreviation": "EDT",
"utc_offset": "-04:00",
"utc_offset_seconds": -14400,
"observes_dst": true
}
}
}
]
}