Démarrage rapide

1. Un administrateur crée une clé dans l'application, sous Einstellungen > API (Settings > API en anglais). La clé n'est affichée qu'une fois.

2. Envoyez-la avec chaque requête dans l'en-tête Authorization : Authorization: Bearer kf_live_...

3. Les requêtes et les réponses sont en JSON (Content-Type: application/json). Les heures sont au format ISO 8601 en UTC, les numéros de téléphone au format E.164.

Le fichier OpenAPI 3.1 décrit chaque point de terminaison pour les générateurs de code et des outils comme Postman ou Bruno.

Authentification

Les clés API commencent par kf_live_ et contiennent 256 bits aléatoires. Kontaktfix n'en enregistre qu'une empreinte (SHA-256). Une clé perdue ne peut donc plus être affichée : révoquez-la et créez-en une nouvelle. Grâce au préfixe fixe, les scanners de secrets comme celui de GitHub détectent une clé publiée par erreur dans un dépôt.

Envoyez la clé uniquement dans l'en-tête, jamais dans l'adresse, et uniquement depuis des serveurs : une clé dans le code d'un navigateur ou d'une app est publique. Conservez-la dans un coffre de secrets, donnez à chaque système sa propre clé et faites expirer les clés (30, 90 ou 365 jours). Chaque modification faite avec une clé figure dans l'historique sous API: <nom de la clé>.

Une clé manquante, erronée, révoquée ou expirée reçoit 401 avec invalid_api_key ou api_key_expired.

Accès

Les clés Lecture lisent les contacts, les listes et l'état de la distribution. Les clés Lecture et écriture peuvent en plus créer, modifier et supprimer.

Une clé peut être limitée à certaines listes. Elle fonctionne alors comme un éditeur de liste dans l'application : elle ne voit que ces listes et leurs contacts, ne crée des contacts que dans celles-ci et ne peut ni supprimer de contacts ni créer, modifier ou supprimer des listes (403 all_lists_required). Tout ce qui est hors de ses listes répond 404, comme si cela n'existait pas.

Les collaborateurs des listes d'annuaire Microsoft 365 et les contacts des listes alimentées par fichier sont en lecture seule (readOnly: true, les modifications renvoient 409). Chaque clé ne voit que sa propre organisation.

Erreurs

Les erreurs ont un code fixe dans error et, pour les erreurs de validation, les champs concernés dans issues : { "error": "validation_failed", "issues": [{ "path": "email1", "message": "invalid_email" }] }

400 saisie invalide ou champ inconnu, 401 clé, 402 abonnement terminé, 403 autorisation ou accès aux listes, 404 introuvable ou non visible, 409 contact en lecture seule ou nom de liste déjà pris, 429 limite de requêtes, 503 maintenance (avec Retry-After).

Limites et pagination

Chaque clé peut envoyer 600 requêtes par minute. Au-delà, la réponse est 429 avec Retry-After en secondes.

Les listes de contacts sont paginées : page à partir de 1 et pageSize jusqu'à 200. La réponse contient items, total, page et pageSize. Les contacts sont triés par nom.

Les modifications arrivent dans les boîtes aux lettres par la distribution normale, généralement en quelques minutes. GET /sync/status indique la progression.

Points de terminaison

Tous les chemins sont relatifs à l'URL de base. https://app.kontaktfix.ch/api/v1

Contacts

get/contacts

List contacts

Contacts sorted by name, page by page. Keys limited to lists only see contacts in those lists.

Autorisation: read

Paramètres

qquerystringSearch in name, company, job title, email, notes and phone numbers.
listIdqueryuuidOnly contacts in this list. Without it, employees from Microsoft 365 are left out.
pagequeryintegerPage, from 1.
pageSizequeryintegerItems per page, 1 to 200.

Exemple

curl "https://app.kontaktfix.ch/api/v1/contacts?q=muster&pageSize=50" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

