Applying Filters to Queries

Windsor.ai provides flexible filtering and date selection options that allow you to retrieve precisely the data you need from any supported connector. This guide explains how to apply date ranges and data filters using the latest API syntax and best practices.
Introduction
You can control the data returned by the API in two main ways:
Date filtering: define the time range for the data.
Data filtering: apply conditions to fields such as campaign, spend, clicks, or impressions.
Both options are applied using URL query parameters and can be combined in a single request.
Date filtering
You can specify date ranges using either presets or explicit dates.
Option 1: Date presets
Date presets are the easiest way to request commonly used time ranges.
Example:
⚠️ Note: If
date_tois not specified, the API defaults to today and returns the most recent available data.
Data filtering
Data filters allow you to include or exclude rows based on field values. Filters use a JSON array format, which improves readability and supports grouping and nesting.
Filter structure
Each condition follows this format:
Conditions can be combined using:
"and""or"
Nested arrays can be used to create complex logic.
Supported filter operators
The filtering functionality supports several filter operators that can be used to define different types of criteria. These operators are used in combination with the field name and the desired value to create a filter.
The following filter operators are available:
| Operator | Description | Example |
|---|---|---|
eq | Equals | ["campaign","eq","Summer Sale"] |
neq | Not equals | ["campaign","neq","Winter Sale"] |
gt | Greater than | ["spend","gt",100] |
gte | Greater or equal | ["spend","gte",100] |
lt | Less than | ["spend","lt",100] |
lte | Less or equal | ["spend","lte",100] |
contains | Contains substring | ["campaign","contains","Sale"] |
ncontains | Does not contain the substring | ["campaign","ncontains","Test"] |
null | Field is null | ["clicks","null",null] |
notnull | Field is not null | ["clicks","notnull",null] |
-
eq(Equals): Matches records where the field value is equal to the specified value. -
neq(Not Equals): Matches records where the field value is not equal to the specified value. -
gt(Greater Than): Matches records where the field value is greater than the specified value. -
gte(Greater Than or Equal To): Matches records where the field value is greater than or equal to the specified value. -
lt(Less Than): Matches records where the field value is less than the specified value. -
lte(Less Than or Equal To): Matches records where the field value is less than or equal to the specified value. -
contains: Matches records where the field value contains the specified value. -
ncontains: Matches records where the field value does not contain the specified value.
Filter examples
⚠️ Important: For real API requests, the
filterparameter must be URL-encoded. The examples below are shown in plain JSON for readability.
Single filter
https://connectors.windsor.ai/facebook?fields=date,campaign,spend&filter=[["campaign","eq","Summer Sale"]]&api_key={your_api_key}Check for null values
https://connectors.windsor.ai/facebook?fields=date,campaign,clicks&filter=[["clicks","null",null]]&api_key={your_api_key}Multiple conditions (AND)
https://connectors.windsor.ai/facebook?fields=date,spend&filter=[["spend","gt",100],"and",["campaign","contains","Sale"]]&api_key={your_api_key}Nested conditions (AND + OR)
Conclusion
Windsor.ai’s filtering system gives you precise control over both time ranges and data conditions. By combining flexible date presets with structured JSON-based filters, you can build powerful queries that return exactly the data you need, whether for dashboards, reporting, or advanced analytics.
🚀 Try it in your analytics workflow right now: https://onboard.windsor.ai/.
Windsor vs Coupler.io

