> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.repliers.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Using Aggregates To Determine Distinct Values For Filters and Parameters

The Repliers real estate APIs include a powerful feature called "aggregates," which allows users to determine distinct values for certain parameters and filters. This guide will explain how to use this feature effectively.

###### Determining Distinct Values

To find out what values you can use for a specific parameter like propertyType, you can make a request to the Repliers API with the aggregates query parameter. For example:

https://api.repliers.io/listings?aggregates=details.propertyType

In the response, you will receive an **aggregates** object containing the possible values and their respective counts. Here is an example of what the response might look like:

```json
{
  "aggregates": {
    "details": {
      "propertyType": {
        "Apartment/Condo": 8844,
        "House/Single Family": 8661,
        "Townhouse": 3114,
        "Vacant Land": 1021,
        "Business": 1001,
        "House With Acreage": 865,
        "Industrial": 804,
        "Office": 738,
        "Retail": 680,
        "1/2 Duplex": 594,
        "Land Commercial": 328,
        "Multi-Family Commercial": 136,
        "Manufactured": 134,
        "Business With Property": 83,
        "Other": 83,
        "Agri-Business": 70,
        "Duplex": 60,
        "Manufactured With Land": 41,
        "Row House (Non-Strata)": 38,
        "Recreational": 25,
        "Triplex": 17,
        "Fourplex": 15
      }
    }
  }
}
```

**Important** - the values in the response above will vary. It's important that you make a request for aggregates using your API Key to determine the values specific to the MLS® you have access to.

###### Optimizing Aggregate Requests with listings=false

