---
title: "Set the active GPG key for the Repository."
method: POST
path: "/repos/{owner}/{identifier}/gpg/"
tags: ["repos"]
---

# Set the active GPG key for the Repository.

`POST /repos/{owner}/{identifier}/gpg/`

Set the active GPG key for the Repository.

## Request body

- RepositoryGpgKeyCreate
  - `gpg_passphrase` string — The GPG passphrase used for signing.
  - `gpg_private_key` string, required — The GPG private key.

## Response `200`

The provided GPG key is the same as the current GPG key.

- RepositoryGpgKey
  - `active` boolean — If selected this is the active key for this repository.
  - `comment` string, required
  - `created_at` string, date-time
  - `default` boolean — If selected this is the default key for this repository.
  - `fingerprint` string — The long identifier used by GPG for this key.
  - `fingerprint_short` string
  - `public_key` string — The public key given to repository users.

## Other responses

- `201` — The provided GPG key was assigned to the Repository.
- `400` — The provided GPG key is not valid
- `402` — Custom GPG keys are not active; upgrade your account!
- `404` — Organization/Repository does not exist, or you do not have permissions.
- `422` — Missing or invalid parameters (see detail).

---

[API](https://skmtc.dev/cloudsmith/apis/cloudsmith-api-v1.md) · [All operations](https://skmtc.dev/cloudsmith/apis/cloudsmith-api-v1/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/cloudsmith/cloudsmith-api-v1/revisions/4d7879df9b2f/schema)
