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

Replace labels on an issue

Replaces all labels on an issue with the labels in your request. Supply the label names in a labels array or as a direct array; unlike adding labels, this operation removes labels that are not included in the request.

3 parameters · 1 body field
ownerstringrequired
The account owner of the repository; the name is not case-sensitive.
repostringrequired
The repository name without the `.git` extension; the name is not case-sensitive.
issue_numberintegerrequired
The number that identifies the issue.

Label data to replace the issue's existing labels. You can pass an object containing labels or a direct array of labels.

labelsarray<string>optional
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](https://docs.github.com/rest/issues/labels#add-labels-to-an-issue)."

5 status codes
200Returns an array of labels applied to the issue after the existing labels are replaced.
idintegerrequired
Unique identifier for the label.
node_idstringrequired
urlstringrequired
URL for the label
namestringrequired
The name of the label.
descriptionstringrequired
Optional description of the label, such as its purpose.
colorstringrequired
6-character hex code, without the leading #, identifying the color
defaultbooleanrequired
Whether this label comes by default in a new repository.
archived_atstringrequired
Timestamp indicating when the label was archived, or `null` if it has not been archived.
archived_byobjectrequired
The user who archived the label, or `null` if it has not been archived.
301Returned when the resource has moved permanently.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the repository or issue cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
410Returned when the resource is no longer available.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when validation fails or the endpoint has been spammed.
messagestringrequired
documentation_urlstringrequired
errorsarray<object>optional

Error handling

A 404 is returned when the repository or issue cannot be found; a 410 is returned when the resource is no longer available. A 422 is returned when validation fails or the endpoint has been spammed. The owner path parameter, repo path parameter, and issue_number path parameter must identify the target issue; any supplied labels array must contain at least one item, and label objects must include name.