Adds a public SSH key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth,
or OAuth with at least write:public_key scope.
If your GitHub Enterprise Server 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.
POST /user/keys
| Name | Type | Description |
|---|---|---|
title |
string |
A descriptive name for the new key. Use a name that will help you recognize this key in your GitHub account. For example, if you're using a personal Mac, you might call this key "Personal MacBook Air". |
key |
string |
The public SSH key to add to your GitHub account. See "Generating a new SSH key" for guidance on how to create a public SSH key. |
{
"title": "octocat@octomac",
"key": "ssh-rsa AAA..."
}
Status: 201 Created
Location:
{
"key_id": "012345678912345678",
"key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"
}