{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudinary/json-schema/cloudinary-search-response-schema.json",
  "title": "search_response",
  "description": "The response object returned by search operations.",
  "x-generated": "2026-11-17",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cloudinary-platform-openapi.yml#/components/schemas/search_response",
  "type": "object",
  "properties": {
    "total_count": {
      "type": "integer",
      "description": "The total number of resources matching the search criteria."
    },
    "time": {
      "type": "integer",
      "description": "The time taken to execute the search query in milliseconds."
    },
    "resources": {
      "type": "array",
      "description": "The list of resources matching the search criteria. Can be empty if no results found.",
      "items": {
        "type": "object",
        "description": "Resource fields that can be returned. All fields are optional and can be filtered using the fields parameter.",
        "properties": {
          "asset_id": {
            "type": "string",
            "description": "The unique identifier of the asset."
          },
          "public_id": {
            "type": "string",
            "description": "The public identifier that is used to build the URL."
          },
          "asset_folder": {
            "type": "string",
            "description": "The folder where the asset is stored."
          },
          "filename": {
            "type": "string",
            "description": "The original filename of the asset."
          },
          "display_name": {
            "type": "string",
            "description": "The display name of the asset."
          },
          "format": {
            "type": [
              "string",
              "null"
            ],
            "description": "The format of the asset. Null for raw assets, which have no format."
          },
          "version": {
            "type": "integer",
            "description": "The version number of the asset."
          },
          "resource_type": {
            "type": "string",
            "description": "The type of resource.",
            "enum": [
              "image",
              "video",
              "raw"
            ]
          },
          "type": {
            "$ref": "#/$defs/delivery_type_all"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "The timestamp when the asset was created."
          },
          "uploaded_at": {
            "type": "string",
            "format": "date-time",
            "description": "The timestamp when the asset was uploaded."
          },
          "bytes": {
            "type": "integer",
            "description": "The size of the asset in bytes."
          },
          "backup_bytes": {
            "type": "integer",
            "description": "The size of the backup asset in bytes."
          },
          "width": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The width of the asset in pixels. Null for non-visual assets (e.g. raw, audio)."
          },
          "height": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The height of the asset in pixels. Null for non-visual assets (e.g. raw, audio)."
          },
          "aspect_ratio": {
            "type": [
              "number",
              "null"
            ],
            "format": "float",
            "description": "The aspect ratio of the asset (width/height). Null for non-visual assets (e.g. raw, audio)."
          },
          "pixels": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The total number of pixels in the asset. Null for non-visual assets (e.g. raw, audio)."
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "The HTTP URL for accessing the asset."
          },
          "secure_url": {
            "type": "string",
            "format": "uri",
            "description": "The HTTPS URL for accessing the asset."
          },
          "status": {
            "type": "string",
            "description": "The current status of the asset.",
            "enum": [
              "active",
              "inactive",
              "deleted",
              "pending"
            ]
          },
          "access_mode": {
            "type": [
              "string",
              "null"
            ],
            "description": "The access mode of the asset. Null when not explicitly set.",
            "enum": [
              "public",
              "authenticated",
              null
            ]
          },
          "access_control": {
            "anyOf": [
              {
                "$ref": "#/$defs/access_control"
              },
              {
                "type": "null"
              }
            ],
            "description": "The access control settings for the asset."
          },
          "etag": {
            "type": "string",
            "description": "The ETag of the asset."
          },
          "created_by": {
            "type": [
              "object",
              "null"
            ],
            "description": "Information about who created the asset.",
            "properties": {
              "access_key": {
                "type": "string",
                "description": "The access key of the user who created the asset."
              }
            }
          },
          "uploaded_by": {
            "type": [
              "object",
              "null"
            ],
            "description": "Information about who uploaded the asset.",
            "properties": {
              "access_key": {
                "type": "string",
                "description": "The access key of the user who uploaded the asset."
              }
            }
          },
          "context": {
            "allOf": [
              {
                "$ref": "#/$defs/context_response"
              }
            ],
            "description": "Custom context metadata associated with the asset."
          },
          "tags": {
            "allOf": [
              {
                "$ref": "#/$defs/tags_response"
              }
            ],
            "description": "Tags associated with the asset."
          },
          "image_metadata": {
            "type": [
              "object",
              "null"
            ],
            "description": "Technical metadata extracted from the image."
          },
          "image_analysis": {
            "type": [
              "object",
              "null"
            ],
            "description": "Results of image analysis."
          },
          "metadata": {
            "type": [
              "object",
              "null"
            ],
            "description": "Structured metadata associated with the asset."
          },
          "quality_analysis": {
            "type": [
              "object",
              "null"
            ],
            "description": "Results of quality analysis."
          },
          "accessibility_analysis": {
            "type": [
              "object",
              "null"
            ],
            "description": "Results of accessibility analysis."
          }
        }
      }
    },
    "next_cursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "A cursor for pagination. Only included when there are more results available."
    },
    "aggregations": {
      "type": "object",
      "description": "Aggregation results when the aggregate parameter is used in the request. Only included when aggregations are requested.",
      "properties": {
        "values": {
          "type": "array",
          "description": "Array of aggregation values when using simple aggregation (e.g., by format, resource_type, etc.)",
          "items": {
            "type": "object",
            "properties": {
              "value": {
                "type": "string",
                "description": "The value being aggregated"
              },
              "count": {
                "type": "integer",
                "description": "The count of resources with this value"
              }
            }
          }
        },
        "ranges": {
          "type": "array",
          "description": "Array of range-based aggregation results when using range aggregation (e.g., bytes, width, height, etc.)",
          "items": {
            "type": "object",
            "properties": {
              "from": {
                "type": "number",
                "description": "Start of the range (inclusive)"
              },
              "to": {
                "type": "number",
                "description": "End of the range (exclusive)"
              },
              "count": {
                "type": "integer",
                "description": "The count of resources within this range"
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "access_control": {
      "type": "array",
      "description": "Restricts access to the asset by specifying one or more access types.\nThe asset is restricted unless at least one listed access type is valid.\n",
      "items": {
        "$ref": "#/$defs/access_control_item"
      }
    },
    "access_control_item": {
      "type": "object",
      "description": "Access control rule that defines when and how the asset can be accessed.",
      "required": [
        "access_type"
      ],
      "properties": {
        "access_type": {
          "type": "string",
          "enum": [
            "token",
            "anonymous"
          ],
          "description": "The type of access control to apply to the asset."
        },
        "key": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9]+$",
          "description": "The authentication key identifier for token-based access. Default key is used if not specified or if set to 'default'."
        },
        "start": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            }
          ],
          "description": "The start date and time when anonymous access becomes available. Accepts ISO 8601 string or Unix timestamp."
        },
        "end": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            }
          ],
          "description": "The end date and time when anonymous access expires. Accepts ISO 8601 string or Unix timestamp."
        }
      }
    },
    "asset_delivery_type": {
      "type": "string",
      "enum": [
        "asset"
      ],
      "description": "Static asset delivery type."
    },
    "context_response": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": {
        "type": "string"
      },
      "description": "Contextual metadata as flat key-value pairs."
    },
    "delivery_type_all": {
      "anyOf": [
        {
          "$ref": "#/$defs/managed_delivery_type"
        },
        {
          "$ref": "#/$defs/asset_delivery_type"
        },
        {
          "$ref": "#/$defs/fetch_delivery_type"
        },
        {
          "$ref": "#/$defs/social_delivery_type"
        },
        {
          "$ref": "#/$defs/generated_delivery_type"
        },
        {
          "type": "string",
          "enum": [
            "media_optimization"
          ]
        }
      ],
      "description": "All supported delivery types."
    },
    "fetch_delivery_type": {
      "type": "string",
      "enum": [
        "fetch",
        "url2png"
      ],
      "description": "Fetch-based delivery types for assets retrieved from remote URLs."
    },
    "generated_delivery_type": {
      "type": "string",
      "enum": [
        "multi",
        "sprite",
        "text",
        "list"
      ],
      "description": "Delivery types for assets generated by Cloudinary operations."
    },
    "managed_delivery_type": {
      "type": "string",
      "enum": [
        "upload",
        "private",
        "authenticated"
      ],
      "description": "Managed delivery types for assets uploaded and stored by Cloudinary."
    },
    "social_delivery_type": {
      "type": "string",
      "enum": [
        "facebook",
        "twitter",
        "twitter_name",
        "instagram",
        "instagram_name",
        "gravatar",
        "youtube",
        "hulu",
        "vimeo",
        "animoto",
        "dailymotion",
        "worldstarhiphop"
      ],
      "description": "Delivery types for assets fetched from third-party platforms."
    },
    "tags_response": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "type": "string"
      },
      "description": "Tag names assigned to the asset."
    }
  }
}