---
title: "Attach metadata to a package"
method: POST
path: "/metadata/packages/{package_slug_perm}/"
tags: ["metadata"]
---

# Attach metadata to a package

`POST /metadata/packages/{package_slug_perm}/`

Attach arbitrary metadata to a package.

## Path parameters

- `package_slug_perm` string, required

## Request body

- ArtifactMetadataWrite — Fields for creating or updating package metadata.
  - `content` object, required — The metadata payload as a JSON object.
  - `content_type` string, required — The content type describing the structure of the metadata payload.
  - `source_identity` string, required — The identifier for the source of this metadata, for example 'upstream:npmjs'.

## Response `201`

The metadata entry was created successfully.

- ArtifactMetadataEntry — A package metadata entry.
  - `content` object, required — The metadata payload as a JSON object.
  - `content_type` string, required — The content type describing the structure of the metadata payload.
  - `source_identity` string, required — The identifier for the source of this metadata, for example 'upstream:npmjs'.
  - `slug_perm` string, required — The unique slug identifying this metadata entry.

## Other responses

- `401` — Authentication credentials were not provided or are invalid.
- `402` — The target workspace's plan does not include the metadata feature. Upgrade to a plan that includes ``package_metadata`` to use this endpoint.
- `403` — The caller is authenticated but lacks permission to perform this action, or the requested operation is not allowed for the target resource.
- `404` — The package or metadata entry could not be found.
- `422` — The request body failed validation.

---

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