Comparison Operators
| Operator | Description | Example |
|---|
eq | Equals | {"status": {"eq": "active"}} |
ne | Not equals | {"status": {"ne": "deleted"}} |
gt | Greater than | {"size": {"gt": 1000000}} |
gte | Greater than or equal | {"createdAt": {"gte": "2024-01-01"}} |
lt | Less than | {"size": {"lt": 5000000}} |
lte | Less than or equal | {"updatedAt": {"lte": "2024-12-31"}} |
Example: Size Range
{
"filter": {
"size": {
"gte": 100000,
"lte": 5000000
}
}
}
Array Operators
| Operator | Description | Example |
|---|
in | Value in array | {"type": {"in": ["image/jpeg", "image/png"]}} |
nin | Value not in array | {"tags": {"nin": ["draft", "private"]}} |
all | Contains all values | {"tags": {"all": ["hero", "product"]}} |
any | Contains any value | {"tags": {"any": ["hero", "banner"]}} |
Example: Multiple Types
{
"filter": {
"type": {
"in": ["image/jpeg", "image/png", "image/webp"]
}
}
}
Example: Tag Matching
{
"filter": {
"tags": {
"all": ["hero", "homepage"]
}
}
}
Pattern Operators
| Operator | Description | Example |
|---|
like | Pattern matching (% wildcard) | {"name": {"like": "hero%"}} |
exists | Field exists | {"metadata.width": {"exists": true}} |
Example: Name Pattern
{
"filter": {
"name": {
"like": "banner-%"
}
}
}
{
"filter": {
"metadata.width": {
"exists": true
},
"metadata.height": {
"exists": true
}
}
}
Combining Operators
Multiple operators can be combined within a single filter:
{
"filter": {
"type": {
"in": ["image/jpeg", "image/png"]
},
"size": {
"gte": 10000,
"lt": 5000000
},
"tags": {
"any": ["hero", "product"]
},
"status": {
"eq": "active"
},
"createdAt": {
"gte": "2024-01-01T00:00:00Z"
}
}
}
All filter conditions are combined with AND logic. An asset must match all conditions to be included in results.