---
title: "Set labels for an issue"
method: PUT
path: "/repos/{owner}/{repo}/issues/{issue_number}/labels"
tags: ["issues"]
---

# Set labels for an issue

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

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

## Path parameters

- `owner` string, required
- `repo` string, required
- `issue_number` integer, required

## Request body

- union
  - object
    - `labels` 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](https://docs.github.com/rest/issues/labels#add-labels-to-an-issue)."
  - string[]
  - object
    - `labels` object[]
      - `name` string, required
  - object[]
    - `name` string, required
  - string

## Response `200`

Response

- Label[]
  - `id` integer, required — Unique identifier for the label.
  - `node_id` string, required
  - `url` string, uri, required — URL for the label
  - `name` string, required — The name of the label.
  - `description` string, nullable, required — Optional description of the label, such as its purpose.
  - `color` string, required — 6-character hex code, without the leading #, identifying the color
  - `default` boolean, required — Whether this label comes by default in a new repository.

## Other responses

- `301` — Moved permanently
- `404` — Resource not found
- `410` — Gone
- `422` — Validation failed, or the endpoint has been spammed.

---

[API](https://skmtc.net/github/apis/rest-api.md) · [All operations](https://skmtc.net/github/apis/rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/rest-api/versions/80850db290cd/schema)
