> ## AI Agent Context
> Get the complete documentation index at: https://aistudio.google.com/llms.txt
> Use this file to discover all available pages.
> For the full documentation in a single file, fetch: https://aistudio.google.com/llms-full.txt

# Documents

The File Search API references your raw source files, or documents, as temporary File objects.

## Methods  {% id="methods" %}

{% table %}
  * Method
  * HTTP request

  ---

  * [Deleting a document](/api-reference/file-search/documents/delete-document)
  *     {% mark class="http-delete" %}{% icon name="close" /%}`DELETE`{% /mark %} `/v1beta/fileSearchStores/{fileSearchStore}/documents/{document}`

    Deletes a [`Document`](/api-reference/file-search/documents#Resource:Document).


  ---

  * [Getting a document](/api-reference/file-search/documents/get-document)
  *     {% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `/v1beta/fileSearchStores/{fileSearchStore}/documents/{document}`

    Gets information about a specific [`Document`](/api-reference/file-search/documents#Resource:Document).


  ---

  * [Listing documents](/api-reference/file-search/documents/list-documents)
  *     {% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `/v1beta/fileSearchStores/{fileSearchStore}/documents`

    Lists all [`Document`](/api-reference/file-search/documents#Resource:Document)s in a `Corpus`.

{% /table %}

## Resources  {% id="resources" %}

### Document  {% id="Resource:Document" %}

A [`Document`](/api-reference/file-search/documents#Resource:Document) is a collection of `Chunk`s.

**Properties:**

{% section class="api-ref-property-list" %}
  **name**: `string`

  Immutable. Identifier. The [`Document`](/api-reference/file-search/documents#Resource: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`

  {% hr /%}

  **displayName**: `string`

  Optional. The human-readable display name for the [`Document`](/api-reference/file-search/documents#Resource:Document). The display name must be no more than 512 characters in length, including spaces. Example: "Semantic Retriever Documentation"

  {% hr /%}

  {% details %}
  {% summary %}
  **customMetadata**: `CustomMetadata array`

  Optional. User provided custom metadata stored as key-value pairs used for querying. A [`Document`](/api-reference/file-search/documents#Resource:Document) can have a maximum of 20 `CustomMetadata`.

  {% /summary %}

  **key**: {% mark %}required{% /mark %} `string`

  The key of the metadata to store.

  {% details %}
  {% summary %}
  **value**: `Union type`

  {% /summary %}

  Union field `value` can be only one of the following:

  **stringValue**: `string`

  The string value of the metadata to store.

  {% details %}
  {% summary %}
  **stringListValue**: `StringList`

  The StringList value of the metadata to store.

  {% /summary %}

  **values**: `string array`

  The string values of the metadata to store.

  {% /details %}

  **numericValue**: `number`

  The numeric value of the metadata to store.

  {% /details %}

  {% /details %}

  {% hr /%}

  **updateTime**: `string`

  Output only. The Timestamp of when the [`Document`](/api-reference/file-search/documents#Resource:Document) was last updated.

  {% hr /%}

  **createTime**: `string`

  Output only. The Timestamp of when the [`Document`](/api-reference/file-search/documents#Resource:Document) was created.

  {% hr /%}

  {% details %}
  {% summary %}
  **state**: `string enum`

  Output only. Current state of the [`Document`](/api-reference/file-search/documents#Resource:Document).

  {% /summary %}

  Possible values:

  - `STATE_UNSPECIFIED`: The default value. This value is used if the state is omitted.
  - `STATE_PENDING`: Some `Chunks` of the [`Document`](/api-reference/file-search/documents#Resource:Document) are being processed (embedding and vector storage).
  - `STATE_ACTIVE`: All `Chunks` of the [`Document`](/api-reference/file-search/documents#Resource:Document) is processed and available for querying.
  - `STATE_FAILED`: Some `Chunks` of the [`Document`](/api-reference/file-search/documents#Resource:Document) failed processing.

  {% /details %}

  {% hr /%}

  **sizeBytes**: `string`

  Output only. The size of raw bytes ingested into the Document.

  {% hr /%}

  **mimeType**: `string`

  Output only. The mime type of the Document.

{% /section %}