When you only need aggregate data and don't require the actual listing results, you can significantly improve response times by setting the `listings` parameter to `false`. For example:
[https://api.repliers.io/listings?aggregates=details.propertyType&listings=false](https://api.repliers.io/listings?aggregates=details.propertyType&listings=false)

Setting `listings=false` prevents the API from returning actual listing data in the response, returning only the aggregate data. This speeds up the response significantly and is recommended when listings aren't needed. The response will contain the same aggregate information but without the listings array, making it much faster and more efficient for scenarios where you're only interested in the available filter values and their counts.

###### Filtering by Property Type

Once you know the possible values, you can use them to filter your listings. For example, to filter by Fourplex, you would include the propertyType parameter in your request like this:

https://api.repliers.io/listings?propertyType=Fourplex

###### Requesting Multiple Aggregates At The Same Time

You can request multiple aggregates at the same time by comma-separating the fields you wish to aggregate values for, here's an example:

https://api.repliers.io/listings?aggregates=details.propertyType,details.style,details.numBedrooms,address.city

The values specified in the `aggregates` parameter must match keys in the listings model using dot notation.

When you use the `aggregates` parameter like `?aggregates=address.city`, the API looks for the exact path to that field in your listing model's structure. The dot notation ( `.`) represents nested object traversal.

For example, given the listing object structure:

```
{
  "address": {
    "area": "York",
    "city": "Richmond Hill",
    "country": null,
    ...
  }
}
```

The path `address.city` uses dot notation to specify:

1. Start at the root of the listing object
2. Access the `address` object
3. Then access the `city` field within that object

If you want to aggregate by other fields, you would use the same dot notation pattern:

* `address.area` for the area values
* `address.neighborhood` for neighborhoods
* `address.state` for states

The aggregation will only work if these paths exactly match the structure of your listings data model. If a path doesn't exist or is misspelled, the aggregation won't function properly.

###### Conclusion

The **aggregates** feature in Repliers APIs provides a convenient way to determine and use acceptable values for parameters like propertyType. By making a request to get the aggregates and then using these values in your filters, you can refine your searches and obtain more relevant results.

###### Supported Aggregate Fields

The following fields can be supplied to the `aggregates` parameter on `/listings`, written exactly as shown. Any field not on this list will not be aggregated.

**Top-level**

`map`, `map.latitude`, `map.longitude`, `map.point`, `type`, `class`, `resource`, `boardId` (alias of `resource`), `status`, `lastStatus`, `standardStatus` (alias of `raw.StandardStatus`), `listPrice`, `originalPrice`, `soldPrice`, `daysOnMarket`, `occupancy`, `agentsCount`, `photoCount`, `coopCompensation`, `assignment`, `lastPriceChangeType`, `size`

**address.**

`address.area`, `address.zip`, `address.country`, `address.city`, `address.state`, `address.district`, `address.neighborhood`, `address.communityCode`, `address.majorIntersection`, `address.streetNumber`, `address.streetName`, `address.streetSuffix`, `address.streetDirection`, `address.streetDirectionPrefix`, `address.unitNumber`

**openHouse.**

`openHouseType`, `openHouseStatus`

**details.**

`details.basement`, `details.basement1`, `details.basement2`, `details.exteriorConstruction`, `details.exteriorConstruction1`, `details.exteriorConstruction2`, `details.balcony`, `details.numKitchens`, `details.numKitchensPlus`, `details.numParkingSpaces`, `details.numGarageSpaces`, `details.numDrivewaySpaces`, `details.laundryLevel`, `details.zoning`, `details.zoningDescription`, `details.zoningType`, `details.certificationLevel`, `details.energyCertification`, `details.energuideRating`, `details.greenPropertyInformationStatement`, `details.den`, `details.yearBuilt`, `details.elevator`, `details.roofMaterial`, `details.sqft`, `details.sqftRange`, `details.livingAreaMeasurement`, `details.handicappedEquipped`, `details.heating`, `details.airConditioning`, `details.centralAirConditioning`, `details.centralVac`, `details.numRooms`, `details.numRoomsPlus`, `details.landscapeFeatures`, `details.landSewer`, `details.landAccessType`, `details.landDisposition`, `details.sewer`, `details.waterSource`, `details.numBathrooms`, `details.numBathroomsPlus`, `details.numBathroomsHalf`, `details.bathrooms.pieces`, `details.bathrooms.level`, `details.bathrooms.count`, `details.numBedrooms`, `details.numBedroomsPlus`, `details.businessType`, `details.businessSubType`, `details.swimmingPool`, `details.constructionStyleSplitLevel`, `details.constructionStatus`, `details.leaseTerms`, `details.flooringType`, `details.farmType`, `details.viewType`, `details.style`, `details.propertyType`, `details.loadingType`, `details.parkCostMonthly`, `details.familyRoom`, `details.extras`, `details.patio`, `details.amperage`, `details.furnished`, `details.foundationType`, `details.HOAFee`, `details.HOAFee2`, `details.HOAFee3`, `details.commonElementsIncluded`, `details.ceilingType`, `details.garage`, `details.driveway`, `details.pets`, `details.numFireplaces`, `details.fireProtection`, `details.storageType`, `details.analyticsClick`, `details.waterfront`

**condominium.**

`condominium.pets`, `condominium.condoCorp`, `condominium.condoCorpNum`, `condominium.parkingType`, `condominium.stories`, `condominium.propertyMgr`, `condominium.locker`, `condominium.lockerLevel`, `condominium.lockerNumber`, `condominium.lockerUnitNumber`, `condominium.unitNumber`, `condominium.buildingInsurance`, `condominium.sharesPercentage`, `condominium.ensuiteLaundry`, `condominium.exposure`, `condominium.ammenities`, `condominium.amenities` (alias), `condominium.fees.cableInlc`, `condominium.fees.waterIncl`, `condominium.fees.heatIncl`, `condominium.fees.taxesIncl`, `condominium.fees.parkingIncl`, `condominium.fees.hydroIncl`, `condominium.fees.maintenance`

**lot.**

`lot.depth`, `lot.size`, `lot.width`, `lot.irregular`, `lot.acres`, `lot.legalDescription`, `lot.measurement`, `lot.dimensions`, `lot.dimensionsSource`, `lot.features`, `lot.source`, `lot.squareFeet`, `lot.taxLot`

**Other nested**

`taxes.annualAmount`, `taxes.assessmentYear`, `office.brokerageName`, `nearby.ammenities`, `nearby.amenities`, `permissions.displayAddressOnInternet`, `permissions.displayPublic`, `permissions.displayOnMap`, `permissions.displayInternetEntireListing`

**commercial.**

`commercial.amps`, `commercial.areaInfluences.1`, `commercial.areaInfluences.2`, `commercial.assessment`, `commercial.businessType`, `commercial.ceilingHeightFeet`, `commercial.ceilingHeightInches`, `commercial.chattels`, `commercial.commonAreaUpcharge`, `commercial.communityCode`, `commercial.crane`, `commercial.energyCertified`, `commercial.expenses.insurance`, `commercial.expenses.maintenance`, `commercial.expenses.management`, `commercial.expenses.operating`, `commercial.expenses.water`, `commercial.expenses.yearly`, `commercial.financialStatementsAvailable`, `commercial.franchise`, `commercial.freestanding`, `commercial.greenPropertyInfoStatement`, `commercial.grossSalesIncome`, `commercial.handicapEquipped`, `commercial.industrialArea`, `commercial.industrialAreaCode`, `commercial.inventoryValuesAtCost`, `commercial.listPriceCode`, `commercial.llbo`, `commercial.lotCode`, `commercial.maxLeaseTermMonths`, `commercial.minLeaseTermMonths`, `commercial.officeArea`, `commercial.officeAreaCode`, `commercial.operatingHours`, `commercial.outOfAreaMunicipality`, `commercial.outsideStorage`, `commercial.percentageBuilding`, `commercial.percentageRent`, `commercial.rail`, `commercial.retailArea`, `commercial.retailAreaCode`, `commercial.sellerPropertyInfoStatement`, `commercial.sewer`, `commercial.soilTest`, `commercial.sprinklers`, `commercial.survey`, `commercial.taxType`, `commercial.totalAreaCode`, `commercial.trailerParkingSpots`, `commercial.uffi`, `commercial.utilities`, `commercial.vacancyAllowance`, `commercial.volts`, `commercial.water`, `commercial.waterSupplyType`, `commercial.zoning`

# What questions does this article answer?

* What is the `aggregates` feature in the Repliers API and what does it do?
* How do I get distinct values (e.g., all available `propertyType` values) from the API?
* How can I build dynamic filter UIs (dropdowns, chips, etc.) based on live API aggregates?
* How should I structure an aggregates request in practice?
* When should I use aggregates instead of hard-coding filter values in my app?
* Lookup values, metadata (comment)
