| title | User Public Keys |
|---|
{:toc}
GET /users/:username/keys
Lists the verified public keys for a user. This is accessible by anyone.
<%= headers 200, :pagination => default_pagination_rels %> <%= json(:simple_public_key) { |h| [h] } %>
GET /user/keys
Lists the current user's keys. Requires that you are authenticated via
Basic Auth or via OAuth with at least read:public_key
scope.
<%= headers 200, :pagination => default_pagination_rels %> <%= json(:public_key) { |h| [h] } %>
View extended details for a single public key. Requires that you are
authenticated via Basic Auth or via OAuth with at least read:public_key
scope.
GET /user/keys/:id
<%= headers 200 %> <%= json :public_key %>
Creates a public key. Requires that you are authenticated via Basic Auth,
or OAuth with at least write:public_key scope.
{% if page.version != 'dotcom' && page.version >= 2.1 %}
{{#warning}}
If your GitHub Enterprise appliance has LDAP Sync enabled and the option to synchronize SSH keys enabled, this API is disabled and will return a 403 response. Users managed in LDAP won't be able to add an SSH key address via the API with these options enabled.
{{/warning}}
{% endif %}
POST /user/keys
<%= json :title => "octocat@octomac", :key => "ssh-rsa AAA..." %>
<%= headers 201, :Location => get_resource(:public_key)['url'] %> <%= json :public_key %>
Public keys are immutable. If you need to update a public key, remove the key and create a new one instead.
Removes a public key. Requires that you are authenticated via Basic Auth
or via OAuth with at least admin:public_key scope.
{% if page.version != 'dotcom' && page.version >= 2.1 %}
{{#warning}}
If your GitHub Enterprise appliance has LDAP Sync enabled and the option to synchronize SSH keys enabled, this API is disabled and will return a 403 response. Users managed in LDAP won't be able to remove an SSH key address via the API with these options enabled.
{{/warning}}
{% endif %}
DELETE /user/keys/:id
<%= headers 204 %>