{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/infiniteaudience-ai/json-schema/infiniteaudience-ai-filter-schema.json",
  "title": "Filter",
  "description": "A single filter condition for audience discovery or job execution",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/infiniteaudience-ai-discovery-api-openapi.yml#/components/schemas/Filter",
  "type": "object",
  "required": [
    "field",
    "op"
  ],
  "properties": {
    "field": {
      "type": "string",
      "description": "Canonical catalog field_name (e.g. age or state). ZIP5 also accepts zip, zip_code, or postal_code as input aliases; saved responses use zip5."
    },
    "op": {
      "type": "string",
      "enum": [
        "=",
        "!=",
        "<",
        "<=",
        ">",
        ">=",
        "IN",
        "NOT IN",
        "BETWEEN",
        "LIKE",
        "ARRAY_CONTAINS",
        "ARRAY_CONTAINS_ANY",
        "IS NULL",
        "IS NOT NULL"
      ],
      "description": "Comparison operator"
    },
    "text_comparison": {
      "type": "string",
      "enum": [
        "exact",
        "case_insensitive"
      ],
      "description": "Optional STRING comparison mode for =, !=, IN, NOT IN, and LIKE, or ARRAY<STRING> membership mode for ARRAY_CONTAINS and ARRAY_CONTAINS_ANY. Defaults to exact. Case-insensitive mode applies Unicode case folding to both the stored value and the supplied value.\n"
    },
    "trim_whitespace": {
      "type": "boolean",
      "description": "Optionally trim leading and trailing whitespace on both sides of a STRING or ARRAY<STRING> comparison. Defaults to false; independent of text_comparison.\n"
    },
    "value": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        },
        {
          "type": "boolean"
        },
        {
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              }
            ]
          }
        }
      ],
      "description": "The value to match against. For state, a published two-letter code or full State name is accepted and normalized to the code. Scalar types (`string`, `number`, `boolean`) are used for single-value operators (`=`, `!=`, `<`, `<=`, `>`, `>=`, `LIKE`, `ARRAY_CONTAINS`). Pass an **array** for `IN`, `NOT IN`, and `ARRAY_CONTAINS_ANY` — pass the array directly with no comma-encoding. `BETWEEN` takes a two-element array `[low, high]`. Omit entirely for `IS NULL` / `IS NOT NULL` checks.\n"
    }
  }
}