Many products start from a point and not from an address: a click on a map, a phone's location, the site of an insurance claim, a planned transit stop. The question is the same each time. Which properties are near this latitude and longitude, and what is known about them?
The geocoding endpoint of the Houski property data API answers it in one request. You send a point and a radius, and it returns the properties inside the circle, nearest first, with the fields you select.
Search by radius around a point
The endpoint takes four parameters for the search itself:
- latitude and longitude, in decimal degrees
- radius, in kilometres
- shape, which is circle in the requests below
This block is a real call against the live API, run each time this page loads. It asks for houses within 2 kilometres of a point in central Calgary:
const houski_data = async (): Promise<GeocodingResponse> => {
// You must copy the GeocodingResponse type declarations from the
// Houski API documentation to strongly type the response
const url = new URL('https://api.houski.ca/geocoding');
url.searchParams.set('api_key', 'YOUR_API_KEY');
url.searchParams.set('exclude', 'inferred');
url.searchParams.set('latitude', '51.0447');
url.searchParams.set('longitude', '-114.0719');
url.searchParams.set('property_type_eq', 'House');
url.searchParams.set('radius', '2');
url.searchParams.set('select', 'latitude,longitude,bedroom,den,bathroom_full,bathroom_half');
url.searchParams.set('shape', 'circle');
const response = await fetch(url);
const data = await response.json();
return data;
}
(async () => {
let data: GeocodingResponse = await houski_data();
// Log the response
console.log(data);
})();
{
"cache_hit": true,
"checked_fields": [
"bedroom",
"bathroom_full",
"bathroom_half"
],
"cost_cents": 2.6399999,
"data": [
{
"address": "527 15 Avenue SW",
"bathroom_full": 1,
"bathroom_half": 0,
"bedroom": 2,
"den": 0,
"latitude": 51.038754,
"longitude": -114.07366,
"property_id": "d60d8b3075992569"
},
{
"address": "308 19 Avenue SW",
"bathroom_full": 1,
"bathroom_half": 0,
"bedroom": 2,
"den": 0,
"latitude": 51.036484,
"longitude": -114.06914,
"property_id": "751dc957d46487e0"
},
{
"address": "514 19 Avenue SW",
"bathroom_full": 1,
"bathroom_half": 0,
"bedroom": 1,
"den": 0,
"latitude": 51.036304,
"longitude": -114.07237,
"property_id": "f36b589bfb4507d3"
},
{
"address": "516 19 Avenue SW",
"bathroom_full": 1,
"bathroom_half": 0,
"bedroom": 1,
"den": 0,
"latitude": 51.036304,
"longitude": -114.07249,
"property_id": "b664e01a02aec87e"
},
{
"address": "306 19 Avenue SW",
"bathroom_full": 2,
"bathroom_half": 0,
"bedroom": 2,
"den": 0,
"latitude": 51.036484,
"longitude": -114.06903,
"property_id": "ffb8086cc197cbc3"
},
{
"address": "522 19 Avenue SW",
"bathroom_full": 2,
"bathroom_half": 1,
"bedroom": 2,
"den": 0,
"latitude": 51.036304,
"longitude": -114.07281,
"property_id": "adff8d08ccefb5ae"
}
],
"error": "",
"pagination": {
"current_page": 1,
"has_next_page": true,
"has_previous_page": false,
"page_total": 209
},
"price_quote": false,
"result_total": 1253,
"time_ms": 50
}
The radius is in kilometres, so radius=0.5 is 500 metres. Results come back nearest first, which means the first row is always the closest property to the point.
Filter the properties around the point
The request above includes property_type_eq=House. Filters work here the same way they do across the API: a field name, an operator suffix and a value. The suffixes are _eq, _neq, _in, _gt, _gte, _lt, _lte, _regex and _nregex.
Some filters that are useful around a point:
- bedroom_gte=3 keeps homes with three or more bedrooms
- property_type_in=House,Townhouse keeps two property types
- construction_year_lt=1980 keeps older buildings
- for_sale_eq=true keeps homes that are for sale
Text values match exactly, case included, so House works and house finds nothing.
Turn a map click into an address
Reverse geocoding is the same request with a small radius and one result. Because the nearest property comes first, asking for one result per page returns the property at the point, or the closest one to it:
const houski_data = async (): Promise<GeocodingResponse> => {
// You must copy the GeocodingResponse type declarations from the
// Houski API documentation to strongly type the response
const url = new URL('https://api.houski.ca/geocoding');
url.searchParams.set('api_key', 'YOUR_API_KEY');
url.searchParams.set('latitude', '51.0446');
url.searchParams.set('longitude', '-114.0722');
url.searchParams.set('radius', '0.5');
url.searchParams.set('results_per_page', '1');
url.searchParams.set('select', 'address,postal_code,property_id');
const response = await fetch(url);
const data = await response.json();
return data;
}
(async () => {
let data: GeocodingResponse = await houski_data();
// Log the response
console.log(data);
})();
{
"cache_hit": true,
"cost_cents": 0.03,
"data": [
{
"address": "513 9 Avenue SW",
"postal_code": "T2P1G1",
"property_id": "e9baf46145362e25"
}
],
"error": "",
"pagination": {
"current_page": 1,
"has_next_page": true,
"has_previous_page": false,
"page_total": 5529
},
"price_quote": false,
"result_total": 5529,
"time_ms": 31
}
The answer carries the address, the postal code and the property_id of that home. Keep the property_id. It identifies the same property on every other endpoint, so the next request can ask the properties endpoint for its details, or the predict endpoint for its modelled value history.
A Python example
Every request is a GET that answers in JSON, so the standard library is enough. The key is read from the HOUSKI_API_KEY environment variable and is never written into the source.
import json
import os
import urllib.parse
import urllib.request
API_KEY = os.environ["HOUSKI_API_KEY"]
def properties_near(latitude, longitude, radius_km, **filters):
"""Return the properties within radius_km of a point, nearest first."""
query = urllib.parse.urlencode({
"api_key": API_KEY,
"latitude": latitude,
"longitude": longitude,
"radius": radius_km,
"shape": "circle",
"results_per_page": 10,
"select": "address,property_type,bedroom,estimate_list_price,latitude,longitude",
"exclude": "inferred",
**filters,
})
with urllib.request.urlopen(f"https://api.houski.ca/geocoding?{query}") as response:
return json.load(response)
answer = properties_near(51.0447, -114.0719, 1, property_type_eq="House", bedroom_gte=3)
print(f"{answer['result_total']} properties in the circle")
for row in answer["data"]:
print(row["address"], row.get("bedroom"), row.get("estimate_list_price"))
The same request in curl:
curl "https://api.houski.ca/geocoding?api_key=$HOUSKI_API_KEY&latitude=51.0447&longitude=-114.0719&radius=1&shape=circle&results_per_page=10&select=address,bedroom&exclude=inferred"
More programs in Python, JavaScript, TypeScript, Rust and curl are in the examples repository.
Read the response
The response has the same shape as the rest of the API: data, error, result_total, pagination, time_ms, cost_cents, cache_hit and price_quote. The result_total field is the number of properties inside the circle. The pagination object holds current_page, page_total, has_next_page and has_previous_page, so a busy circle can be read one page at a time with results_per_page and page.
A field with no value for a home is left out of its row. That is why the Python example uses row.get for the fields that may be absent.
What a radius search costs
Billing is on what comes back, never on how much was searched. A circle that holds 5,000 properties costs the same as a circle that holds 10 if you ask for one page of 10 rows. Most fields cost $0.001 per home returned, and a field with no value for a home is not billed.
Add price_quote=true to any request and the API returns the cost of that request for free. Pay as you go is $99 a month in United States dollars, charged at the start of the month and including the first $99 of usage, and every pay as you go account sets its own maximum monthly spend. The pricing page lists the rates.
Where it works
The endpoint works the same way in every country Houski covers: Canada, the United States, Great Britain, France, Spain, the Netherlands, Poland, Czechia, Austria, Switzerland, Norway, Finland, Estonia, Latvia, Slovenia and South Korea. A point only needs its coordinates, so the same code serves a claim in Texas and a site visit in Warsaw.
If you want pins, clusters or a heatmap for a whole map view and not a list around one point, use the map endpoint.
Get started
Get a key and send your first point: the quick start guide shows how.
