User Public Keys API

Management of public keys via the API requires that you are authenticated.

List public keys for a user

GET /user/keys

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "url": "https://api.github.com/user/keys/1",
    "id": 1,
    "title": "octocat@octomac",
    "key": "ssh-rsa AAA..."
  }
]

Get a single public key

GET /user/keys/:id

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/user/keys/1",
  "id": 1,
  "title": "octocat@octomac",
  "key": "ssh-rsa AAA..."
}

Create a public key

POST /user/keys

Input

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

Response

Status: 201 Created
Location: https://api.github.com/user/keys/1
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/user/keys/1",
  "id": 1,
  "title": "octocat@octomac",
  "key": "ssh-rsa AAA..."
}

Update a public key

PATCH /user/keys/:id

Input

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

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/user/keys/1",
  "id": 1,
  "title": "octocat@octomac",
  "key": "ssh-rsa AAA..."
}

Delete a public key

DELETE /user/keys/:id

Response

Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999