Filtering
The Sustainability Data API uses a consistent filter discovery and :filter pattern across datasets, baselines, EPDs, generic estimates, and activities. This page explains filter ids and fields, and how to build correct request bodies.
Filter discovery
For each resource, call the filter discovery endpoint (for example
GET /v3/datasets/{datasetId}/product-epds/filters) before your first
:filter request. The response includes:
actions— which surfaces (list,categories,statistics, and so on) exist and which filter ids each surface supportsfilters— a map keyed by filter id, with metadata for each filter (label,field,operators,valueSource, and so on)
Filter ids and fields
Each entry under filters in the discovery response has two identifiers:
Filter id
- The key in the
filtersmap (for examplelist_jurisdictions,category_id,supportedDataType) - The
idon each item underactions.<action>.filters[] - The
filterIdpath parameter onGET .../filters/{filterId}when you load allowed values for a dynamic filter
Field
- The
fieldproperty on the filter definition (for examplejurisdictions,id,supportedDataTypes,declaredUnit.qty) - The key you must use under
filtersin every :filter request body (POST .../list:filter, statistics, categories, impacts, and similar)
Example (datasets list, SDA-native):
- Filter id:
supportedDataType - Field:
supportedDataTypes
Use supportedDataTypes as the key in POST /v3/datasets/list:filter.
Building a :filter request
- Choose the action (for example
listorstatistics) and readactions.<action>.filtersfor supported filter ids. - For each filter you need, look up its definition in the
filtersmap and notefield,operators, andvalueSource. - If
valueSource.typeisdynamic, callGET .../filters/{filterId}using the filter id to load allowed values. - Send
POST .../<action-path>:filterwith a body shaped like:
{
"filters": {
"<field>": {
"op": "IN",
"value": ["US-CA"]
}
}
}
Replace <field> with the field value from discovery. Use an operator from that filter’s operators list and values that match dataType.
Response accounting
Successful :filter responses include:
appliedFilters— field keys from your request that were applied (each withrequested,applied, and optionalwarnings)ignoredFilters— field keys you sent that are not supported for this action (each withreason)
Unsupported field keys are reported in ignoredFilters with reason
Filter is not supported by this connector. and do not fail the request with 400.
Walkthroughs
Step-by-step examples that tie discovery, filter values, and list or statistics calls together:
See also the Filter request handling section in the API reference overview and each operation’s request schema.