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

Add labels to an issue

Adds labels to an issue without removing its existing labels. Supply label names directly or use an object payload with a labels array; label objects can include rationale, suggest, and confidence. A suggested label is stored for human review rather than applied directly.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

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 add to the issue. You can pass an object containing labels or a direct array of label names or label objects.

labelsarray<string>optional
The labels to add to the issue's existing labels. You can also pass an `array` of labels directly, but GitHub recommends passing an object with the `labels` key. To replace all of the labels for an issue, use "[Set labels for an issue](https://docs.github.com/rest/issues/labels#set-labels-for-an-issue)."

5 status codes
200Returns an array of the issue's labels after the requested labels are added.
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; the object-form labels array must contain at least one item, each label object must include name, and confidence must be low, medium, or high.