---
title: "Create a GPG key"
method: POST
path: "/user/gpg_keys"
tags: ["user"]
---

# Create a GPG key

`POST /user/gpg_keys`

## Request body

- CreateGPGKeyOption — CreateGPGKeyOption options create user GPG key
  - `armored_public_key` string, required — An armored GPG key to add
  - `armored_signature` string — An optional armored signature for the GPG key

## Response `201`

GPGKey

- GPGKey — GPGKey a user GPG key to sign commit and tag in repository
  - `can_certify` boolean — Whether the key can be used for certification
  - `can_encrypt_comms` boolean — Whether the key can be used for encrypting communications
  - `can_encrypt_storage` boolean — Whether the key can be used for encrypting storage
  - `can_sign` boolean — Whether the key can be used for signing
  - `created_at` string, date-time — The date and time when the GPG key was created
  - `emails` GPGKeyEmail[] — List of email addresses associated with this GPG key
    - `email` string — The email address associated with the GPG key
    - `verified` boolean — Whether the email address has been verified
  - `expires_at` string, date-time — The date and time when the GPG key expires
  - `id` integer — The unique identifier of the GPG key
  - `key_id` string — The key ID of the GPG key
  - `primary_key_id` string — The primary key ID of the GPG key
  - `public_key` string — The public key content in armored format
  - `subkeys` GPGKey[] — List of subkeys of this GPG key
  - `verified` boolean — Whether the GPG key has been verified

## Other responses

- `404` — APINotFound is a not found empty response
- `422` — APIValidationError is error format response related to input validation

---

[API](https://skmtc.net/gitea/apis/gitea-api.md) · [All operations](https://skmtc.net/gitea/apis/gitea-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gitea/gitea-api/revisions/350de506cefa/schema)
