Property Statistics

Get property counts by status and aggregated statistics grouped by location and type.

Retrieve summary statistics about your property inventory — status counts and location/type aggregations.

Status Counts

GET /properties/stats/counts

Authentication: Required (API key or JWT)

Returns the number of properties in each listing status for your organization.

Example

curl https://api.leadhql.com/properties/stats/counts \
  -H "Authorization: Bearer leadhql_pk_abc123"

Response

{
  "active": 48,
  "inactive": 12,
  "pending": 5,
  "sold": 23,
  "rented": 8,
  "deleted": 2
}

Aggregations

GET /properties/stats/aggregations

Authentication: Required (API key or JWT)

Returns property counts grouped by city, region, country, property type, and property category. Useful for building mega menus, filter dropdowns, and location-based widgets.

Query Parameters

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | filterByOrganization | boolean | false | Only count your organization's properties | | status | string | active | Filter by listing status: active, inactive, pending, sold, rented, deleted | | countryCode | string or string[] | — | Filter by country codes (e.g., countryCode=ES&countryCode=PT) | | region | string or string[] | — | Filter by region names | | city | string or string[] | — | Filter by city names |

Example

curl "https://api.leadhql.com/properties/stats/aggregations?status=active&countryCode=ES" \
  -H "Authorization: Bearer leadhql_pk_abc123"

Response

{
  "byCity": {
    "Marbella": {
      "total": 45,
      "byType": {
        "villa": 12,
        "apartment": 28,
        "penthouse": 5
      }
    },
    "Calpe": {
      "total": 18,
      "byType": {
        "apartment": 14,
        "townhouse": 4
      }
    }
  },
  "byRegion": {
    "Costa del Sol": {
      "total": 45,
      "byType": {
        "villa": 12,
        "apartment": 28,
        "penthouse": 5
      }
    },
    "Costa Blanca": {
      "total": 18,
      "byType": {
        "apartment": 14,
        "townhouse": 4
      }
    }
  },
  "byCountry": {
    "ES": {
      "total": 63,
      "byType": {
        "villa": 12,
        "apartment": 42,
        "penthouse": 5,
        "townhouse": 4
      }
    }
  },
  "byPropertyType": {
    "villa": 12,
    "apartment": 42,
    "penthouse": 5,
    "townhouse": 4
  },
  "byPropertyCategory": {
    "residential": 60,
    "commercial": 3
  },
  "availableCities": ["Marbella", "Calpe", "Estepona"],
  "availableRegions": ["Costa del Sol", "Costa Blanca"],
  "availableCountries": ["ES"],
  "availablePropertyTypes": ["villa", "apartment", "penthouse", "townhouse"],
  "availablePropertyCategories": ["residential", "commercial"],
  "totalProperties": 63
}

Response Fields

| Field | Type | Description | |-------|------|-------------| | byCity | object | Property counts per city, with property type breakdown | | byRegion | object | Property counts per region, with property type breakdown | | byCountry | object | Property counts per country code, with property type breakdown | | byPropertyType | object | Total count per property type across all locations | | byPropertyCategory | object | Total count per property category | | availableCities | string[] | All cities with matching properties | | availableRegions | string[] | All regions with matching properties | | availableCountries | string[] | All country codes with matching properties | | availablePropertyTypes | string[] | All property types present | | availablePropertyCategories | string[] | All property categories present | | totalProperties | number | Total count matching the filters |

LeadHQL Help

Docs & support

Hi there, how can we help?

Browse popular articles or ask a question below.

Popular articles

Or ask a question