---
title: "Create Label"
url: "https://docs.yoagent.dev/reference/rest-api/operations/createlabel"
---

# Create Label

POST

/v0/labels

```sh
curl -s -X POST "https://api.yoagent.dev/v0/labels" \
  -H "Authorization: Bearer $YOAGENT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"verified","inbox_id":"test@k7m2xq4p.yoagent.email"}'
```

```js
const response = await fetch("https://api.yoagent.dev/v0/labels", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.YOAGENT_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "verified",
    "inbox_id": "test@k7m2xq4p.yoagent.email"
  }),
});
if (!response.ok) throw new Error(await response.text());
const data = await response.json();
```

```python
import os

import requests

response = requests.post(
    "https://api.yoagent.dev/v0/labels",
    headers={"Authorization": f"Bearer {os.environ['YOAGENT_KEY']}"},
    json={
        "name": "verified",
        "inbox_id": "test@k7m2xq4p.yoagent.email",
    },
    timeout=60,
)
response.raise_for_status()
data = response.json()
```

- api.yoagent.dev/v0/labels

Make a label of a project (of `project_id`, or of `inbox_id`’s project): every inbox of the project shows it. The same name again answers the label there is (200).

## Authorizations

- **[ApiKey](https://docs.yoagent.dev/reference/rest-api#apikey)**

## Request Body required

application/json

_LabelCreate_

Make a label of a project: of `project_id`, or of the project of `inbox_id` (give one). The same name again answers the label there is.

object

**name**

required

_Name_

The label’s name.

string

\>= 1 characters <= 64 characters /^\[\w.:-]+$/

**project_id**

_Project Id_

The project the label belongs to.

Any of:

**string**

string

/^prj\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**null**

null

**inbox_id**

_Inbox Id_

Or an inbox of that project: its id, address or `*@domain` (the catch-all).

Any of:

**string**

Inbox id (inb\_…), address or \*@domain (the catch-all)

string

**null**

null

## Responses

### 200

The project has a label of this name already

application/json

_LabelOut_

A project’s own label.

object

**version**

required

_Version_

Goes up by one on every change: of two copies, the one with the higher version is the newer.

integer

**label_id**

required

_Label Id_

string

/^lbl\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**project_id**

required

_Project Id_

string

/^prj\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**name**

required

_Name_

string

#### Example

```json
{
  "version": 1,
  "label_id": "lbl_01je56wqswfmn9pgbc1wq8tjgq",
  "project_id": "prj_01je56wqswfmn9pgbc1wq8tjgq",
  "name": "verified"
}
```

### 201

Successful Response

application/json

_LabelOut_

A project’s own label.

object

**version**

required

_Version_

Goes up by one on every change: of two copies, the one with the higher version is the newer.

integer

**label_id**

required

_Label Id_

string

/^lbl\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**project_id**

required

_Project Id_

string

/^prj\_\[0-7]\[0-9a-hjkmnp-tv-z]{25}$/

**name**

required

_Name_

string

#### Example

```json
{
  "version": 1,
  "label_id": "lbl_01je56wqswfmn9pgbc1wq8tjgq",
  "project_id": "prj_01je56wqswfmn9pgbc1wq8tjgq",
  "name": "verified"
}
```

### default

An error (400, 401, 403, 404, 405, 409, 413, 429, 500, 503), in the one shape every call answers: [Errors](https://docs.yoagent.dev/reference/conventions#errors).
