This endpoint returns averages of property data for a given location. You can use this endpoint to get an overview of the property market or property features in a specific area.
This endpoint handles single and batch requests. Batch requests, which enable multiple operations with varying fields, aggregations, and filters in one go, are more efficient than multiple single requests.
Name | Required | Type | Description |
---|---|---|---|
api_key | Yes | UUID v4 | Your API key for authorization |
field | Yes | String | The field to be aggregated - see fields for all available fields |
aggregation | Yes | String | The aggregation type (e.g., sum, mean, median, mode, quantile-10, quantile-25, etc.) |
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 |
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 | Number | Cost of the request in cents |
data | Object | Contains the data for the aggregation |
error | String | Details about the error. Empty if no error |
price_quote | Boolean | Indicates whether the response is a price quote |
time_ms | Number | Time taken for the request to complete in milliseconds |
Select the programming language you want to display the code examples in.
curl -X GET "https://api.houski.ca/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('https://api.houski.ca/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": false, "cost_cents": 1.0, "data": [ { "aggregation": "median", "field": "estimate_list_price", "value": "623356.500" } ], "error": "", "price_quote": false, "time_ms": 28 }
curl -X GET "https://api.houski.ca/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('https://api.houski.ca/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": false, "cost_cents": 2.0, "data": [ { "aggregation": "sum", "field": "bedroom", "value": "67529" }, { "aggregation": "median", "field": "estimate_list_price", "value": "706177" } ], "error": "", "price_quote": false, "time_ms": 59 }
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; }