Introduction to Filter Queries
Filter by (a) specific field(s) of a content type. The filter_query parameter accepts a field and an operation key. Separate the values by a comma to filter by multiple values. The following syntax applies:
stories/?filter_query[field][operation]=value1,value2
You can use multiple filter queries per request. By default, the AND operator connects the applied filters, so a story must match every filter to appear in the results. For example, the following request returns only stories whose category is news and whose author is jane:
stories/?filter_query[category][in]=news&filter_query[author][in]=jane
To return stories that match any of the filters instead, connect them with the OR operator (Content Delivery API only) using the __or syntax:
stories/?filter_query[__or][][field][operation]=value&filter_query[__or][][field][operation]=value
For example, the following request returns stories whose category is news, plus stories whose author is jane, even when they don’t match both:
stories/?filter_query[__or][][category][in]=news&filter_query[__or][][author][in]=jane
https://api.storyblok.com/v2/cdn/stories?filter_query[field][operation]=value&token=ask9soUkv02QqbZgmZdeDAttThe filter_query use cases throughout this section are based on the example story type for a simple blog article represented by the story object below.
The usage of filter_query is not limited to the fields of this example. Every custom field defined for a story type is included in the content object of a story object and can, therefore, be used as the field key in a filter_query.
Operations
Section titled “Operations”isMatches a value type (empty, not_empty, empty_array, not_empty_array, true, false, null, not_null)inMatches all with the exact specified valuenot_inMatches all without the exact specified valuelikeMatches all with the specified value (wildcard allowed)not_likeMatches all without the specified value (wildcard allowed)any_in_arrayMatches if any of the specified values is contained in the field value (array). Content Delivery API only; for the Management API, use
in_array.in_arrayManagement API equivalent of
any_in_array: matches if any of the specified values is contained in the field value (array). Deprecated for the Content Delivery API in favor ofany_in_array.all_in_arrayMatches if all specified values are contained in the field value (array)gt_dateGreater than date (Format: YYYY-mm-dd HH:MM)lt_dateEarlier than date (Format: YYYY-MM-DD HH:MM)gt_intGreater than integer valuelt_intLower than integer valuegt_floatGreater than float valuelt_floatLower than float value
Was this page helpful?
This site uses reCAPTCHA and Google's Privacy Policy (opens in a new window).Terms of Service (opens in a new window) apply.
Get in touch with the Storyblok community