# Labels

> Labels erstellen und verwalten, um Aktivitäten zu organisieren

- Seite: https://tbit.app/de/docs/api/tags
- Basis-URL: `https://rest-api.tbit.app/v1`
- Authentifizierung: Header `X-API-Key` mit deinem Schlüssel in jeder Anfrage (die Beispiele lesen ihn aus der Umgebungsvariable `TBIT_API_KEY`)

## Überblick

Mit Labels kategorisierst und organisierst du Aktivitäten. Jedes Label hat einen Namen, optional eine Farbe und optional eine Beschreibung. Labels gehören zu deinem Agenten.

## Endpoints

| Methode | Pfad | Beschreibung |
| --- | --- | --- |
| `GET` | `/v1/tags` | Alle Labels auflisten |
| `POST` | `/v1/tags` | Neues Label erstellen |
| `PATCH` | `/v1/tags/:id` | Label aktualisieren |
| `DELETE` | `/v1/tags/:id` | Label löschen |

## Labels auflisten

`GET /v1/tags`

```bash
curl "https://rest-api.tbit.app/v1/tags" \
  -H "X-API-Key: $TBIT_API_KEY"
```

## Label erstellen

`POST /v1/tags`

```bash
curl -X POST "https://rest-api.tbit.app/v1/tags" \
  -H "X-API-Key: $TBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "VIP",
    "color": "#ef4444",
    "description": "High-priority customers"
  }'
```

## Label aktualisieren

`PATCH /v1/tags/tag_id_1`

```bash
curl -X PATCH "https://rest-api.tbit.app/v1/tags/tag_id_1" \
  -H "X-API-Key: $TBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium",
    "color": "#8b5cf6"
  }'
```

## Label entfernen

`DELETE /v1/tags/tag_id_1`

```bash
curl -X DELETE "https://rest-api.tbit.app/v1/tags/tag_id_1" \
  -H "X-API-Key: $TBIT_API_KEY"
```

## Antwortformat

Ein Label-Objekt:

```json
{
  "data": [
    {
      "id": "tag_id_1",
      "name": "VIP",
      "color": "#ef4444",
      "description": "High-priority customers",
      "created_at": "2024-09-01T12:00:00Z",
      "updated_at": "2024-09-01T12:00:00Z"
    },
    {
      "id": "tag_id_2",
      "name": "New Lead",
      "color": "#3b82f6",
      "description": null,
      "created_at": "2024-09-02T08:00:00Z",
      "updated_at": "2024-09-02T08:00:00Z"
    }
  ]
}
```