200 OK, application/json
{
  "items": [
    {
      "id": "4b1f6a3e-2c1d-4a8e-9f5b-0c7d2e9a1b34",
      "displayName": "Anna Meier",
      "title": null,
      "givenName": "Anna",
      "middleName": null,
      "surname": "Meier",
      "nickName": null,
      "companyName": "Muster Haustechnik AG",
      "department": "Service",
      "jobTitle": "Disponentin",
      "profession": null,
      "officeLocation": "Zürich",
      "manager": null,
      "assistantName": null,
      "imAddress": null,
      "website": "https://muster-haustechnik.ch",
      "notes": "Pikett: 24 h",
      "email1": "[email protected]",
      "email2": null,
      "email3": null,
      "businessPhone1": "+41441234567",
      "businessPhone2": null,
      "mobilePhone": "+41791234567",
      "homePhone1": null,
      "homePhone2": null,
      "businessAddress": {
        "street": "Bahnhofstrasse 1",
        "postalCode": "8001",
        "city": "Zürich",
        "state": "ZH",
        "country": "Schweiz"
      },
      "homeAddress": null,
      "otherAddress": null,
      "listIds": [
        "9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71"
      ],
      "source": "manual",
      "readOnly": false,
      "hasPhoto": false,
      "createdAt": "2026-10-20T08:15:00.000Z",
      "updatedAt": "2026-10-24T13:42:10.000Z"
    }
  ],
  "total": 1,
  "page": 1,
  "pageSize": 50
}

get/contacts/{id}

Get a contact

One contact with all fields.

Autorisation: read

Paramètres

idpath, Obligatoireuuid

Exemple

curl "https://app.kontaktfix.ch/api/v1/contacts/<id>" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

200 OK, application/json
{
  "id": "4b1f6a3e-2c1d-4a8e-9f5b-0c7d2e9a1b34",
  "displayName": "Anna Meier",
  "title": null,
  "givenName": "Anna",
  "middleName": null,
  "surname": "Meier",
  "nickName": null,
  "companyName": "Muster Haustechnik AG",
  "department": "Service",
  "jobTitle": "Disponentin",
  "profession": null,
  "officeLocation": "Zürich",
  "manager": null,
  "assistantName": null,
  "imAddress": null,
  "website": "https://muster-haustechnik.ch",
  "notes": "Pikett: 24 h",
  "email1": "[email protected]",
  "email2": null,
  "email3": null,
  "businessPhone1": "+41441234567",
  "businessPhone2": null,
  "mobilePhone": "+41791234567",
  "homePhone1": null,
  "homePhone2": null,
  "businessAddress": {
    "street": "Bahnhofstrasse 1",
    "postalCode": "8001",
    "city": "Zürich",
    "state": "ZH",
    "country": "Schweiz"
  },
  "homeAddress": null,
  "otherAddress": null,
  "listIds": [
    "9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71"
  ],
  "source": "manual",
  "readOnly": false,
  "hasPhoto": false,
  "createdAt": "2026-10-20T08:15:00.000Z",
  "updatedAt": "2026-10-24T13:42:10.000Z"
}

post/contacts

Create a contact

Creates the contact and puts it into the given lists. Delivery to the mailboxes starts right away.

Autorisation: write

Requête (27)
ChampTypeDescription
titlestring
givenNamestring
middleNamestring
surnamestringgivenName, surname or companyName is required.
nickNamestring
companyNamestring
departmentstring
jobTitlestring
professionstring
officeLocationstringSite or office.
managerstring
assistantNamestring
imAddressstringTeams or SIP address.
email1string
email2string
email3string
businessPhone1stringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
businessPhone2stringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
mobilePhonestringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
homePhone1stringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
homePhone2stringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
businessAddressobject | nullObject with street, postalCode, city, state, country.
homeAddressobject | nullObject with street, postalCode, city, state, country.
otherAddressobject | nullObject with street, postalCode, city, state, country.
websitestringhttps:// is added when missing.
notesstring
listIdsuuid[]Lists the contact goes into. Required for keys limited to lists.

Exemple

curl -X POST "https://app.kontaktfix.ch/api/v1/contacts" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"givenName":"Anna","surname":"Meier","companyName":"Muster Haustechnik AG","mobilePhone":"079 123 45 67","email1":"[email protected]","listIds":["9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71"]}'

Réponse

