# Create a label

From **GitHub v3 REST API**.

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

Create a label

## Parameters

### `owner`

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

### `repo`

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

## Request body

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

- Type: `object`

```json
{
  "color": "f29513",
  "description": "Something isn't working",
  "name": "bug"
}
```

```json
{"properties":{"color":{"description":"The [hexadecimal color code](http://www.color-hex.com/) for the label, without the leading `#`.","type":"string"},"description":{"description":"A short description of the label. Must be 100 characters or fewer.","type":"string"},"name":{"description":"The 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).\"","type":"string"}},"required":["name"],"type":"object"}
```

## Responses

### `201`

Response

#### Headers

##### `Location`

- Type: `string`

- Example: `https://api.github.com/repos/octocat/Hello-World/labels/bug`

### `application/json`

- Type: `object`

Color-coded labels help you categorize and filter your issues (just like labels in Gmail).

```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"
}
```

```json
{"description":"Color-coded labels help you categorize and filter your issues (just like labels in Gmail).","properties":{"color":{"description":"6-character hex code, without the leading #, identifying the color","example":"FFFFFF","type":"string"},"default":{"example":true,"type":"boolean"},"description":{"example":"Something isn't working","nullable":true,"type":"string"},"id":{"example":208045946,"format":"int64","type":"integer"},"name":{"description":"The name of the label.","example":"bug","type":"string"},"node_id":{"example":"MDU6TGFiZWwyMDgwNDU5NDY=","type":"string"},"url":{"description":"URL for the label","example":"https://api.github.com/repositories/42/labels/bug","format":"uri","type":"string"}},"required":["id","node_id","url","name","description","color","default"],"title":"Label","type":"object"}
```

### `404`

Resource not found

### `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}/labels \
  --header 'content-type: application/json' \
  --data '{
  "color": "f29513",
  "description": "Something isn'\''t working",
  "name": "bug"
}'
```
