Your submission was sent successfully! Close

You have successfully unsubscribed! Close

Thank you for signing up for our newsletter!
In these regular emails you will find the latest updates about Ubuntu and upcoming events where you can meet our team.Close

API Methods: GPG

The methods available here are for GPG key handling.


Get info about GPG keys.

This method takes an optional argument:

  • names.#: A list of GPG keys to get info for. If this is not provided, the call will return all keys for the account.

Example call:


The method returns JSON serialized info on the keys:

        "fingerprint": "aa65:abfd:ffa4:327a:6fa0:6bb1:faa1:83c3:534a:91ee",
        "has_secret": false,
        "id": 10,
        "key_id": "FAA183C3534A91EE",
        "name": "mykey"
        "fingerprint": "afd7:2cef:2aa4:b345:0304:0ab4:20ac:3539:5aaf:ffa4",
        "has_secret": true,
        "id": 1,
        "key_id": "20AC35395AAFFFA4",
        "name": "sign-key"


Import a GPG key.

  • name: Name of the GPG key. It must be unique within the account, start with an alphanumeric character and only contain lowercase letters, numbers and - or + signs.
  • material: The text representation of the key.

Example of a valid request:

    &material=-----BEGIN PGP PUBLIC KEY BLOCK-----
        Version: GnuPG v1.4.11 (GNU/Linux)
        -----END PGP PUBLIC KEY BLOCK-----

The following error may be raised:

  • DuplicateGPGKey: A key with same name or fingerprint already exists.
  • GPGKeyImportFailed: Key import failed.
  • MultipleGPGKey: The material contains multiple keys.
  • Unauthorised: The user is not authorised to perform the operation.

The method returns a JSON representation of the stored key:

    "fingerprint": "a404:34a3:e40c:1add:94fa:31b4:30a7:5431:a2eb:521a",
    "key_id": "30A75431A2EB521A",
    "id": 11,
    "name": "my-key",
    "has_secret": true


Remove a GPG key.

  • name: Name of the GPG key.

Example of a valid request:


The following error may be raised:

  • UnknownGPGKey: No GPG key with the specified name exists.
  • GPGKeyInUse: The GPG key is currently used by a pocket and can’t be removed.

This page was last modified 1 year, 2 months ago. Help improve this document in the forum.