200 OK, application/json
{
  "id": "4b1f6a3e-2c1d-4a8e-9f5b-0c7d2e9a1b34",
  "displayName": "Anna Meier",
  "title": null,
  "givenName": "Anna",
  "middleName": null,
  "surname": "Meier",
  "nickName": null,
  "companyName": "Muster Haustechnik AG",
  "department": "Service",
  "jobTitle": "Disponentin",
  "profession": null,
  "officeLocation": "Zürich",
  "manager": null,
  "assistantName": null,
  "imAddress": null,
  "website": "https://muster-haustechnik.ch",
  "notes": "Pikett: 24 h",
  "email1": "[email protected]",
  "email2": null,
  "email3": null,
  "businessPhone1": "+41441234567",
  "businessPhone2": null,
  "mobilePhone": "+41791234567",
  "homePhone1": null,
  "homePhone2": null,
  "businessAddress": {
    "street": "Bahnhofstrasse 1",
    "postalCode": "8001",
    "city": "Zürich",
    "state": "ZH",
    "country": "Schweiz"
  },
  "homeAddress": null,
  "otherAddress": null,
  "listIds": [
    "9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71"
  ],
  "source": "manual",
  "readOnly": false,
  "hasPhoto": false,
  "createdAt": "2026-10-20T08:15:00.000Z",
  "updatedAt": "2026-10-24T13:42:10.000Z"
}

patch/contacts/{id}

Update a contact

Changes only the fields you send. Send null or an empty string to clear a field. List membership is changed with the list endpoints.

Autorisation: write

Paramètres

idpath, Obligatoireuuid
Requête (26)
ChampTypeDescription
titlestring
givenNamestring
middleNamestring
surnamestringgivenName, surname or companyName is required.
nickNamestring
companyNamestring
departmentstring
jobTitlestring
professionstring
officeLocationstringSite or office.
managerstring
assistantNamestring
imAddressstringTeams or SIP address.
email1string
email2string
email3string
businessPhone1stringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
businessPhone2stringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
mobilePhonestringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
homePhone1stringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
homePhone2stringAny common format, Swiss numbers without country code too. Returned in E.164 (+41...).
businessAddressobject | nullObject with street, postalCode, city, state, country.
homeAddressobject | nullObject with street, postalCode, city, state, country.
otherAddressobject | nullObject with street, postalCode, city, state, country.
websitestringhttps:// is added when missing.
notesstring

Exemple

curl -X PATCH "https://app.kontaktfix.ch/api/v1/contacts/<id>" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jobTitle":"Leiterin Disposition","businessPhone2":null}'

Réponse

200 OK, application/json
{
  "id": "4b1f6a3e-2c1d-4a8e-9f5b-0c7d2e9a1b34",
  "displayName": "Anna Meier",
  "title": null,
  "givenName": "Anna",
  "middleName": null,
  "surname": "Meier",
  "nickName": null,
  "companyName": "Muster Haustechnik AG",
  "department": "Service",
  "jobTitle": "Disponentin",
  "profession": null,
  "officeLocation": "Zürich",
  "manager": null,
  "assistantName": null,
  "imAddress": null,
  "website": "https://muster-haustechnik.ch",
  "notes": "Pikett: 24 h",
  "email1": "[email protected]",
  "email2": null,
  "email3": null,
  "businessPhone1": "+41441234567",
  "businessPhone2": null,
  "mobilePhone": "+41791234567",
  "homePhone1": null,
  "homePhone2": null,
  "businessAddress": {
    "street": "Bahnhofstrasse 1",
    "postalCode": "8001",
    "city": "Zürich",
    "state": "ZH",
    "country": "Schweiz"
  },
  "homeAddress": null,
  "otherAddress": null,
  "listIds": [
    "9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71"
  ],
  "source": "manual",
  "readOnly": false,
  "hasPhoto": false,
  "createdAt": "2026-10-20T08:15:00.000Z",
  "updatedAt": "2026-10-24T13:42:10.000Z"
}

delete/contacts/{id}

Delete a contact

Deletes the contact and removes it from all mailboxes.

Autorisation: write, Clé sans limitation de listes

Paramètres

idpath, Obligatoireuuid

Exemple

curl -X DELETE "https://app.kontaktfix.ch/api/v1/contacts/<id>" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

204 No Content

Listes

get/lists

List lists

All lists the key may see, sorted by name.

Autorisation: read

Exemple

curl "https://app.kontaktfix.ch/api/v1/lists" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

