# Create a Label

Endpoint:

`POST https://api.mailjet.com/v1/rest/labels`

You can create a label using this endpoint. Labels can be used to categorize resources (templates) or images for better organization.

### Body Parameters

| Name | Type | Description |
|  --- | --- | --- |
| `Name` | string | Required and unique. |
| `Color` | string | Required and should be a valid hexadecimal color (e.g., #FFFFFF). |
| `UsedFor` | string | Indicates if the label is used for a template (resource) or an image. Possible values are image or resource. Default is resource. |


### Request Example for a Template Label:

```
curl --request POST \
  --url https://api.mailjet.com/v1/rest/labels/ \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3' \
  --header 'Content-Type: application/json' \
  --data '{
    "Name": "Sport templates",
    "Color": "#FFFFFF",
    "UsedFor": "resource"
}'
```

Status code: `201`

### Request Example for an Image Label:

```
curl --request POST \
  --url https://api.mailjet.com/v1/rest/labels/ \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3' \
  --header 'Content-Type: application/json' \
  --data '{
    "Name": "Cat images",
    "Color": "#FFFFFF",
    "UsedFor": "image"
}'
```

Status code: `201`

### Response Data Field Structure

| Name | Type | Description |
|  --- | --- | --- |
| `ID` | integer | The ID of the label. |
| `Name` | string | The name of the label. |
| `Color` | string | The hexidecimal color of the label. |
| `UsedFor` | string | Indicates if the label is used for a template (resource) or an image |


### API Response Example for a Template Label:

```
{
    "Count": 1,
    "Total": 1,
    "Data": [
      {   
          "ID": 5,
          "OrganisationID": 2,
          "Name": "Sport templates",
          "Color": "#FFFFFF",
          "UsedFor": "resource"
      }
    ]
}
```

### API Response Example for an Image Label:

```
{
    "Count": 1,
    "Total": 1,
    "Data": [
      {
        "ID": 6,
        "OrganisationID": 2,
        "Name": "Cat images",
        "Color": "#FFFFFF",
        "UsedFor": "image"
      }
    ]
}
```