- [HTTP request](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.agent/import#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.agent/import#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.agent/import#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.agent/import#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.agent/import#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.agent/import#body.aspect)
- [Try it!](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.agent/import#try-it)

Imports the specified agent from a ZIP file.

Uploads new intents and entity types without deleting the existing ones. Intents and entity types with the same name are replaced with the new versions from `ImportAgentRequest`. After the import, the imported draft agent will be trained automatically (unless disabled in agent settings). However, once the import is done, training may not be completed yet. Please call `https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.agent/train#google.cloud.dialogflow.v2beta1.Agents.TrainAgent` and wait for the operation it returns in order to train explicitly.

This method is a [long-running operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations). The returned `Operation` type has the following method-specific fields:

- `metadata`: An empty [Struct message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
- `response`: An [Empty message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)

The operation only tracks when importing is complete, not when it is done training.

Note: You should always train an agent prior to sending it queries. See the [training documentation](https://cloud.google.com/dialogflow/es/docs/training).

### HTTP request

Choose an endpoint:
global   
`POST https://dialogflow.googleapis.com/v2beta1/{parent=projects/*/locations/*}/agent:import`

<br />

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

**OR**

`POST https://{endpoint}/v2beta1/{parent=projects/*/locations/*}/agent:import`

Where `{endpoint}` is one of the [supported service endpoints](https://docs.cloud.google.com/dialogflow/es/docs/reference/rest#rest_endpoints).

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The project that the agent to import is associated with. Format: `projects/<Project ID>` or `projects/<Project ID>/locations/<Location ID>`. Authorization requires the following [IAM](https://cloud.google.com/iam/docs/) permission on the specified resource `parent`: - `dialogflow.agents.import` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "agentUri": string, "agentContent": string // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| Required. The agent to import. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `agentUri` | `string` The URI to a Google Cloud Storage file containing the agent to import. Note: The URI must start with "gs://". Dialogflow performs a read operation for the Cloud Storage object on the caller's behalf, so your request authentication must have read permissions for the object. For more information, see [Dialogflow access control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage). |
| `agentContent` | `string (https://developers.google.com/discovery/v1/type-format format)` Zip compressed raw byte content for agent. A base64-encoded string. |
| End of mutually exclusive fields. ||

### Response body

If successful, the response body contains an instance of `https://docs.cloud.google.com/dialogflow/es/docs/reference/rest/v2beta1/projects.locations.operations#Operation`.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `
  https://www.googleapis.com/auth/dialogflow`

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