- [HTTP request](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#body.ImportAgentFileResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#body.aspect_1)
- [AgentFile](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#AgentFile)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#AgentFile.SCHEMA_REPRESENTATION)

Imports a file to an `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents#Agent`. Currently only No-code agents are supported.

### HTTP request

Choose an endpoint:
global us   
`POST https://discoveryengine.googleapis.com/v1alpha/{parent=projects/*/locations/*/collections/*/engines/*/assistants/*/agents/*}/files:import`

<br />

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The resource name of the `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents#Agent`. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}/agents/{agent}` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "fileName": string, "mimeType": string } ``` |

| Fields ||
|---|---|
| `fileName` | `string` Required. The name of the file. |
| `mimeType` | `string` Optional. The content type of the file, see <https://www.iana.org/assignments/media-types/media-types.xhtml>. This field is required when the data source does not provide the content type. |

### Response body

Response for the `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#google.cloud.discoveryengine.v1alpha.AgentService.ImportAgentFile` method.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "agentFile": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#AgentFile`) } } ``` |

| Fields ||
|---|---|
| `agentFile` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#AgentFile`)`` The imported `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants.agents.files/import#AgentFile`. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/discoveryengine.assist.readwrite`
- `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.agentFiles.import`

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

## AgentFile

Describes a file used internally by an agent as a context on each invocation.

| JSON representation |
|---|
| ``` { "name": string, "fileName": string, "mimeType": string } ``` |

| Fields ||
|---|---|
| `name` | `string` Identifier. The resource name of the file. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}/agents/{agent}/files/{file}` |
| `fileName` | `string` Required. The name of the file. |
| `mimeType` | `string` Immutable. The content type of the file. |