Repository Public
1The File Search API provides a hosted question answering service for building Retrieval Augmented Generation (RAG) systems using Google's infrastructure.23## REST Resource: fileSearchStores45- [Resource: FileSearchStore](https://ai.google.dev/api/file-search/file-search-stores#FileSearchStore)6 - [JSON representation](https://ai.google.dev/api/file-search/file-search-stores#FileSearchStore.SCHEMA_REPRESENTATION)7- [Methods](https://ai.google.dev/api/file-search/file-search-stores#METHODS_SUMMARY)89## Resource: FileSearchStore1011A `FileSearchStore` is a collection of `Document`s.12Fields `name` `string` Output only. Immutable. Identifier. The `FileSearchStore` resource name. It is an ID (name excluding the "fileSearchStores/" prefix) that can contain up to 40 characters that are lowercase alphanumeric or dashes (-). It is output only. The unique name will be derived from `displayName` along with a 12 character random suffix. Example: `fileSearchStores/my-awesome-file-search-store-123a456b789c` If `displayName` is not provided, the name will be randomly generated.13`displayName` `string` Optional. The human-readable display name for the `FileSearchStore`. The display name must be no more than 512 characters in length, including spaces. Example: "Docs on Semantic Retriever"14`createTime` ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The Timestamp of when the `FileSearchStore` was created.1516Uses 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"`.17`updateTime` ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The Timestamp of when the `FileSearchStore` was last updated.1819Uses 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"`.20`activeDocumentsCount` `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The number of documents in the `FileSearchStore` that are active and ready for retrieval.21`pendingDocumentsCount` `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The number of documents in the `FileSearchStore` that are being processed.22`failedDocumentsCount` `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The number of documents in the `FileSearchStore` that have failed processing.23`sizeBytes` `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The size of raw bytes ingested into the `FileSearchStore`. This is the total size of all the documents in the `FileSearchStore`.24`embeddingModel` `string` Optional. The embedding model to use for the `FileSearchStore`. The model's resource name. This serves as an ID for the Model to use. Format: `models/{model}`. If not specified, the default embedding model will be used.2526| JSON representation |27|---|28| ``` { "name": string, "displayName": string, "createTime": string, "updateTime": string, "activeDocumentsCount": string, "pendingDocumentsCount": string, "failedDocumentsCount": string, "sizeBytes": string, "embeddingModel": string } ``` |2930## Method: fileSearchStores.create3132- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)33- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)34- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)35- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)3637Creates an empty `FileSearchStore`.3839### Endpoint4041post `https://generativelanguage.googleapis.com/v1beta/fileSearchStores` 4243### Request body4445The request body contains an instance of `https://ai.google.dev/api/file-search/file-search-stores#FileSearchStore`.46Fields `displayName` `string` Optional. The human-readable display name for the `FileSearchStore`. The display name must be no more than 512 characters in length, including spaces. Example: "Docs on Semantic Retriever"47`embeddingModel` `string` Optional. The embedding model to use for the `FileSearchStore`. The model's resource name. This serves as an ID for the Model to use. Format: `models/{model}`. If not specified, the default embedding model will be used.4849### Response body5051If successful, the response body contains a newly created instance of `https://ai.google.dev/api/file-search/file-search-stores#FileSearchStore`.5253## Method: fileSearchStores.delete5455- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)56- [Path parameters](https://ai.google.dev/api/file-search/file-search-stores#body.PATH_PARAMETERS)57- [Query parameters](https://ai.google.dev/api/file-search/file-search-stores#body.QUERY_PARAMETERS)58- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)59- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)60- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)6162Deletes a `FileSearchStore`.6364### Endpoint6566delete `https://generativelanguage.googleapis.com/v1beta/{name=fileSearchStores/*}` 6768### Path parameters6970`name` `string` Required. The resource name of the `FileSearchStore`. Example: `fileSearchStores/my-file-search-store-123` It takes the form `fileSearchStores/{filesearchstore}`.7172### Query parameters7374`force` `boolean` Optional. If set to true, any `Document`s and objects related to this `FileSearchStore` will also be deleted.7576If false (the default), a `FAILED_PRECONDITION` error will be returned if `FileSearchStore` contains any `Document`s.7778### Request body7980The request body must be empty.8182### Response body8384If successful, the response body is an empty JSON object.8586## Method: fileSearchStores.get8788- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)89- [Path parameters](https://ai.google.dev/api/file-search/file-search-stores#body.PATH_PARAMETERS)90- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)91- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)92- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)9394Gets information about a specific `FileSearchStore`.9596### Endpoint9798get `https://generativelanguage.googleapis.com/v1beta/{name=fileSearchStores/*}` 99100### Path parameters101102`name` `string` Required. The name of the `FileSearchStore`. Example: `fileSearchStores/my-file-search-store-123` It takes the form `fileSearchStores/{filesearchstore}`.103104### Request body105106The request body must be empty.107108### Response body109110If successful, the response body contains an instance of `https://ai.google.dev/api/file-search/file-search-stores#FileSearchStore`.111112## Method: fileSearchStores.list113114- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)115- [Query parameters](https://ai.google.dev/api/file-search/file-search-stores#body.QUERY_PARAMETERS)116- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)117- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)118 - [JSON representation](https://ai.google.dev/api/file-search/file-search-stores#body.ListFileSearchStoresResponse.SCHEMA_REPRESENTATION)119- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)120121Lists all `FileSearchStores` owned by the user.122123### Endpoint124125get `https://generativelanguage.googleapis.com/v1beta/fileSearchStores` 126127### Query parameters128129`pageSize` `integer` Optional. The maximum number of `FileSearchStores` to return (per page). The service may return fewer `FileSearchStores`.130131If unspecified, at most 10 `FileSearchStores` will be returned. The maximum size limit is 20 `FileSearchStores` per page.132`pageToken` `string` Optional. A page token, received from a previous `fileSearchStores.list` call.133134Provide the `nextPageToken` returned in the response as an argument to the next request to retrieve the next page.135136When paginating, all other parameters provided to `fileSearchStores.list` must match the call that provided the page token.137138### Request body139140The request body must be empty.141142### Response body143144Response from `fileSearchStores.list` containing a paginated list of `FileSearchStores`. The results are sorted by ascending `fileSearchStore.create_time`.145146If successful, the response body contains data with the following structure:147Fields `fileSearchStores[]` ``object (`https://ai.google.dev/api/file-search/file-search-stores#FileSearchStore`)`` The returned rag_stores.148`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.149150| JSON representation |151|---|152| ``` { "fileSearchStores": [ { object (`https://ai.google.dev/api/file-search/file-search-stores#FileSearchStore`) } ], "nextPageToken": string } ``` |153154## Method: fileSearchStores.importFile155156- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)157- [Path parameters](https://ai.google.dev/api/file-search/file-search-stores#body.PATH_PARAMETERS)158- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)159 - [JSON representation](https://ai.google.dev/api/file-search/file-search-stores#body.request_body.SCHEMA_REPRESENTATION)160- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)161- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)162163Imports a `File` from File Service to a `FileSearchStore`.164165### Endpoint166167post `https://generativelanguage.googleapis.com/v1beta/{fileSearchStoreName=fileSearchStores/*}:importFile` 168169### Path parameters170171`fileSearchStoreName` `string` Required. Immutable. The name of the `FileSearchStore` to import the file into. Example: `fileSearchStores/my-file-search-store-123` It takes the form `fileSearchStores/{filesearchstore}`.172173### Request body174175The request body contains data with the following structure:176Fields `fileName` `string` Required. The name of the `File` to import. Example: `files/abc-123`177`customMetadata[]` ``object (`https://ai.google.dev/api/file-search/documents#CustomMetadata`)`` Custom metadata to be associated with the file.178`chunkingConfig` ``object (`ChunkingConfig`)`` Optional. Config for telling the service how to chunk the file. If not provided, the service will use default parameters.179180### Response body181182If successful, the response body contains an instance of `https://ai.google.dev/api/batch-api#Operation`.183184## REST Resource: fileSearchStores.operations185186- [Resource: Operation](https://ai.google.dev/api/file-search/file-search-stores#Operation)187 - [JSON representation](https://ai.google.dev/api/file-search/file-search-stores#Operation.SCHEMA_REPRESENTATION)188- [Methods](https://ai.google.dev/api/file-search/file-search-stores#METHODS_SUMMARY)189190## Resource: Operation191192This resource represents a long-running operation that is the result of a network API call.193Fields `name` `string` The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.194`metadata` `object` Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.195196An object containing fields of an arbitrary type. An additional field `"@type"` contains a URI identifying the type. Example: `{ "id": 1234, "@type": "types.example.com/standard/id" }`.197`done` `boolean` If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.198`result` `Union type` The operation result, which can be either an `error` or a valid `response`. If `done` == `false`, neither `error` nor `response` is set. If `done` == `true`, exactly one of `error` or `response` can be set. Some services might not provide the result. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: `error` ``object (`https://ai.google.dev/api/files#v1beta.Status`)`` The error result of the operation in case of failure or cancellation.199`response` `object` The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.200201An object containing fields of an arbitrary type. An additional field `"@type"` contains a URI identifying the type. Example: `{ "id": 1234, "@type": "types.example.com/standard/id" }`.202End of mutually exclusive fields.203204| JSON representation |205|---|206| ``` { "name": string, "metadata": { "@type": string, field1: ..., ... }, "done": boolean, // result "error": { object (`https://ai.google.dev/api/files#v1beta.Status`) }, "response": { "@type": string, field1: ..., ... } // Union type } ``` |207208## Method: fileSearchStores.operations.get209210- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)211- [Path parameters](https://ai.google.dev/api/file-search/file-search-stores#body.PATH_PARAMETERS)212- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)213- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)214- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)215216Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.217218### Endpoint219220get `https://generativelanguage.googleapis.com/v1beta/{name=fileSearchStores/*/operations/*}` 221222### Path parameters223224`name` `string` The name of the operation resource. It takes the form `fileSearchStores/{filesearchstore}/operations/{operation}`.225226### Request body227228The request body must be empty.229230### Response body231232If successful, the response body contains an instance of `https://ai.google.dev/api/batch-api#Operation`.233234## REST Resource: fileSearchStores.upload.operations235236- [Resource: Operation](https://ai.google.dev/api/file-search/file-search-stores#Operation)237 - [JSON representation](https://ai.google.dev/api/file-search/file-search-stores#Operation.SCHEMA_REPRESENTATION)238- [Methods](https://ai.google.dev/api/file-search/file-search-stores#METHODS_SUMMARY)239240## Resource: Operation241242This resource represents a long-running operation that is the result of a network API call.243Fields `name` `string` The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.244`metadata` `object` Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.245246An object containing fields of an arbitrary type. An additional field `"@type"` contains a URI identifying the type. Example: `{ "id": 1234, "@type": "types.example.com/standard/id" }`.247`done` `boolean` If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.248`result` `Union type` The operation result, which can be either an `error` or a valid `response`. If `done` == `false`, neither `error` nor `response` is set. If `done` == `true`, exactly one of `error` or `response` can be set. Some services might not provide the result. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: `error` ``object (`https://ai.google.dev/api/files#v1beta.Status`)`` The error result of the operation in case of failure or cancellation.249`response` `object` The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.250251An object containing fields of an arbitrary type. An additional field `"@type"` contains a URI identifying the type. Example: `{ "id": 1234, "@type": "types.example.com/standard/id" }`.252End of mutually exclusive fields.253254| JSON representation |255|---|256| ``` { "name": string, "metadata": { "@type": string, field1: ..., ... }, "done": boolean, // result "error": { object (`https://ai.google.dev/api/files#v1beta.Status`) }, "response": { "@type": string, field1: ..., ... } // Union type } ``` |257258## Method: fileSearchStores.upload.operations.get259260- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)261- [Path parameters](https://ai.google.dev/api/file-search/file-search-stores#body.PATH_PARAMETERS)262- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)263- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)264- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)265266Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.267268### Endpoint269270get `https://generativelanguage.googleapis.com/v1beta/{name=fileSearchStores/*/upload/operations/*}` 271272### Path parameters273274`name` `string` The name of the operation resource. It takes the form `fileSearchStores/{filesearchstore}/upload/operations/{operation}`.275276### Request body277278The request body must be empty.279280### Response body281282If successful, the response body contains an instance of `https://ai.google.dev/api/batch-api#Operation`.283284## Method: media.download285286- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)287- [Path parameters](https://ai.google.dev/api/file-search/file-search-stores#body.PATH_PARAMETERS)288- [Query parameters](https://ai.google.dev/api/file-search/file-search-stores#body.QUERY_PARAMETERS)289- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)290- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)291- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)292293Retrieves a file or directory from an environment's snapshot (HTTP endpoint).294295### Endpoint296297get `https://generativelanguage.googleapis.com/v1beta/{parent=environments/*}/files` 298299### Path parameters300301`parent` `string` Required. The resource name of the environment. Format: `environments/{environmentId}` It takes the form `environments/{environment}`.302303### Query parameters304305`path` `string` Optional. The path of the file or directory within the environment. If empty, defaults to the root of the workspace. Example: "workspace/src/main.py"306`recursive` `boolean` Optional. If true and the path is a directory, recursively lists all files and subdirectories. Defaults to false (immediate children only).307`page_size` `integer` Optional. Maximum number of entries to return per page (for directory listing). If unspecified, defaults to 100. Maximum is 1000. NOLINT308`page_token` `string` Optional. Pagination token for directory listing. NOLINT309310### Request body311312The request body must be empty.313314### Response body315316If successful, the response body contains an instance of `GetEnvironmentFilesResponse`.317318## Method: media.uploadToFileSearchStore319320- [Endpoint](https://ai.google.dev/api/file-search/file-search-stores#body.HTTP_TEMPLATE)321- [Path parameters](https://ai.google.dev/api/file-search/file-search-stores#body.PATH_PARAMETERS)322- [Request body](https://ai.google.dev/api/file-search/file-search-stores#body.request_body)323 - [JSON representation](https://ai.google.dev/api/file-search/file-search-stores#body.request_body.SCHEMA_REPRESENTATION)324- [Response body](https://ai.google.dev/api/file-search/file-search-stores#body.response_body)325 - [JSON representation](https://ai.google.dev/api/file-search/file-search-stores#body.CustomLongRunningOperation.SCHEMA_REPRESENTATION)326- [Authorization scopes](https://ai.google.dev/api/file-search/file-search-stores#body.aspect)327328Uploads data to a FileSearchStore, preprocesses and chunks before storing it in a FileSearchStore Document.329330### Endpoint331332- Upload URI, for media upload requests: 333post `https://generativelanguage.googleapis.com/upload/v1beta/{fileSearchStoreName=fileSearchStores/*}:uploadToFileSearchStore`334- Metadata URI, for metadata-only requests: 335post `https://generativelanguage.googleapis.com/v1beta/{fileSearchStoreName=fileSearchStores/*}:uploadToFileSearchStore`336337### Path parameters338339`fileSearchStoreName` `string` Required. Immutable. The name of the `FileSearchStore` to upload the file into. Example: `fileSearchStores/my-file-search-store-123` It takes the form `fileSearchStores/{filesearchstore}`.340341### Request body342343The request body contains data with the following structure:344Fields `displayName` `string` Optional. Display name of the created document.345`customMetadata[]` ``object (`https://ai.google.dev/api/file-search/documents#CustomMetadata`)`` Custom metadata to be associated with the data.346`chunkingConfig` ``object (`ChunkingConfig`)`` Optional. Config for telling the service how to chunk the data. If not provided, the service will use default parameters.347`mimeType` `string` Optional. MIME type of the data. If not provided, it will be inferred from the uploaded content.348349### Response body350351If successful, the response body contains data with the following structure:352Fields `name` `string` The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.353`metadata` `object` Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any.354355An object containing fields of an arbitrary type. An additional field `"@type"` contains a URI identifying the type. Example: `{ "id": 1234, "@type": "types.example.com/standard/id" }`.356`done` `boolean` If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available.357`result` `Union type` The operation result, which can be either an `error` or a valid `response`. If `done` == `false`, neither `error` nor `response` is set. If `done` == `true`, exactly one of `error` or `response` can be set. Some services might not provide the result. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: `error` ``object (`https://ai.google.dev/api/files#v1beta.Status`)`` The error result of the operation in case of failure or cancellation.358`response` `object` The normal, successful response of the operation. If the original method returns no data on success, such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.359360An object containing fields of an arbitrary type. An additional field `"@type"` contains a URI identifying the type. Example: `{ "id": 1234, "@type": "types.example.com/standard/id" }`.361End of mutually exclusive fields.362363| JSON representation |364|---|365| ``` { "name": string, "metadata": { "@type": string, field1: ..., ... }, "done": boolean, // result "error": { object (`https://ai.google.dev/api/files#v1beta.Status`) }, "response": { "@type": string, field1: ..., ... } // Union type } ``` |