---
title: "POST /v1/{+parent}/attachments"
method: POST
path: "/v1/{+parent}/attachments"
tags: ["projects"]
---

# POST /v1/{+parent}/attachments

`POST /v1/{+parent}/attachments`

Creates an attachment. The returned Operation will finish once the attachment has been created. Its response will be the created attachment.

## Path parameters

- `parent` string, required

## Query parameters

- `attachmentId` string

## Request body

- Attachment — An Attachment refers to additional metadata that can be attached to artifacts in Artifact Registry. An attachment consists of one or more files.
  - `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`.
  - `annotations` object — 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.
  - `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`.
  - `createTime` string, google-datetime — Output only. The time when the attachment was created.
  - `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`.
  - `type` string — Type of attachment. E.g. `application/vnd.spdx+json`
  - `updateTime` string, google-datetime — Output only. The time when the attachment was last updated.
  - `name` string — The name of the attachment. E.g. `projects/p1/locations/us/repositories/repo/attachments/sbom`.
  - `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:`.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/artifactregistry.md) · [All operations](https://skmtc.net/google/apis/artifactregistry/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/artifactregistry/versions/ab5639c979b9/schema)
