{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-gemini/json-schema/google-gemini-document-schema.json",
  "title": "Document",
  "description": "A `Document` is a collection of `Chunk`s.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-gemini-file-search-stores-api-openapi.yml#/components/schemas/Document",
  "type": "object",
  "properties": {
    "state": {
      "description": "Output only. Current state of the `Document`.",
      "enum": [
        "STATE_UNSPECIFIED",
        "STATE_PENDING",
        "STATE_ACTIVE",
        "STATE_FAILED"
      ],
      "readOnly": true,
      "type": "string"
    },
    "sizeBytes": {
      "description": "Output only. The size of raw bytes ingested into the Document.",
      "format": "int64",
      "readOnly": true,
      "type": "string"
    },
    "updateTime": {
      "format": "google-datetime",
      "type": "string",
      "description": "Output only. The Timestamp of when the `Document` was last updated.",
      "readOnly": true
    },
    "displayName": {
      "description": "Optional. The human-readable display name for the `Document`. The display name must be no more than 512 characters in length, including spaces. Example: \"Semantic Retriever Documentation\"",
      "type": "string"
    },
    "createTime": {
      "readOnly": true,
      "description": "Output only. The Timestamp of when the `Document` was created.",
      "type": "string",
      "format": "google-datetime"
    },
    "name": {
      "description": "Immutable. Identifier. The `Document` resource name. The ID (name excluding the \"fileSearchStores/*/documents/\" prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be derived from `display_name` along with a 12 character random suffix. Example: `fileSearchStores/{file_search_store_id}/documents/my-awesome-doc-123a456b789c`",
      "type": "string"
    },
    "customMetadata": {
      "items": {
        "$ref": "#/$defs/CustomMetadata"
      },
      "description": "Optional. User provided custom metadata stored as key-value pairs used for querying. A `Document` can have a maximum of 20 `CustomMetadata`.",
      "type": "array"
    },
    "mimeType": {
      "type": "string",
      "readOnly": true,
      "description": "Output only. The mime type of the Document."
    }
  },
  "$defs": {
    "CustomMetadata": {
      "type": "object",
      "properties": {
        "stringValue": {
          "type": "string",
          "description": "The string value of the metadata to store."
        },
        "stringListValue": {
          "$ref": "#/$defs/StringList",
          "description": "The StringList value of the metadata to store."
        },
        "key": {
          "description": "Required. The key of the metadata to store.",
          "type": "string"
        },
        "numericValue": {
          "format": "float",
          "type": "number",
          "description": "The numeric value of the metadata to store."
        }
      },
      "description": "User provided metadata stored as key-value pairs."
    },
    "StringList": {
      "properties": {
        "values": {
          "items": {
            "type": "string"
          },
          "description": "The string values of the metadata to store.",
          "type": "array"
        }
      },
      "type": "object",
      "description": "User provided string values assigned to a single metadata key."
    }
  }
}