!

/aggregate

GET
https://api.houski.ca/aggregate

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.

Example use cases

  1. Market trend analysis across neighborhoods or cities.
  2. Show buyers and renters typical costs in different areas.
  3. Identify undervalued areas by comparing values against incomes.
  4. Track portfolio value over time.
  5. Inform housing policy with zone-level price data.

Request parameters

NameRequiredTypeDescription
api_keyYesUUID v4Your API key for authorization
fieldYesStringThe field to aggregate - see fields
aggregationNoStringThe aggregation type:
  • count
  • sum
  • mean
  • median (default)
  • mode
  • max
  • min
  • quantile-10
  • quantile-25
  • quantile-40
  • quantile-60
  • quantile-75
  • quantile-80
  • quantile-85
  • quantile-90
  • quantile-95
  • quantile-99
country_abbreviationNoStringA country abbreviation
province_abbreviationNoStringA province abbreviation within the country
cityNoStringA city within the province
communityNoStringA community within the city
polygonNoPolygon filter stringAggregate only properties inside a polygon.
bbox_ne_latNoFloatNortheast latitude for bounding box.
bbox_ne_lngNoFloatNortheast longitude for bounding box.
bbox_sw_latNoFloatSouthwest latitude for bounding box.
bbox_sw_lngNoFloatSouthwest 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.

Response object

Type declarations are available at the bottom of this page.

NameTypeDescription
cache_hitBooleanIndicates if the response was a cache hit
cost_centsIntegerCost of the request in cents
dataArray<AggregateData>Array containing the aggregation results data
errorStringDetails about the error. Empty if no error
price_quoteBooleanIndicates whether the response is a price quote
time_msIntegerTime taken for the request to complete in milliseconds

AggregateData object

Each aggregation result contains:

NameTypeDescription
fieldStringThe field that was aggregated (e.g., 'estimate_list_price', 'bedroom')
aggregationStringThe aggregation method used (e.g., 'median', 'mean', 'count', 'sum')
valueStringThe calculated aggregate value as a string

Example requests and responses

Programming language

Select the programming language you want to display the code examples in.

Get the average list price in a community
This request returns the median list price of properties in the Riverbend community in Calgary, Alberta, Canada.
Request
Shell session
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"
TypeScript code
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);
})();
Response
JSON
{
  "cache_hit": false,
  "cost_cents": 1.0,
  "data": [
    {
      "aggregation": "median",
      "field": "estimate_list_price",
      "value": "616183.500"
    }
  ],
  "error": "",
  "price_quote": false,
  "time_ms": 66
}
Multiple batched aggregate query
This request performs multiple aggregate operations batched together.
Request
Shell session
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"
TypeScript code
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);
})();
Response
JSON
{
  "cache_hit": false,
  "cost_cents": 2.0,
  "data": [
    {
      "aggregation": "sum",
      "field": "bedroom",
      "value": "183278"
    },
    {
      "aggregation": "median",
      "field": "estimate_list_price",
      "value": "685121"
    }
  ],
  "error": "",
  "price_quote": false,
  "time_ms": 74
}

Response type declarations

TypeScript code
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;
}