Filtering
Narrow list results with the filter[...] query syntax and each resource's real filterable fields.
List endpoints accept filters as a filter object in the query string, written
with bracket syntax: filter[field]=value. Filters combine with AND — every
condition you add narrows the result further.
GET https://api.flavours.sa/dev/api/v2/products?filter[is_active]=1&filter[category_id]=12API-TOKEN: <your-key>X-API-Version: 2.0.0This returns products that are both active and in category 12.
Syntax
?filter[is_active]=1
?filter[is_active]=1&filter[category_id]=12
?filter[products_ids][]=prod_1&filter[products_ids][]=prod_2- Scalar filters take a single value:
filter[is_active]=1. - Array filters take repeated bracketed keys:
filter[products_ids][]=…. - Booleans accept
1/0(ortrue/false).
Filters are exact-match, not search
Every filter is an exact match, set membership (in), or a boolean toggle —
there are no partial-text (like) or range (>, <) filters. For
free-text matching, use the separate search parameter, which matches names and
a few related fields:
GET https://api.flavours.sa/dev/api/v2/products?search=cappuccinoAPI-TOKEN: <your-key>Filterable fields are defined per resource
Each endpoint declares its own filterable fields — a filter that works on one
resource is not guaranteed on another, and an unknown filter key on a resource
that validates it is rejected with a 422. Always check the endpoint's page in
the reference for its exact set. As a worked example, the products list
(GET /v2/products) supports:
filter[...] key | Type | Matches |
|---|---|---|
is_active | boolean | Active (1) or inactive (0) products. |
category_id | integer | Products in the given category. |
has_category | boolean | Products that have (1) / lack (0) a category. |
has_options | boolean | Products that have (1) / lack (0) modifier options. |
products_ids[] | string[] | Products whose id is in the given set. |
payment_method_key | string | Influences pricing for the given payment method. |
order_type_key | string | Excludes products not available for the order type. |
Market and branch scope come from your credential
On the products list, market_id and branch_id are derived from the
authenticated account's context, not from the query. Passing
filter[market_id] there does not override that scope.
Combining with pagination and sorting
Filters stack with pagination and sorting in a single request:
GET https://api.flavours.sa/dev/api/v2/products?filter[is_active]=1&sort=-created_at&per_page=50API-TOKEN: <your-key>X-API-Version: 2.0.0Returns active products, newest first, 50 per page.