# REST Resource: projects.locations.repositories.attachments

- [Resource: Attachment](https://docs.cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.attachments#Attachment)
  - [JSON representation](https://docs.cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.attachments#Attachment.SCHEMA_REPRESENTATION)
- [Methods](https://docs.cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.attachments#METHODS_SUMMARY)

## Resource: Attachment

An Attachment refers to additional metadata that can be attached to artifacts in Artifact Registry. An attachment consists of one or more files.

| JSON representation |
|---|
| ``` { "name": string, "target": string, "type": string, "attachmentNamespace": string, "annotations": { string: string, ... }, "createTime": string, "updateTime": string, "files": [ string ], "ociVersionName": string } ``` |

| Fields ||
|---|---|
| `name` | `string` The name of the attachment. E.g. `projects/p1/locations/us/repositories/repo/attachments/sbom`. |
| `target` | `string` Required. The target the attachment is for, can be a Version, Package or Repository. E.g. `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`. |
| `type` | `string` Type of attachment. E.g. `application/vnd.spdx+json` |
| `attachmentNamespace` | `string` The namespace this attachment belongs to. E.g. If an attachment is created by artifact analysis, namespace is set to `artifactanalysis.googleapis.com`. |
| `annotations` | `map (key: string, value: string)` Optional. User annotations. These attributes can only be set and used by the user, and not by Artifact Registry. See <https://google.aip.dev/128#annotations> for more details such as format and size limitations. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The time when the attachment was created. Uses 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"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The time when the attachment was last updated. Uses 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"`. |
| `files[]` | `string` Required. The files that belong to this attachment. If the file ID part contains slashes, they are escaped. E.g. `projects/p1/locations/us-central1/repositories/repo1/files/sha:<sha-of-file>`. |
| `ociVersionName` | `string` Output only. The name of the OCI version that this attachment created. Only populated for Docker attachments. E.g. `projects/p1/locations/us-central1/repositories/repo1/packages/p1/versions/v1`. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.attachments/create` | Creates an attachment. |
| ### `https://docs.cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.attachments/delete` | Deletes an attachment. |
| ### `https://docs.cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.attachments/get` | Gets an attachment. |
| ### `https://docs.cloud.google.com/artifact-registry/docs/reference/rest/v1/projects.locations.repositories.attachments/list` | Lists attachments. |