{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/coactive/main/json-schema/coactive-search-metadata-filter-metadata-search-request-schema.json",
  "title": "MetadataSearchRequest",
  "description": "Body for POST /search/metadata.",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coactive-search-metadata-filter-api-openapi.yml#/components/schemas/search-metadata-filter_MetadataSearchRequest",
  "type": "object",
  "properties": {
    "limit": {
      "type": "integer",
      "default": 40,
      "description": "Max number of results to return"
    },
    "offset": {
      "type": "integer",
      "default": 0,
      "description": "Number of results to skip before returning"
    },
    "metadata_filters": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/search-metadata-filter_MetadataFilter"
      },
      "description": "List of filter objects applied against asset metadata fields before scoring. All filters are combined with AND."
    },
    "skip_moderation": {
      "type": "boolean",
      "default": false,
      "description": "When true, moderation scoring is skipped and moderation_score will be null on all results."
    },
    "dataset_id": {
      "type": "string",
      "format": "uuid",
      "description": "Dataset to search within"
    },
    "text_query": {
      "type": "string",
      "description": "Natural language query encoded into an embedding to score visual content via vector similarity."
    }
  },
  "required": [
    "dataset_id",
    "text_query"
  ],
  "$defs": {
    "search-metadata-filter_MetadataFilter": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "Name of the metadata field to filter on (must exist on the dataset's assets)."
        },
        "value": {
          "type": "string",
          "description": "Value to compare the metadata field against. Always provided as a string; numerical operators (>, <, >=, <=) parse it as a number."
        },
        "op": {
          "$ref": "#/$defs/search-metadata-filter_MetadataFilterOperator",
          "description": "Comparison operator. Defaults to `=` (equality)."
        }
      },
      "required": [
        "key",
        "value"
      ],
      "description": "A single filter applied against an asset metadata field before scoring.",
      "title": "MetadataFilter"
    },
    "search-metadata-filter_MetadataFilterOperator": {
      "type": "string",
      "enum": [
        "=",
        "!=",
        "contains",
        ">",
        "<",
        ">=",
        "<="
      ],
      "description": "Comparison operator applied between a metadata field value and the filter `value`.",
      "title": "MetadataFilterOperator"
    }
  }
}