Returns aggregated property values for a location - useful for market overviews and area summaries.
Handles single and batch requests. Batch mode runs multiple aggregations with different fields and filters in one call.
$0.01 per aggregation value returned. Ask for three aggregations in one request and you pay $0.03. The size of the area behind the number makes no difference: a median across an entire province costs the same $0.01 as a median across a single community.
That is 10 times what a single property field costs per row, and it is still the cheap way to get the answer. Pulling the underlying rows from the properties endpoint to work out the same number yourself would cost orders of magnitude more.
| Name | Required | Type | Description |
|---|---|---|---|
| api_key | Yes | UUID v4 | Your API key for authorization |
| field | Yes | String | The field to aggregate - see fields |
| aggregation | Yes | String | The aggregation type:
|
| country_abbreviation | No | String | A country abbreviation |
| province_abbreviation | No | String | A province abbreviation within the country |
| city | No | String | A city within the province |
| community | No | String | A community within the city |
| polygon | No | Polygon filter string | Aggregate only properties inside a polygon. Maximum 100 points. |
| bbox_ne_lat | No | Float | Northeast latitude for bounding box. |
| bbox_ne_lng | No | Float | Northeast longitude for bounding box. |
| bbox_sw_lat | No | Float | Southwest latitude for bounding box. |
| bbox_sw_lng | No | Float | Southwest longitude for bounding box. |
This endpoint also supports field filters on any filterable property field, like property_type_eq or construction_year_gte, to narrow which properties are aggregated. See the filtering documentation for details.
Type declarations are available at the bottom of this page.
| Name | Type | Description |
|---|---|---|
| cache_hit | Boolean | Indicates if the response was a cache hit |
| cost_cents | Integer | Cost of the request in cents |
| data | Array<AggregateData> | Array containing the aggregation results data |
| error | String | Details about the error. Empty if no error |
| price_quote | Boolean | Indicates whether the response is a price quote |
| time_ms | Integer | Time taken for the request to complete in milliseconds |
Each aggregation result contains:
| Name | Type | Description |
|---|---|---|
| field | String | The field that was aggregated (e.g., 'estimate_list_price', 'bedroom') |
| aggregation | String | The aggregation method used (e.g., 'median', 'mean', 'count', 'sum') |
| value | String | The calculated aggregate value as a string |
Select the programming language you want to display the code examples in.
curl -X GET "http://127.0.0.1:8080/aggregate?aggregation=median&api_key=YOUR_API_KEY&city=calgary&community=riverbend&country_abbreviation=ca&field=estimate_list_price&province_abbreviation=ab"
const houski_get_aggregate = async (): Promise<AggregateResponse> => {
// You must copy the AggregateResponse type declarations from the
// Houski API documentation to strongly type the response
const url = new URL('http://127.0.0.1:8080/aggregate');
url.searchParams.set('aggregation', 'median');
url.searchParams.set('api_key', 'YOUR_API_KEY');
url.searchParams.set('city', 'calgary');
url.searchParams.set('community', 'riverbend');
url.searchParams.set('country_abbreviation', 'ca');
url.searchParams.set('field', 'estimate_list_price');
url.searchParams.set('province_abbreviation', 'ab');
const response = await fetch(url);
const data = await response.json();
return data;
}
(async () => {
let data: AggregateResponse = await houski_get_aggregate();
// Log the response
console.log(data);
})();
{
"cache_hit": true,
"cost_cents": 1.0,
"data": [
{
"aggregation": "median",
"field": "estimate_list_price",
"value": "614558"
}
],
"error": "",
"price_quote": false,
"time_ms": 32
}
curl -X GET "http://127.0.0.1:8080/aggregate?agg0_aggregation=sum&agg0_city=edmonton&agg0_country_abbreviation=ca&agg0_field=bedroom&agg0_property_type_eq=Apartment&agg0_province_abbreviation=ab&agg1_aggregation=median&agg1_city=calgary&agg1_country_abbreviation=ca&agg1_field=estimate_list_price&agg1_property_type_eq=House&agg1_province_abbreviation=ab&api_key=YOUR_API_KEY"
const houski_get_aggregate_batch = async (): Promise<AggregateResponse> => {
// You must copy the AggregateResponse type declarations from the
// Houski API documentation to strongly type the response
const url = new URL('http://127.0.0.1:8080/aggregate');
url.searchParams.set('agg0_aggregation', 'sum');
url.searchParams.set('agg0_city', 'edmonton');
url.searchParams.set('agg0_country_abbreviation', 'ca');
url.searchParams.set('agg0_field', 'bedroom');
url.searchParams.set('agg0_property_type_eq', 'Apartment');
url.searchParams.set('agg0_province_abbreviation', 'ab');
url.searchParams.set('agg1_aggregation', 'median');
url.searchParams.set('agg1_city', 'calgary');
url.searchParams.set('agg1_country_abbreviation', 'ca');
url.searchParams.set('agg1_field', 'estimate_list_price');
url.searchParams.set('agg1_property_type_eq', 'House');
url.searchParams.set('agg1_province_abbreviation', 'ab');
url.searchParams.set('api_key', 'YOUR_API_KEY');
const response = await fetch(url);
const data = await response.json();
return data;
}
(async () => {
let data: AggregateResponse = await houski_get_aggregate_batch();
// Log the response
console.log(data);
})();
{
"cache_hit": true,
"cost_cents": 2.0,
"data": [
{
"aggregation": "sum",
"field": "bedroom",
"value": "1220366"
},
{
"aggregation": "median",
"field": "estimate_list_price",
"value": "715970"
}
],
"error": "",
"price_quote": false,
"time_ms": 57
}
interface AggregateResponse {
cache_hit: boolean;
cost_cents: number;
data: AggregateData[];
error: string;
price_quote: boolean;
time_ms: number;
}
interface AggregateData {
field: string;
aggregation: string;
value: string;
}