{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/coactive/main/json-schema/coactive-search-image-search-request-schema.json",
  "title": "ImageSearchRequest",
  "description": "Image search request. Either CID or public_url must be provided.",
  "x-generated": "2026-10-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/coactive-search-search-api-openapi.yml#/components/schemas/search_ImageSearchRequest",
  "type": "object",
  "properties": {
    "dataset_id": {
      "type": "string",
      "format": "uuid",
      "description": "The unique identifier for the dataset"
    },
    "offset": {
      "type": "integer",
      "default": 0,
      "description": "Starting index to return"
    },
    "limit": {
      "type": "integer",
      "default": 100,
      "description": "Max number of items to return"
    },
    "metadata_filters": {
      "oneOf": [
        {
          "$ref": "#/$defs/search_MetadataFilters"
        },
        {
          "type": "null"
        }
      ],
      "description": "List of metadata filters to apply to the search"
    },
    "moderation_score_type": {
      "$ref": "#/$defs/search_ScoreType",
      "description": "Type of moderation scores to return when moderation is enabled.probability returns scores 0-1 using BGE Reranker model.level returns scores 0-5 using OpenAI model.This does not enable/disable moderation - use skip_moderation for that."
    },
    "coactive_image_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The image to search for represented with a CID"
    },
    "public_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "The image to search for represented with a public http url"
    },
    "upload_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The upload ID to search for"
    },
    "asset_type": {
      "oneOf": [
        {
          "$ref": "#/$defs/search_AssetType"
        },
        {
          "type": "null"
        }
      ],
      "description": "The asset type to filter results by. If no asset type is selected the endpoint will search over images and videos"
    },
    "skip_moderation": {
      "type": "boolean",
      "default": false,
      "description": "Skip content moderation if enabled"
    }
  },
  "required": [
    "dataset_id"
  ],
  "$defs": {
    "search_AssetType": {
      "type": "string",
      "enum": [
        "image",
        "video"
      ],
      "title": "AssetType"
    },
    "search_BooleanEqualsClause": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string"
        },
        "operator": {
          "type": "string",
          "enum": [
            "=="
          ]
        },
        "value": {
          "type": "boolean"
        }
      },
      "required": [
        "key",
        "operator",
        "value"
      ],
      "title": "BooleanEqualsClause"
    },
    "search_DateTimeRangeInclusiveClause": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string"
        },
        "start_utc_epoch": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "end_utc_epoch": {
          "type": [
            "number",
            "null"
          ],
          "format": "double"
        },
        "operator": {
          "type": "string",
          "enum": [
            "DateTimeRangeInclusive"
          ]
        }
      },
      "required": [
        "key",
        "operator"
      ],
      "title": "DateTimeRangeInclusiveClause"
    },
    "search_EqualsClause": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string"
        },
        "operator": {
          "type": "string",
          "enum": [
            "=="
          ]
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "key",
        "operator",
        "value"
      ],
      "title": "EqualsClause"
    },
    "search_MetadataFilters": {
      "type": "object",
      "properties": {
        "filters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/search_MetadataFiltersFiltersItems"
          }
        }
      },
      "required": [
        "filters"
      ],
      "title": "MetadataFilters"
    },
    "search_MetadataFiltersFiltersItems": {
      "oneOf": [
        {
          "$ref": "#/$defs/search_BooleanEqualsClause"
        },
        {
          "$ref": "#/$defs/search_EqualsClause"
        },
        {
          "$ref": "#/$defs/search_NotEqualsClause"
        },
        {
          "$ref": "#/$defs/search_DateTimeRangeInclusiveClause"
        }
      ],
      "title": "MetadataFiltersFiltersItems"
    },
    "search_NotEqualsClause": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string"
        },
        "operator": {
          "type": "string",
          "enum": [
            "!="
          ]
        },
        "value": {
          "type": "string"
        }
      },
      "required": [
        "key",
        "operator",
        "value"
      ],
      "title": "NotEqualsClause"
    },
    "search_ScoreType": {
      "type": "string",
      "enum": [
        "probability",
        "level"
      ],
      "description": "Score type returned by the moderation service.\n- PROBABILITY: Scores in range 0-1 (uses BGE Reranker model)\n- LEVEL: Scores in range 0-5 (uses OpenAI model)",
      "title": "ScoreType"
    }
  }
}