Skip to main content

Comparison Operators

OperatorDescriptionExample
eqEquals{"status": {"eq": "active"}}
neNot equals{"status": {"ne": "deleted"}}
gtGreater than{"size": {"gt": 1000000}}
gteGreater than or equal{"createdAt": {"gte": "2024-01-01"}}
ltLess than{"size": {"lt": 5000000}}
lteLess than or equal{"updatedAt": {"lte": "2024-12-31"}}

Example: Size Range

{
  "filter": {
    "size": {
      "gte": 100000,
      "lte": 5000000
    }
  }
}

Array Operators

OperatorDescriptionExample
inValue in array{"type": {"in": ["image/jpeg", "image/png"]}}
ninValue not in array{"tags": {"nin": ["draft", "private"]}}
allContains all values{"tags": {"all": ["hero", "product"]}}
anyContains 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

OperatorDescriptionExample
likePattern matching (% wildcard){"name": {"like": "hero%"}}
existsField exists{"metadata.width": {"exists": true}}

Example: Name Pattern

{
  "filter": {
    "name": {
      "like": "banner-%"
    }
  }
}

Example: Metadata Exists

{
  "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.