Create a GPG key
POST
/user/gpg_keys
const url = 'https://gitea.com/api/v1/user/gpg_keys';const options = { method: 'POST', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"armored_public_key":"example","armored_signature":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gitea.com/api/v1/user/gpg_keys \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "armored_public_key": "example", "armored_signature": "example" }'Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Media typeapplication/json
CreateGPGKeyOption options create user GPG key
object
armored_public_key
required
An armored GPG key to add
string
armored_signature
string
Examplegenerated
{ "armored_public_key": "example", "armored_signature": "example"}Responses
Section titled “Responses”GPGKey
Media typeapplication/json
GPGKey a user GPG key to sign commit and tag in repository
object
can_certify
boolean
can_encrypt_comms
boolean
can_encrypt_storage
boolean
can_sign
boolean
created_at
string format: date-time
emails
Array<object>
GPGKeyEmail an email attached to a GPGKey
object
email
string
verified
boolean
expires_at
string format: date-time
id
integer format: int64
key_id
string
primary_key_id
string
public_key
string
subkeys
Array<object> recursive
verified
boolean
Examplegenerated
{ "can_certify": true, "can_encrypt_comms": true, "can_encrypt_storage": true, "can_sign": true, "created_at": "2026-04-15T12:00:00Z", "emails": [ { "email": "example", "verified": true } ], "expires_at": "2026-04-15T12:00:00Z", "id": 1, "key_id": "example", "primary_key_id": "example", "public_key": "example", "subkeys": [], "verified": true}APINotFound is a not found empty response
Media typeapplication/json
APIValidationError is error format response related to input validation
Media typeapplication/json
Headers
Section titled “Headers”message
string
url
string