- [HTTP request](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.legacySoarUsers.attachments/upload#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.legacySoarUsers.attachments/upload#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.legacySoarUsers.attachments/upload#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.legacySoarUsers.attachments/upload#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.legacySoarUsers.attachments/upload#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.legacySoarUsers.attachments/upload#body.CreateAttachmentResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.legacySoarUsers.attachments/upload#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/chronicle/docs/reference/rest/v1/projects.locations.instances.legacySoarUsers.attachments/upload#body.aspect_1)

**Full name**: projects.locations.instances.legacySoarUsers.attachments.upload

Creates a new Attachment by uploading a file. Use this method to save relevant documents or data for future reference. The maximum file size allowed is 15MB.

### HTTP request

- Upload URI, for media upload requests:  
  `POST https://{endpoint}/upload/v1/{parent}/attachments:create`
- Metadata URI, for metadata-only requests:  
  `POST https://{endpoint}/v1/{parent}/attachments:create`

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

### Path parameters

| Parameters ||
|---|---|
| `parent` | `string` Required. The instance to create the Attachment for. Format: projects/{project}/locations/{location}/instances/{instance}/legacySoarUsers/{legacySoarUser}/attachments |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "description": string, "media": { object (`https://docs.cloud.google.com/chronicle/docs/reference/rest/Shared.Types/MediaResponseInfo#Media`) }, "mediaInfo": { object (`https://docs.cloud.google.com/chronicle/docs/reference/rest/Shared.Types/MediaRequestInfo`) } } ``` |

| Fields ||
|---|---|
| `description` | `string` Required. The Attachment to create. |
| `media` | ``object (`https://docs.cloud.google.com/chronicle/docs/reference/rest/Shared.Types/MediaResponseInfo#Media`)`` The media object to be uploaded. |
| `mediaInfo` | ``object (`https://docs.cloud.google.com/chronicle/docs/reference/rest/Shared.Types/MediaRequestInfo`)`` The media request info. |

### Response body

CreateAttachmentResponse contains the created Attachment.

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

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

| Fields ||
|---|---|
| `name` | `string` Output only. The created attachment. |
| `fileName` | `string` Output only. The file name including its file extension, maximum of 256 characters. |
| `description` | `string` Output only. The attachment description, maximum of 100 characters. |
| `mimeType` | `string` Output only. The attachment mime type, maximum of 100 characters. |
| `author` | `string` Output only. The user who uploaded the attachment. |

### Authorization scopes

Requires one of the following OAuth scopes:

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

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:

- `chronicle.attachments.update`

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