Sample - GitHub REST API
PATCH/repos/{owner}/{repo}/labels/{name}

Update a repository label

Updates an existing label in a repository using its current name. Supply one or more fields in the request body to change the label's name, color, description, or archive state. The description field must contain no more than 100 characters.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

3 parameters · 4 body fields
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.
namestringrequired
The current name of the label to update.

Optional label properties to update; provide only the fields whose values you want to change.

new_namestringoptional
The new name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing `:strawberry:` will render the emoji ![:strawberry:](https://github.githubassets.com/images/icons/emoji/unicode/1f353.png ":strawberry:"). For a full list of available emoji and codes, see "[Emoji cheat sheet](https://github.com/ikatyang/emoji-cheat-sheet)."
colorstringoptional
The [hexadecimal color code](http://www.color-hex.com/) for the label, without the leading `#`.
descriptionstringoptional
A short description of the label. Must be 100 characters or fewer.
archivedbooleanoptional
Whether to archive or unarchive the label. Archived labels cannot be added to issues or pull requests. For more information, see "[Archiving labels](https://docs.github.com/issues/organizing-your-work-with-labels/managing-labels)."

1 status code
200Returns the updated label object with its identifier, URLs, name, description, color, default-label flag, and archive information.
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.

Error handling

owner, repo, and name must identify the repository and existing label you intend to update. The request body is optional, but any supplied description must be 100 characters or fewer, and color must be a hexadecimal color code without a leading #.