200 OK, application/json
[
  {
    "id": "9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71",
    "name": "Lieferanten",
    "description": "Alle Lieferanten mit Pikettnummern",
    "color": "iris",
    "kind": "manual",
    "contactCount": 128,
    "readOnly": false,
    "createdAt": "2026-09-02T09:00:00.000Z",
    "updatedAt": "2026-10-24T13:42:10.000Z"
  }
]

get/lists/{id}

Get a list

One list.

Autorisation: read

Paramètres

idpath, Obligatoireuuid

Exemple

curl "https://app.kontaktfix.ch/api/v1/lists/<id>" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

200 OK, application/json
{
  "id": "9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71",
  "name": "Lieferanten",
  "description": "Alle Lieferanten mit Pikettnummern",
  "color": "iris",
  "kind": "manual",
  "contactCount": 128,
  "readOnly": false,
  "createdAt": "2026-09-02T09:00:00.000Z",
  "updatedAt": "2026-10-24T13:42:10.000Z"
}

post/lists

Create a list

Creates a manual list. Who receives it is set in the app (Lists > Assignments).

Autorisation: write, Clé sans limitation de listes

Requête (3)
ChampTypeDescription
nameObligatoirestring
descriptionstring | null
color"gray" | "iris" | "blue" | "teal" | "green" | "amber" | "orange" | "red" | "pink" | "violet"

Exemple

curl -X POST "https://app.kontaktfix.ch/api/v1/lists" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Lieferanten","description":"Alle Lieferanten mit Pikettnummern","color":"iris"}'

Réponse

200 OK, application/json
{
  "id": "9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71",
  "name": "Lieferanten",
  "description": "Alle Lieferanten mit Pikettnummern",
  "color": "iris",
  "kind": "manual",
  "contactCount": 128,
  "readOnly": false,
  "createdAt": "2026-09-02T09:00:00.000Z",
  "updatedAt": "2026-10-24T13:42:10.000Z"
}

patch/lists/{id}

Update a list

Changes name, description or color. The name is the Outlook category, so a rename updates the delivered contacts.

Autorisation: write, Clé sans limitation de listes

Paramètres

idpath, Obligatoireuuid
Requête (3)
ChampTypeDescription
namestring
descriptionstring | null
color"gray" | "iris" | "blue" | "teal" | "green" | "amber" | "orange" | "red" | "pink" | "violet"

Exemple

curl -X PATCH "https://app.kontaktfix.ch/api/v1/lists/<id>" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Lieferanten Schweiz"}'

Réponse

200 OK, application/json
{
  "id": "9e2c4d1a-7b3f-4e8a-a1c5-3d6f8b0e2a71",
  "name": "Lieferanten",
  "description": "Alle Lieferanten mit Pikettnummern",
  "color": "iris",
  "kind": "manual",
  "contactCount": 128,
  "readOnly": false,
  "createdAt": "2026-09-02T09:00:00.000Z",
  "updatedAt": "2026-10-24T13:42:10.000Z"
}

delete/lists/{id}

Delete a list

Deletes the list. Its contacts stay, but leave the mailboxes that received them only through this list.

Autorisation: write, Clé sans limitation de listes

Paramètres

idpath, Obligatoireuuid

Exemple

curl -X DELETE "https://app.kontaktfix.ch/api/v1/lists/<id>" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

204 No Content

put/lists/{id}/contacts/{contactId}

Add a contact to a list

Idempotent: adding a contact that is already in the list changes nothing.

Autorisation: write

Paramètres

idpath, Obligatoireuuid
contactIdpath, Obligatoireuuid

Exemple

curl -X PUT "https://app.kontaktfix.ch/api/v1/lists/<id>/contacts/<contactId>" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

204 No Content

delete/lists/{id}/contacts/{contactId}

Remove a contact from a list

The contact itself stays. Idempotent.

Autorisation: write

Paramètres

idpath, Obligatoireuuid
contactIdpath, Obligatoireuuid

Exemple

curl -X DELETE "https://app.kontaktfix.ch/api/v1/lists/<id>/contacts/<contactId>" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

204 No Content

État de la distribution

get/sync/status

Delivery status

Connection to Microsoft 365, people by status and the last delivery run.

Autorisation: read

