User Public Keys API
- List public keys for a user
- List your public keys
- Get a single public key
- Create a public key
- Update a public key
- Delete a public key
List public keys for a user
GET /users/:user/keys
Lists the verified public keys for a user. This is accessible by anyone.
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"id": 1,
"key": "ssh-rsa AAA..."
}
]
List your public keys
GET /user/keys
Lists the current user’s keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the ‘user’ scope.
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"id": 1,
"key": "ssh-rsa AAA...",
"url": "https://api.github.com/user/keys/1",
"title": "octocat@octomac"
}
]
Get a single public key
GET /user/keys/:id
Response
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
"id": 1,
"key": "ssh-rsa AAA...",
"url": "https://api.github.com/user/keys/1",
"title": "octocat@octomac"
}
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
{
"id": 1,
"key": "ssh-rsa AAA...",
"url": "https://api.github.com/user/keys/1",
"title": "octocat@octomac"
}
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
{
"id": 1,
"key": "ssh-rsa AAA...",
"url": "https://api.github.com/user/keys/1",
"title": "octocat@octomac"
}
Delete a public key
DELETE /user/keys/:id
Response
Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999