# Add labels to an issue

From **GitHub v3 REST API**.

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

Add labels to an issue

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

### `issue_number`

- Location: path
- Required: true
- Type: `integer`

issue_number parameter

## Request body

- Required: false
### `application/json`

```json
{
  "labels": [
    "bug",
    "enhancement"
  ]
}
```

```json
{"oneOf":[{"properties":{"labels":{"description":"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](https://docs.github.com/enterprise-server@3.0/rest/reference/issues#set-labels-for-an-issue).\"","items":{"type":"string"},"minItems":1,"type":"array"}},"type":"object"},{"items":{"type":"string"},"minItems":1,"type":"array"},{"properties":{"labels":{"items":{"properties":{"name":{"type":"string"}},"required":["name"],"type":"object"},"minItems":1,"type":"array"}},"type":"object"},{"items":{"properties":{"name":{"type":"string"}},"required":["name"],"type":"object"},"minItems":1,"type":"array"},{"type":"string"}]}
```

## Responses

### `200`

Response

### `application/json`

- Type: `array`

```json
[
  {
    "color": "f29513",
    "default": true,
    "description": "Something isn't working",
    "id": 208045946,
    "name": "bug",
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDY=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/bug"
  },
  {
    "color": "a2eeef",
    "default": false,
    "description": "New feature or request",
    "id": 208045947,
    "name": "enhancement",
    "node_id": "MDU6TGFiZWwyMDgwNDU5NDc=",
    "url": "https://api.github.com/repos/octocat/Hello-World/labels/enhancement"
  }
]
```

```json
{"items":{"$ref":"#/components/schemas/label"},"type":"array"}
```

### `410`

Gone

### `application/json`

- Type: `object`

Basic Error

```json
{"description":"Basic Error","properties":{"documentation_url":{"type":"string"},"message":{"type":"string"},"status":{"type":"string"},"url":{"type":"string"}},"title":"Basic Error","type":"object"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error

```json
{"description":"Validation Error","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"properties":{"code":{"type":"string"},"field":{"type":"string"},"index":{"type":"integer"},"message":{"type":"string"},"resource":{"type":"string"},"value":{"oneOf":[{"nullable":true,"type":"string"},{"nullable":true,"type":"integer"},{"items":{"type":"string"},"nullable":true,"type":"array"}]}},"required":["code"],"type":"object"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error","type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/issues/{issue_number}/labels \
  --header 'content-type: application/json' \
  --data '{
  "labels": [
    "bug",
    "enhancement"
  ]
}'
```
