Labels

List all labels for this repository

GET /repos/:owner/:repo/labels

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
[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "color": "f29513"
  }
]

Get a single label

GET /repos/:owner/:repo/labels/:name

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
  "name": "bug",
  "color": "f29513"
}

Create a label

POST /repos/:owner/:repo/labels

Parameters

Name Type Description
name string Required. The name of the label.
color string Required. A 6 character hex code, without the leading #, identifying the color.
{
  "name": "bug",
  "color": "f29513"
}

Response

Status: 201 Created
Location: https://api.github.com/repos/octocat/Hello-World/labels/bug
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
  "name": "bug",
  "color": "f29513"
}

Update a label

PATCH /repos/:owner/:repo/labels/:name

Parameters

Name Type Description
name string Required. The name of the label.
color string Required. A 6 character hex code, without the leading #, identifying the color.
{
  "name": "bug",
  "color": "f29513"
}

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
{
  "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
  "name": "bug",
  "color": "f29513"
}

Delete a label

DELETE /repos/:owner/:repo/labels/:name

Response

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

List labels on an issue

GET /repos/:owner/:repo/issues/:number/labels

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
[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "color": "f29513"
  }
]

Add labels to an issue

POST /repos/:owner/:repo/issues/:number/labels

Input

[
  "Label1",
  "Label2"
]

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "color": "f29513"
  }
]

Remove a label from an issue

DELETE /repos/:owner/:repo/issues/:number/labels/:name

Response

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

Replace all labels for an issue

PUT /repos/:owner/:repo/issues/:number/labels

Input

[
  "Label1",
  "Label2"
]

Sending an empty array ([]) will remove all Labels from the Issue.

Response

Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "color": "f29513"
  }
]

Remove all labels from an issue

DELETE /repos/:owner/:repo/issues/:number/labels

Response

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

Get labels for every issue in a milestone

GET /repos/:owner/:repo/milestones/:number/labels

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
[
  {
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
    "name": "bug",
    "color": "f29513"
  }
]