> ## AI Agent Context
> - Full documentation index: https://aistudio.google.com/llms.txt
> - Gemini Docs MCP server (consistent live info): https://gemini-api-docs-mcp.dev
> - Coding agent skills & setup guide: https://aistudio.google.com/docs/coding-agents.md

# Listing documents

{% mark class="http-get" %}{% icon name="south_west" /%}`GET`{% /mark %} `https://generativelanguage.googleapis.com/v1beta/fileSearchStores/{fileSearchStore}/documents`

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

{% two-column-layout %}
  {% left-column %}
## Parameters  {% class="hide-from-toc" id="parameters" %}

  {% section class="api-ref-property-list" %}
  **fileSearchStore**: {% mark %}required{% /mark %} `string`

  The file search store ID. Forms the resource name `fileSearchStores/{fileSearchStore}`.

  {% hr /%}

  **pageSize**: `integer`

  Optional. The maximum number of [`Document`](/api-reference/file-search/documents/list-documents#Resource:Document)s to return (per page). The service may return fewer [`Document`](/api-reference/file-search/documents/list-documents#Resource:Document)s. If unspecified, at most 10 [`Document`](/api-reference/file-search/documents/list-documents#Resource:Document)s will be returned. The maximum size limit is 20 [`Document`](/api-reference/file-search/documents/list-documents#Resource:Document)s per page.

  {% hr /%}

  **pageToken**: `string`

  Optional. A page token, received from a previous `ListDocuments` call. Provide the `next_page_token` returned in the response as an argument to the next request to retrieve the next page. When paginating, all other parameters provided to `ListDocuments` must match the call that provided the page token.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example request** {% class="example-heading" %}

  {% tabs %}
  {% tab label="REST" %}
  ```sh
  curl -X GET "https://generativelanguage.googleapis.com/v1beta/fileSearchStores/$FILE_SEARCH_STORE_ID/documents" \
    -H "x-goog-api-key: $GEMINI_API_KEY"
  ```

  {% /tab %}

  {% /tabs %}

  {% /right-column %}

{% /two-column-layout %}

{% two-column-layout %}
  {% left-column %}
## Response  {% class="hide-from-toc" id="response" %}

  {% section class="api-ref-property-list" %}
  **documents**: [`Document`](/api-reference/file-search/documents/list-documents#Resource:Document) `array`

  The returned [`Document`](/api-reference/file-search/documents/list-documents#Resource:Document)s.

  {% hr /%}

  **nextPageToken**: `string`

  A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no more pages.

  {% /section %}

  {% /left-column %}

  {% right-column class="sticky" %}
  **Example response** {% class="example-heading" %}

  ```json
  {
    "documents": [
      {
        "name": "string",
        "displayName": "string",
        "customMetadata": [
          {
            "key": "string",
            "stringValue": "string",
            "stringListValue": {
              "values": [
                "..."
              ]
            },
            "numericValue": 0.0
          }
        ],
        "updateTime": "string",
        "createTime": "string",
        "state": "STATE_UNSPECIFIED",
        "sizeBytes": "string",
        "mimeType": "string"
      }
    ],
    "nextPageToken": "string"
  }
  ```

  {% /right-column %}

{% /two-column-layout %}

## Resources  {% class="hide-from-toc" id="resources" %}

### Document  {% class="hide-from-toc" id="Resource:Document" %}

A [`Document`](/api-reference/file-search/documents/list-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/list-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/list-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/list-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/list-documents#Resource:Document) was last updated.

  {% hr /%}

  **createTime**: `string`

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

  {% hr /%}

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

  Output only. Current state of the [`Document`](/api-reference/file-search/documents/list-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/list-documents#Resource:Document) are being processed (embedding and vector storage).
  - `STATE_ACTIVE`: All `Chunks` of the [`Document`](/api-reference/file-search/documents/list-documents#Resource:Document) is processed and available for querying.
  - `STATE_FAILED`: Some `Chunks` of the [`Document`](/api-reference/file-search/documents/list-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 %}

