---
title: "Tag einem Monitor zuweisen"
description: "Weist einem Monitor einen bestehenden Tag zu. Der Aufrufer benötigt Lesezugriff auf den Monitor und Sichtbarkeit des Tags. Die Operation ist idempotent."
---

`POST /api/monitor-tags`

## Body

```json
{
  "monitorType": "website",
  "monitorId": 101,
  "tagId": 1
}
```

- `monitorType` (erforderlich): Typ des Monitors. Eines von: `website` | `dns` | `icmp` | `smtp` | `ssh` | `tcp` | `ftp` | `imap_pop` | `customer_domain` | `customer_ip`. Nutze `customer_domain` für Domain-Monitore (SSL/Ablauf) und `customer_ip` für DNSBL-/Blacklist-Monitore.
- `monitorId` (erforderlich): Numerische ID des Monitors.
- `tagId` (erforderlich): Numerische ID des zuzuweisenden Tags.

Diese Operation ist **idempotent**: Wird sie erneut aufgerufen, wenn der Tag bereits zugewiesen ist, wird die bestehende Zuweisung ohne Fehler zurückgegeben.

## Beispiel (cURL)

```bash
BASE_URL="https://uptimeify.io"
TOKEN="<dein-api-token>"

curl -X POST "$BASE_URL/api/monitor-tags" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"monitorType":"website","monitorId":101,"tagId":1}'
```

## Antwort (Response)

```json
{
  "monitorType": "website",
  "monitorId": 101,
  "tagId": 1,
  "createdAt": "2026-06-29T12:00:00.000Z"
}
```

## Häufige Fehler

- `400 Bad Request` wenn `monitorType` kein unterstützter Typ ist
- `401 Unauthorized` wenn du nicht angemeldet bist
- `403 Forbidden` wenn du keinen Lesezugriff auf den Monitor hast oder den Tag nicht siehst
- `404 Not Found` wenn Monitor oder Tag nicht existieren
