GitHub v3 REST API

List labels for an issue

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/issues/{issue_number}/labels

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired
issue_numberintegerrequired

issue_number parameter

Response

application/json

Response

Color-coded labels help you categorize and filter your issues (just like labels in Gmail).

idinteger(int64)required

Example:208045946

node_idstringrequired

Example:MDU6TGFiZWwyMDgwNDU5NDY=

urlstring(uri)required

URL for the label

Example:https://api.github.com/repositories/42/labels/bug

namestringrequired

The name of the label.

Example:bug

descriptionstring | nullrequired

Example:Something isn't working

colorstringrequired

6-character hex code, without the leading #, identifying the color

Example:FFFFFF

defaultbooleanrequired

Example:true

get/repos/{owner}/{repo}/issues/{issue_number}/labels
 
application/json

Add labels to an issue

post
http://HOSTNAME/api/v3/repos/{owner}/{repo}/issues/{issue_number}/labels

Path Parameters

ownerstringrequired
repostringrequired
issue_numberintegerrequired

issue_number parameter

Body

application/json
One Of
labelsarray[string]

The names of the labels to add to the issue’s existing labels. You can pass an empty array to remove all labels. Alternatively, you can pass a single label as a string or an array of labels directly, but GitHub recommends passing an object with the labels key. You can also replace all of the labels for an issue. For more information, see “Set labels for an issue.”

>= 1 items

Response

application/json

Response

Color-coded labels help you categorize and filter your issues (just like labels in Gmail).

idinteger(int64)required

Example:208045946

node_idstringrequired

Example:MDU6TGFiZWwyMDgwNDU5NDY=

urlstring(uri)required

URL for the label

Example:https://api.github.com/repositories/42/labels/bug

namestringrequired

The name of the label.

Example:bug

descriptionstring | nullrequired

Example:Something isn't working

colorstringrequired

6-character hex code, without the leading #, identifying the color

Example:FFFFFF

defaultbooleanrequired

Example:true

post/repos/{owner}/{repo}/issues/{issue_number}/labels

Body

{ "labels": [ "bug", "enhancement" ] }
 
application/json

Set labels for an issue

Removes any previous labels and sets the new labels for an issue.

put
http://HOSTNAME/api/v3/repos/{owner}/{repo}/issues/{issue_number}/labels

Path Parameters

ownerstringrequired
repostringrequired
issue_numberintegerrequired

issue_number parameter

Body

application/json
One Of
labelsarray[string]

The names of the labels to set for the issue. The labels you set replace any existing labels. You can pass an empty array to remove all labels. Alternatively, you can pass a single label as a string or an array of labels directly, but GitHub recommends passing an object with the labels key. You can also add labels to the existing labels for an issue. For more information, see “Add labels to an issue.”

>= 1 items

Response

application/json

Response

Color-coded labels help you categorize and filter your issues (just like labels in Gmail).

idinteger(int64)required

Example:208045946

node_idstringrequired

Example:MDU6TGFiZWwyMDgwNDU5NDY=

urlstring(uri)required

URL for the label

Example:https://api.github.com/repositories/42/labels/bug

namestringrequired

The name of the label.

Example:bug

descriptionstring | nullrequired

Example:Something isn't working

colorstringrequired

6-character hex code, without the leading #, identifying the color

Example:FFFFFF

defaultbooleanrequired

Example:true

put/repos/{owner}/{repo}/issues/{issue_number}/labels

Body

{ "labels": [ "bug", "enhancement" ] }
 
application/json

Remove all labels from an issue

delete
http://HOSTNAME/api/v3/repos/{owner}/{repo}/issues/{issue_number}/labels

Path Parameters

ownerstringrequired
repostringrequired
issue_numberintegerrequired

issue_number parameter

Response

Response

delete/repos/{owner}/{repo}/issues/{issue_number}/labels
 

Remove a label from an issue

Removes the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a 404 Not Found status if the label does not exist.

delete
http://HOSTNAME/api/v3/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}

Path Parameters

ownerstringrequired
repostringrequired
issue_numberintegerrequired

issue_number parameter

namestringrequired

Response

application/json

Response

Color-coded labels help you categorize and filter your issues (just like labels in Gmail).

idinteger(int64)required

Example:208045946

node_idstringrequired

Example:MDU6TGFiZWwyMDgwNDU5NDY=

urlstring(uri)required

URL for the label

Example:https://api.github.com/repositories/42/labels/bug

namestringrequired

The name of the label.

Example:bug

descriptionstring | nullrequired

Example:Something isn't working

colorstringrequired

6-character hex code, without the leading #, identifying the color

Example:FFFFFF

defaultbooleanrequired

Example:true

delete/repos/{owner}/{repo}/issues/{issue_number}/labels/{name}
 
application/json