# Create agent label

```http
POST /projects/{project_reference}/agents/{agent_id}/labels
```

Create agent label. Requires project.agents.write.

## Parameters

| Name                 | In    | Required | Description           |
| -------------------- | ----- | -------- | --------------------- |
| `project_reference`  | path  | Yes      | Project UUID or slug. |
| `agent_id`           | path  | Yes      |                       |
| `source_target_kind` | query |          |                       |
| `target_branch_id`   | query |          |                       |

## Request body

| Field   | Type        | Required | Description                                                                                                                       |
| ------- | ----------- | -------- | --------------------------------------------------------------------------------------------------------------------------------- |
| `key`   | string      | Yes      | Required label key. Trimmed and lowercased; starts with a letter or number and allows letters, numbers, dot, underscore and dash. |
| `value` | string,null |          | Label value. Trimmed; a supplied blank value is invalid. Omit or use null for a key-only label, including on replacement.         |
| `color` | string,null |          | Display color. Omit, use null or supply a blank string to clear it, including on replacement.                                     |

## Responses

| Status | Description                                                                                                 |
| ------ | ----------------------------------------------------------------------------------------------------------- |
| 200    | Created label.                                                                                              |
| 400    | Bad request                                                                                                 |
| 401    | Unauthorized                                                                                                |
| 403    | Requires project.agents.write.                                                                              |
| 404    | Not found                                                                                                   |
| 409    | Conflict                                                                                                    |
| 500    | Server error                                                                                                |
| 503    | internal: authentication state is temporarily unavailable and the request was not processed; retry shortly. |
