Deploy Keys

List deploy keys

GET /repos/:owner/:repo/keys

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "id": 1,
    "key": "ssh-rsa AAA...",
    "url": "https://api.github.com/repos/octocat/Hello-World/keys/1",
    "title": "octocat@octomac",
    "verified": true,
    "created_at": "2014-12-10T15:53:42Z"
  }
]

Get a deploy key

GET /repos/:owner/:repo/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/repos/octocat/Hello-World/keys/1",
  "title": "octocat@octomac",
  "verified": true,
  "created_at": "2014-12-10T15:53:42Z"
}

Add a new deploy key

POST /repos/:owner/:repo/keys

Input

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

Response

Status: 201 Created
Location: https://api.github.com/repos/octocat/Hello-World/keys/1
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "id": 1,
  "key": "ssh-rsa AAA...",
  "url": "https://api.github.com/repos/octocat/Hello-World/keys/1",
  "title": "octocat@octomac",
  "verified": true,
  "created_at": "2014-12-10T15:53:42Z"
}

Edit a deploy key

Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.

Remove a deploy key

DELETE /repos/:owner/:repo/keys/:id

Response

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