Labels API
- List all labels for this repository
- Get a single label
- Create a label
- Update a label
- Delete a label
- List labels on an issue
- Add labels to an issue
- Remove a label from an issue
- Replace all labels for an issue
- Remove all labels from an issue
- Get labels for every issue in a milestone
List all labels for this repository
GET /repos/:owner/:repo/labels
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"
}
]
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
Input
- name
- Required string
- color
-
Required string - 6 character hex code, without a leading
#.
{
"name": "API",
"color": "FFFFFF"
}
Response
Status: 201 Created
Location: https://api.github.com/repos/user/repo/labels/foo
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
Input
- name
- Required string
- color
-
Required string - 6 character hex code, without a leading
#.
{
"name": "API",
"color": "FFFFFF"
}
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
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
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
{
"url": "https://api.github.com/repos/octocat/Hello-World/labels/bug",
"name": "bug",
"color": "f29513"
}
]