- [HTTP request](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.aspect_1)

Bulk import of multiple `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.collections.dataStores.branches.documents#Document`s. Request processing may be synchronous. Non-existing items are created.

Note: It is possible for a subset of the `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.collections.dataStores.branches.documents#Document`s to be successfully updated.

### HTTP request

Choose an endpoint:
global us   
`POST https://discoveryengine.googleapis.com/v1beta/{parent=projects/*/locations/*/dataStores/*/branches/*}/documents:import`

<br />

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The parent branch resource name, such as `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}/branches/{branch}`. Requires create/update permission. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "errorConfig": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/ImportErrorConfig`) }, "reconciliationMode": enum (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/ReconciliationMode`), "updateMask": string, "autoGenerateIds": boolean, "idField": string, "forceRefreshContent": boolean, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "inlineSource": { object (`InlineSource`) }, "gcsSource": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/GcsSource`) }, "bigquerySource": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigQuerySource`) }, "fhirStoreSource": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/FhirStoreSource`) }, "spannerSource": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/SpannerSource`) }, "cloudSqlSource": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/CloudSqlSource`) }, "firestoreSource": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/FirestoreSource`) }, "alloyDbSource": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/AlloyDbSource`) }, "bigtableSource": { object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigtableSource`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `errorConfig` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/ImportErrorConfig`)`` The desired location of errors incurred during the Import. |
| `reconciliationMode` | ``enum (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/ReconciliationMode`)`` The mode of reconciliation between existing documents and the documents to be imported. Defaults to `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/ReconciliationMode#ENUM_VALUES.INCREMENTAL`. |
| `updateMask` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#field-mask` format)`` Indicates which fields in the provided imported documents to update. If not set, the default is to update all fields. This is a comma-separated list of fully qualified names of fields. Example: `"user.displayName,photo"`. |
| `autoGenerateIds` | `boolean` Whether to automatically generate IDs for the documents if absent. If set to `true`, `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.collections.dataStores.branches.documents#Document.FIELDS.id`s are automatically generated based on the hash of the payload, where IDs may not be consistent during multiple imports. In which case `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/ReconciliationMode#ENUM_VALUES.FULL` is highly recommended to avoid duplicate contents. If unset or set to `false`, `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.collections.dataStores.branches.documents#Document.FIELDS.id`s have to be specified using `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.request_body.FIELDS.id_field`, otherwise, documents without IDs fail to be imported. Supported data sources: - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/GcsSource`. `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/GcsSource#FIELDS.data_schema` must be `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigQuerySource`. `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigQuerySource#FIELDS.data_schema` must be `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/SpannerSource`. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/CloudSqlSource`. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/FirestoreSource`. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigtableSource`. |
| `idField` | `string` The field indicates the ID field or column to be used as unique IDs of the documents. For `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/GcsSource` it is the key of the JSON field. For instance, `my_id` for JSON `{"my_id": "some_uuid"}`. For others, it may be the column name of the table where the unique ids are stored. The values of the JSON field or the table column are used as the `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.collections.dataStores.branches.documents#Document.FIELDS.id`s. The JSON field or the table column must be of string type, and the values must be set as valid strings conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) with 1-63 characters. Otherwise, documents without valid IDs fail to be imported. Only set this field when `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/projects.locations.dataStores.branches.documents/import#body.request_body.FIELDS.auto_generate_ids` is unset or set as `false`. Otherwise, an INVALID_ARGUMENT error is thrown. If it is unset, a default value `Id` is used when importing from the allowed data sources. Supported data sources: - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/GcsSource`. `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/GcsSource#FIELDS.data_schema` must be `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigQuerySource`. `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigQuerySource#FIELDS.data_schema` must be `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/SpannerSource`. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/CloudSqlSource`. - `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigtableSource`. |
| `forceRefreshContent` | `boolean` Optional. Whether to force refresh the unstructured content of the documents. If set to `true`, the content part of the documents will be refreshed regardless of the update status of the referencing content. |
| Required. The source of the input. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `inlineSource` | ``object (`InlineSource`)`` The Inline source for the input content for documents. |
| `gcsSource` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/GcsSource`)`` Cloud Storage location for the input content. |
| `bigquerySource` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigQuerySource`)`` BigQuery input source. |
| `fhirStoreSource` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/FhirStoreSource`)`` FhirStore input source. |
| `spannerSource` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/SpannerSource`)`` Spanner input source. |
| `cloudSqlSource` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/CloudSqlSource`)`` Cloud SQL input source. |
| `firestoreSource` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/FirestoreSource`)`` Firestore input source. |
| `alloyDbSource` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/AlloyDbSource`)`` AlloyDB input source. |
| `bigtableSource` | ``object (`https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/v1beta/BigtableSource`)`` Cloud Bigtable input source. |
| End of mutually exclusive fields. ||

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/generative-ai-app-builder/docs/reference/rest/Shared.Types/ListOperationsResponse#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/discoveryengine.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.serving.readwrite`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `parent` resource:

- `discoveryengine.documents.import`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).