Skip to content

GPG API ​

7 endpoints. Request and response schemas are described on the schemas page; the other tags are listed in the API index.

Endpoints ​

GET /api/v1/admin/gpg/keys ​

List GPG keys

Lists the database-managed signing keys plus the read-only entry for the key configured through gpg.keyPath / GPG_KEY_PATH (admin only). Private key material is never returned.

Responses

StatusDescriptionBody
200List of GPG keysapplication/json: object
403Admin access required-

Fields of the 200 response (application/json):

FieldTypeRequiredDescription
can_store_keysbooleannoFalse when OPENARTIFACT_SECRET_KEY is not set: keys cannot be imported or generated because private keys are only stored encrypted.
keysarray of GPGKeyno-

POST /api/v1/admin/gpg/keys ​

Import GPG key

Imports an ASCII-armored private key (admin only). A passphrase-protected key is unlocked with passphrase and stored without it, sealed with OPENARTIFACT_SECRET_KEY. The key becomes the global active key when nothing signs globally yet, unless activate says otherwise.

Request body (required)

application/json: object

FieldTypeRequiredDescription
activatebooleannoMake it the global active key; default: only when nothing signs globally yet
namestringnoUnique display name; defaults to key-<keyid>. Maximum length: 255.
passphrasestringnoPassphrase of a protected key
private_keystringyesASCII-armored private key

Responses

StatusDescriptionBody
201GPG key importedapplication/json: GPGKey
400Invalid, protected (code passphrase_required), revoked or expired key-
403Admin access required-
409Name or fingerprint already exists, or OPENARTIFACT_SECRET_KEY is not set (code secret_key_required)-

POST /api/v1/admin/gpg/keys/generate ​

Generate GPG key

Generates a signing key pair on the server (admin only). The private key is stored sealed and never returned; export the public key with the export route.

Request body

application/json: object

FieldTypeRequiredDescription
activatebooleannoMake it the global active key; default: only when nothing signs globally yet
algorithmstringnoOne of: ed25519, rsa4096. Default: ed25519.
commentstringno-
emailstringno-
namestringnoMaximum length: 255.
user_namestringnoUser id name; default OpenArtifact repository signing key

Responses

StatusDescriptionBody
201GPG key generatedapplication/json: GPGKey
400Invalid input-
403Admin access required-
409Name already exists, or OPENARTIFACT_SECRET_KEY is not set (code secret_key_required)-

DELETE /api/v1/admin/gpg/keys/{id} ​

Delete GPG key

Deletes a database-managed key (admin only). An active key (global or assigned to a repository) is refused with 409 key_in_use unless force=true; the repositories it signed are then re-signed by the next applicable key or become unsigned. The config key cannot be deleted.

Parameters

NameInTypeRequiredDescription
idpathstringyesKey id (UUID) or config for the read-only file/env key
forcequerybooleanno-

Responses

StatusDescriptionBody
204GPG key deleted-
400Invalid requestapplication/json: Error
403Admin access required-
404GPG key not found-
409Key is active (key_in_use) or read-only-

PUT /api/v1/admin/gpg/keys/{id}/activate ​

Activate GPG key

Makes the key sign every deb, rpm and pacman repository without a key of its own (global scope), or only the named hosted deb, rpm or pacman repository when repository is given. Affected repositories are re-signed (admin only).

Parameters

NameInTypeRequiredDescription
idpathstringyesKey id (UUID) or config for the read-only file/env key

Request body

application/json: object

FieldTypeRequiredDescription
repositorystringnoRepository name; omit for the global scope

Responses

StatusDescriptionBody
200The keyapplication/json: GPGKey
400Repository is not a hosted deb, rpm or pacman repository-
403Admin access required-
404Key or repository not found-
409Read-only config key-

DELETE /api/v1/admin/gpg/keys/{id}/activate ​

Deactivate GPG key

Stops the key signing globally, or for the repository named in the repository query parameter (admin only).

Parameters

NameInTypeRequiredDescription
idpathstringyesKey id (UUID) or config for the read-only file/env key
repositoryquerystringno-

Responses

StatusDescriptionBody
204Deactivated-
400Invalid requestapplication/json: Error
403Admin access required-
404Key or repository not found-
409The key was not active there, or it is the read-only config key-

GET /api/v1/admin/gpg/keys/{id}/export ​

Export public key

Downloads the ASCII-armored public key (admin only).

Parameters

NameInTypeRequiredDescription
idpathstringyesKey id (UUID) or config for the read-only file/env key

Responses

StatusDescriptionBody
200Armored public keyapplication/pgp-keys: string
400Invalid request, including a NUL byte in the URL or the bodyapplication/json: Error
403Admin access required-
404GPG key not found-

Free software under the AGPL-3.0-or-later.