Create a public key

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.

POST /user/keys

Input

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.

Example

{
  "title": "octocat@octomac",
  "key": "ssh-rsa AAA..."
}

Response

Status: 201 Created
Location: 
{
  "key_id": "012345678912345678",
  "key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234"
}