Filters
Target participants using typed slug filters with structured operators.
Filters let you target participants by demographics, geography, profession, and participation history. Each filter is a single-key object where the key is a typed slug and the value contains operators.
Typed Slug Format
Filters use the format {type}--{attribute}. For example: integer--age, multi_select--country.
Why typed slugs?
The {type}--{slug} format encodes the filter's data type in the slug itself. This is intentional:
- Self-describing payloads. You can validate operators client-side without fetching the catalog first. An
integer--filter takes$gte/$lte, amulti_select--filter takes$in/$eq. - Future cross-platform portability. The typed slug format is designed to enable mapping filters from other panel providers in the future.
Operators
| Operator | Meaning | Applies to |
|---|---|---|
$eq | Equals | single_select, multi_select |
$in | Any of | single_select, multi_select, reference |
$gte | Greater than or equal | integer |
$lte | Less than or equal | integer |
$all | All of | reference |
There is no exclusion operator, so list the values to include. An operator that a filter does not support returns a BAD_REQUEST error.
Example
[
{ "integer--age": { "$gte": 25, "$lte": 45 } },
{ "multi_select--country": { "$in": ["US", "CA"] } },
{ "multi_select--job_function": { "$eq": "engineering" } }
]Base Audience
Every opportunity keeps a location filter and an age filter. When the filters you send have no location filter (multi_select--country, multi_select--state or multi_select--city), Terac adds one for the United States. When they have no integer--age filter, it adds one for 18 and over. An opportunity created with unrestricted_audience: true and no filters therefore recruits people 18 or over living in the United States, in any language. To recruit elsewhere, send a location filter.
The added filters are stored like the ones you sent, so GET /opportunities/{opportunityId} returns them in filters:
[
{ "multi_select--country": { "$eq": "US" } },
{ "integer--age": { "$gte": 18 } }
]A PATCH that sends filters replaces the whole list, and Terac adds the base again for whichever of the two the new list lacks. An opportunity that does not carry the base yet, such as one created before this rule, gets it when it launches or resumes.
Supported Filters
This API is in beta. Only filters listed in the filter catalog are supported. Unrecognized slugs will return a BAD_REQUEST error. Support for additional custom filters and cross-platform filter mapping is on the roadmap.