Exemple

curl "https://app.kontaktfix.ch/api/v1/sync/status" \
  -H "Authorization: Bearer $KONTAKTFIX_API_KEY"

Réponse

200 OK, application/json
{
  "connection": "granted",
  "running": false,
  "lastSuccessAt": "2026-10-25T06:00:12.000Z",
  "recipients": {
    "pending": 0,
    "syncing": 0,
    "ok": 48,
    "error": 1,
    "unreachable": 2,
    "removing": 0
  },
  "lastRun": {
    "id": "c3a7e5f2-1b9d-4c6e-8a2f-7d0b4e1c9a53",
    "trigger": "change",
    "status": "done",
    "startedAt": "2026-10-25T06:00:00.000Z",
    "finishedAt": "2026-10-25T06:00:12.000Z",
    "created": 3,
    "updated": 51,
    "deleted": 0,
    "errors": 0
  }
}

Webhooks

Les webhooks signalent à votre système qu'un élément a changé, sans qu'il doive le demander. Un administrateur ajoute une adresse HTTPS sous Einstellungen > API (Settings > API) et choisit les événements. Kontaktfix envoie un POST avec un petit contenu JSON, généralement en moins d'une minute : { "type": "contact.updated", "timestamp": "2026-10-25T08:15:00.000Z", "data": { "id": "..." } }

Le contenu ne contient que des identifiants. Vous obtenez l'état actuel via l'API. Ainsi, aucune donnée de contact n'est envoyée, et un événement en retard ne cause aucun dommage.

Événements

contact.createdUn contact a été créé (application, import ou API). data.id
contact.updatedUn contact ou sa photo a été modifié. data.id
contact.deletedUn contact a été supprimé. data.id
list.createdUne liste a été créée. data.id
list.updatedLe nom, la description ou la couleur d'une liste a été modifié. data.id
list.deletedUne liste a été supprimée. data.id
list.contacts_changedDes contacts ont été ajoutés à une liste ou en ont été retirés. data.id, data.change, data.count
sync.completedUne distribution est terminée. data.runId, data.status, chiffres
delivery.failedLa distribution dans une boîte aux lettres a échoué. data.userId, data.reason, data.runId
recipient.unreachableUne personne n'est pas joignable, par exemple faute de boîte aux lettres. Envoyé une fois, au début. data.userId, data.reason
webhook.testEnvoyé avec le bouton d'envoi d'un événement de test.

Vérifier la signature

Les webhooks sont signés comme les Standard Webhooks, leurs bibliothèques fonctionnent donc aussi. Chaque requête contient les en-têtes webhook-id, webhook-timestamp (secondes Unix) et webhook-signature (v1,<signature>).

La signature est un HMAC-SHA256 sur id.timestamp.body avec la partie décodée en base64 de votre secret après whsec_. Utilisez le contenu brut avant l'analyse, comparez en temps constant et rejetez les horodatages de plus de 5 minutes. webhook-id reste identique lors des nouvelles tentatives : il vous permet de détecter les doublons.

import { createHmac, timingSafeEqual } from "node:crypto";

/** headers: the request headers, rawBody: the body as received, before JSON.parse. */
export function verifyKontaktfixWebhook(secret, headers, rawBody) {
  const id = headers["webhook-id"];
  const timestamp = headers["webhook-timestamp"];
  if (!id || !timestamp || Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
  const key = Buffer.from(secret.slice("whsec_".length), "base64");
  const expected = createHmac("sha256", key).update(`${id}.${timestamp}.${rawBody}`).digest("base64");
  return (headers["webhook-signature"] ?? "").split(" ").some((part) => {
    const [version, signature = ""] = part.split(",");
    return version === "v1" && signature.length === expected.length &&
      timingSafeEqual(Buffer.from(signature), Buffer.from(expected));
  });
}

Nouvelles tentatives

Répondez en moins de 10 secondes avec un statut 2xx et faites le travail ensuite. Toute autre réponse, une redirection ou une absence de réponse compte comme un échec. L'envoi est alors répété après 1 et 5 minutes, 30 minutes, 2, 5 et 10 heures, puis encore 10 heures plus tard, avant d'être abandonné (environ 28 heures). L'application affiche le dernier statut pour chaque adresse.