Kontakt erstellen - API Hub
← Zurück zum API Hub

Kontakt erstellen (Create Contact)

POST /contacts/

Legt einen neuen Kontakt an. Füllt optional Tags und benutzerdefinierte Felder.

Erforderliche Header

Authorization: Bearer {{ token }}
Content-Type: application/json
Version: 2021-07-28 // Kontakt-Version
Idempotency-Key: <uuid> // Empfohlen, um doppelte Erstellung zu verhindern

Request Body (JSON)

Die wichtigsten Felder zur Erstellung eines Kontakts. locationId ist erforderlich.

{
  // --- Erforderlich ---
  "locationId": "UFeZwU5X6PIJLwU2XO3k",

  // --- Empfohlene Felder ---
  "firstName": "API",
  "lastName": "Test",
  "email": "[email protected]",
  "phone": "+4915123456789",
  "timezone": "Europe/Berlin",
  "country": "DE", // ISO-2 Code
  "assignedTo": "15tDtK9qqUdfHTtrL5np", // User-ID des "Owners"
  "tags": [
    "api",
    "deskbot"
  ],
  "customFields": [
    {
      "id": "CUSTOM_FIELD_ID_1",
      "field_value": "Wert für Feld 1"
    }
  ]
}
Hinweis zur Duplikatprüfung:

Dieser Endpunkt prüft ggf. auf Duplikate (basierend auf E-Mail/Telefon). Für eine robustere Erstellung, die Duplikate aktiv findet und aktualisiert, ist der /contacts/upsert-Endpunkt besser geeignet.

Request (cURL)

Ein vollständiger Beispiel-Request.

curl -L -X POST "https://deine-api-basis-url.com/contacts/" \
-H "Authorization: Bearer {{ token }}" \
-H "Version: 2021-07-28" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 451afac5-c2bd-4ba7-8abc-9876543210ab" \
-d '{
    "firstName": "API",
    "lastName": "Test",
    "email": "[email protected]",
    "phone": "+4915123456789",
    "locationId": "UFeZwU5X6PIJLwU2XO3k",
    "timezone": "Europe/Berlin",
    "country": "DE",
    "tags": ["api", "deskbot"]
}'

Mögliche Antworten (Response)

Antwort (201 OK): Kontakt erstellt

{
  "contact": {
    "id": "cVT5KgjznvtIfaf0UaaR",
    "firstName": "API",
    "lastName": "Test",
    "email": "[email protected]",
    "phone": "+4915123456789",
    "locationId": "UFeZwU5X6PIJLwU2XO3k",
    "tags": [
      "api",
      "deskbot"
    ]
  },
  "traceId": "7d8a2a3e-41c0-4c0d-9e1f-123456789abc"
}