| title | User GPG Keys |
|---|
{% if page.version == 'dotcom' %}
{{#tip}}
APIs for managing user GPG keys are currently available for developers to preview. During the preview period, the APIs may change without advance notice. Please see the blog post for full details.
To access the API you must provide a custom media type in the Accept header:
application/vnd.github.cryptographer-preview
{{/tip}}
{:toc}
GET /user/gpg_keys
Lists the current user's GPG keys. Requires that you are authenticated via
Basic Auth or via OAuth with at least read:gpg_key
scope.
<%= headers 200, :pagination => default_pagination_rels %> <%= json(:gpg_key) { |h| [h] } %>
View extended details for a single GPG key. Requires that you are
authenticated via Basic Auth or via OAuth with at least read:gpg_key
scope.
GET /user/gpg_keys/:id
<%= headers 200 %> <%= json :gpg_key %>
Creates a GPG key. Requires that you are authenticated via Basic Auth,
or OAuth with at least write:gpg_key scope.
POST /user/gpg_keys
<%= json :armored_public_key => "-----BEGIN PGP PUBLIC KEY BLOCK-----\n...\n-----END PGP PUBLIC KEY BLOCK-----" %>
<%= headers 201, :Location => get_resource(:gpg_key)['url'] %> <%= json :gpg_key %>
Removes a GPG key. Requires that you are authenticated via Basic Auth
or via OAuth with at least admin:gpg_key scope.
DELETE /user/gpg_keys/:id
<%= headers 204 %>
{% endif %}