Repository Public
1The File Search API references your raw source files, or documents, as temporary File objects.23## Method: fileSearchStores.documents.delete45- [Endpoint](https://ai.google.dev/api/file-search/documents#body.HTTP_TEMPLATE)6- [Path parameters](https://ai.google.dev/api/file-search/documents#body.PATH_PARAMETERS)7- [Query parameters](https://ai.google.dev/api/file-search/documents#body.QUERY_PARAMETERS)8- [Request body](https://ai.google.dev/api/file-search/documents#body.request_body)9- [Response body](https://ai.google.dev/api/file-search/documents#body.response_body)10- [Authorization scopes](https://ai.google.dev/api/file-search/documents#body.aspect)1112Deletes a `Document`.1314### Endpoint1516delete `https://generativelanguage.googleapis.com/v1beta/{name=fileSearchStores/*/documents/*}` 1718### Path parameters1920`name` `string` Required. The resource name of the `Document` to delete. Example: `fileSearchStores/my-file-search-store-123/documents/the-doc-abc` It takes the form `fileSearchStores/{filesearchstore}/documents/{document}`.2122### Query parameters2324`force` `boolean` Optional. If set to true, any `Chunk`s and objects related to this `Document` will also be deleted.2526If false (the default), a `FAILED_PRECONDITION` error will be returned if `Document` contains any `Chunk`s.2728### Request body2930The request body must be empty.3132### Response body3334If successful, the response body is an empty JSON object.3536## Method: fileSearchStores.documents.get3738- [Endpoint](https://ai.google.dev/api/file-search/documents#body.HTTP_TEMPLATE)39- [Path parameters](https://ai.google.dev/api/file-search/documents#body.PATH_PARAMETERS)40- [Request body](https://ai.google.dev/api/file-search/documents#body.request_body)41- [Response body](https://ai.google.dev/api/file-search/documents#body.response_body)42- [Authorization scopes](https://ai.google.dev/api/file-search/documents#body.aspect)4344Gets information about a specific `Document`.4546### Endpoint4748get `https://generativelanguage.googleapis.com/v1beta/{name=fileSearchStores/*/documents/*}` 4950### Path parameters5152`name` `string` Required. The name of the `Document` to retrieve. Example: `fileSearchStores/my-file-search-store-123/documents/the-doc-abc` It takes the form `fileSearchStores/{filesearchstore}/documents/{document}`.5354### Request body5556The request body must be empty.5758### Response body5960If successful, the response body contains an instance of `https://ai.google.dev/api/file-search/documents#Document`.6162## Method: fileSearchStores.documents.list6364- [Endpoint](https://ai.google.dev/api/file-search/documents#body.HTTP_TEMPLATE)65- [Path parameters](https://ai.google.dev/api/file-search/documents#body.PATH_PARAMETERS)66- [Query parameters](https://ai.google.dev/api/file-search/documents#body.QUERY_PARAMETERS)67- [Request body](https://ai.google.dev/api/file-search/documents#body.request_body)68- [Response body](https://ai.google.dev/api/file-search/documents#body.response_body)69 - [JSON representation](https://ai.google.dev/api/file-search/documents#body.ListDocumentsResponse.SCHEMA_REPRESENTATION)70- [Authorization scopes](https://ai.google.dev/api/file-search/documents#body.aspect)7172Lists all `Document`s in a `Corpus`.7374### Endpoint7576get `https://generativelanguage.googleapis.com/v1beta/{parent=fileSearchStores/*}/documents` 7778### Path parameters7980`parent` `string` Required. The name of the `FileSearchStore` containing `Document`s. Example: `fileSearchStores/my-file-search-store-123` It takes the form `fileSearchStores/{filesearchstore}`.8182### Query parameters8384`pageSize` `integer` Optional. The maximum number of `Document`s to return (per page). The service may return fewer `Document`s.8586If unspecified, at most 10 `Document`s will be returned. The maximum size limit is 20 `Document`s per page.87`pageToken` `string` Optional. A page token, received from a previous `documents.list` call.8889Provide the `nextPageToken` returned in the response as an argument to the next request to retrieve the next page.9091When paginating, all other parameters provided to `documents.list` must match the call that provided the page token.9293### Request body9495The request body must be empty.9697### Response body9899Response from `documents.list` containing a paginated list of `Document`s. The `Document`s are sorted by ascending `document.create_time`.100101If successful, the response body contains data with the following structure:102Fields `documents[]` ``object (`https://ai.google.dev/api/file-search/documents#Document`)`` The returned `Document`s.103`nextPageToken` `string` A token, which can be sent as `pageToken` to retrieve the next page. If this field is omitted, there are no more pages.104105| JSON representation |106|---|107| ``` { "documents": [ { object (`https://ai.google.dev/api/file-search/documents#Document`) } ], "nextPageToken": string } ``` |108109## REST Resource: fileSearchStores.documents110111- [Resource: Document](https://ai.google.dev/api/file-search/documents#Document)112 - [JSON representation](https://ai.google.dev/api/file-search/documents#Document.SCHEMA_REPRESENTATION)113- [CustomMetadata](https://ai.google.dev/api/file-search/documents#CustomMetadata)114 - [JSON representation](https://ai.google.dev/api/file-search/documents#CustomMetadata.SCHEMA_REPRESENTATION)115- [StringList](https://ai.google.dev/api/file-search/documents#StringList)116 - [JSON representation](https://ai.google.dev/api/file-search/documents#StringList.SCHEMA_REPRESENTATION)117- [State](https://ai.google.dev/api/file-search/documents#State)118- [Methods](https://ai.google.dev/api/file-search/documents#METHODS_SUMMARY)119120## Resource: Document121122A `Document` is a collection of `Chunk`s.123Fields `name` `string` 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 `displayName` along with a 12 character random suffix. Example: `fileSearchStores/{file_search_store_id}/documents/my-awesome-doc-123a456b789c`124`displayName` `string` 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"125`customMetadata[]` ``object (`https://ai.google.dev/api/file-search/documents#CustomMetadata`)`` Optional. User provided custom metadata stored as key-value pairs used for querying. A `Document` can have a maximum of 20 `CustomMetadata`.126`updateTime` ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The Timestamp of when the `Document` was last updated.127128Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`.129`createTime` ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The Timestamp of when the `Document` was created.130131Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`.132`state` ``enum (`https://ai.google.dev/api/file-search/documents#State`)`` Output only. Current state of the `Document`.133`sizeBytes` `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The size of raw bytes ingested into the Document.134`mimeType` `string` Output only. The mime type of the Document.135136| JSON representation |137|---|138| ``` { "name": string, "displayName": string, "customMetadata": [ { object (`https://ai.google.dev/api/file-search/documents#CustomMetadata`) } ], "updateTime": string, "createTime": string, "state": enum (`https://ai.google.dev/api/file-search/documents#State`), "sizeBytes": string, "mimeType": string } ``` |139140## CustomMetadata141142User provided metadata stored as key-value pairs.143Fields `key` `string` Required. The key of the metadata to store.144`value` `Union type` The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: `stringValue` `string` The string value of the metadata to store.145`stringListValue` ``object (`https://ai.google.dev/api/file-search/documents#StringList`)`` The StringList value of the metadata to store.146`numericValue` `number` The numeric value of the metadata to store.147End of mutually exclusive fields.148149| JSON representation |150|---|151| ``` { "key": string, // value "stringValue": string, "stringListValue": { object (`https://ai.google.dev/api/file-search/documents#StringList`) }, "numericValue": number // Union type } ``` |152153## StringList154155User provided string values assigned to a single metadata key.156Fields `values[]` `string` The string values of the metadata to store.157158| JSON representation |159|---|160| ``` { "values": [ string ] } ``` |161162## State163164States for the lifecycle of a `Document`.165166| Enums ||167|---|---|168| `STATE_UNSPECIFIED` | The default value. This value is used if the state is omitted. |169| `STATE_PENDING` | Some `Chunks` of the `Document` are being processed (embedding and vector storage). |170| `STATE_ACTIVE` | All `Chunks` of the `Document` is processed and available for querying. |171| `STATE_FAILED` | Some `Chunks` of the `Document` failed processing. |