Avvio rapido
1. Un amministratore crea una chiave nell'app in Impostazioni > API. La chiave viene mostrata una sola volta.
2. La invii a ogni richiesta nell'header Authorization: Authorization: Bearer kf_live_...
3. Richieste e risposte sono in JSON (Content-Type: application/json). Gli orari sono ISO 8601 in UTC, i numeri di telefono E.164.
Il file OpenAPI 3.1 descrive ogni endpoint per generatori di codice e strumenti come Postman o Bruno.
Autenticazione
Le chiavi API iniziano con kf_live_ e contengono 256 bit casuali. Kontaktfix salva solo un'impronta (SHA-256). Una chiave persa quindi non si può più visualizzare: la revochi e ne crei una nuova. Grazie al prefisso fisso, gli scanner di segreti come quello di GitHub riconoscono una chiave inserita per errore in un repository.
Invii la chiave solo nell'header, mai nell'indirizzo, e solo da server: una chiave nel codice del browser o di un'app è pubblica. La conservi in un archivio di segreti, dia a ogni sistema una chiave propria e faccia scadere le chiavi (30, 90 o 365 giorni). Ogni modifica effettuata con una chiave compare nella cronologia come API: <nome della chiave>.
Una chiave mancante, errata, revocata o scaduta riceve 401 con invalid_api_key o api_key_expired.
Accesso
Le chiavi con Lettura leggono contatti, liste e lo stato della distribuzione. Le chiavi con Lettura e scrittura possono inoltre creare, modificare ed eliminare.
Una chiave si può limitare a determinate liste. Funziona allora come un editor della lista nell'app: vede solo queste liste e i loro contatti, crea contatti solo al loro interno e non può né eliminare contatti né creare, modificare o eliminare liste (403 all_lists_required). Tutto ciò che è al di fuori delle sue liste risponde con 404, come se non esistesse.
I collaboratori provenienti da liste di directory di Microsoft 365 e i contatti provenienti da liste di file sono di sola lettura (readOnly: true, le modifiche restituiscono 409). Ogni chiave vede solo la propria organizzazione.
Errori
Gli errori hanno un codice fisso in error e, in caso di errori di convalida, anche i campi in issues: { "error": "validation_failed", "issues": [{ "path": "email1", "message": "invalid_email" }] }
400 input non valido o campo sconosciuto, 401 chiave, 402 abbonamento terminato, 403 autorizzazione o accesso alla lista, 404 non trovato o non visibile, 409 contatto di sola lettura o nome della lista già in uso, 429 limite di richieste, 503 manutenzione (con Retry-After).
Limiti e paginazione
Ogni chiave può inviare 600 richieste al minuto. Oltre questo limite la risposta è 429 con Retry-After in secondi.
Gli elenchi di contatti arrivano a pagine: page a partire da 1 e pageSize fino a 200. La risposta contiene items, total, page e pageSize. I contatti sono ordinati per nome.
Le modifiche arrivano nelle cassette postali tramite la normale distribuzione, di solito in pochi minuti. GET /sync/status mostra l'avanzamento.
Endpoint
Tutti i percorsi sono relativi all'URL di base. https://app.kontaktfix.ch/api/v1
Contatti
get/contacts
List contacts
Contacts sorted by name, page by page. Keys limited to lists only see contacts in those lists.
Autorizzazione: read
Parametri
| qquery | string | Search in name, company, job title, email, notes and phone numbers. |
|---|---|---|
| listIdquery | uuid | Only contacts in this list. Without it, employees from Microsoft 365 are left out. |
| pagequery | integer | Page, from 1. |
| pageSizequery | integer | Items per page, 1 to 200. |
Esempio
curl "https://app.kontaktfix.ch/api/v1/contacts?q=muster&pageSize=50" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
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.
Autorizzazione: read
Parametri
| idpath, Obbligatorio | uuid |
|---|
Esempio
curl "https://app.kontaktfix.ch/api/v1/contacts/<id>" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
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.
Autorizzazione: write
Richiesta (27)
| Campo | Tipo | Descrizione |
|---|---|---|
| title | string | |
| givenName | string | |
| middleName | string | |
| surname | string | givenName, surname or companyName is required. |
| nickName | string | |
| companyName | string | |
| department | string | |
| jobTitle | string | |
| profession | string | |
| officeLocation | string | Site or office. |
| manager | string | |
| assistantName | string | |
| imAddress | string | Teams or SIP address. |
| email1 | string | |
| email2 | string | |
| email3 | string | |
| businessPhone1 | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| businessPhone2 | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| mobilePhone | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| homePhone1 | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| homePhone2 | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| businessAddress | object | null | Object with street, postalCode, city, state, country. |
| homeAddress | object | null | Object with street, postalCode, city, state, country. |
| otherAddress | object | null | Object with street, postalCode, city, state, country. |
| website | string | https:// is added when missing. |
| notes | string | |
| listIds | uuid[] | Lists the contact goes into. Required for keys limited to lists. |
Esempio
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"]}'Risposta
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.
Autorizzazione: write
Parametri
| idpath, Obbligatorio | uuid |
|---|
Richiesta (26)
| Campo | Tipo | Descrizione |
|---|---|---|
| title | string | |
| givenName | string | |
| middleName | string | |
| surname | string | givenName, surname or companyName is required. |
| nickName | string | |
| companyName | string | |
| department | string | |
| jobTitle | string | |
| profession | string | |
| officeLocation | string | Site or office. |
| manager | string | |
| assistantName | string | |
| imAddress | string | Teams or SIP address. |
| email1 | string | |
| email2 | string | |
| email3 | string | |
| businessPhone1 | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| businessPhone2 | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| mobilePhone | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| homePhone1 | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| homePhone2 | string | Any common format, Swiss numbers without country code too. Returned in E.164 (+41...). |
| businessAddress | object | null | Object with street, postalCode, city, state, country. |
| homeAddress | object | null | Object with street, postalCode, city, state, country. |
| otherAddress | object | null | Object with street, postalCode, city, state, country. |
| website | string | https:// is added when missing. |
| notes | string |
Esempio
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}'Risposta
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.
Autorizzazione: write, Chiave senza limitazione a liste
Parametri
| idpath, Obbligatorio | uuid |
|---|
Esempio
curl -X DELETE "https://app.kontaktfix.ch/api/v1/contacts/<id>" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
204 No Content
Liste
get/lists
List lists
All lists the key may see, sorted by name.
Autorizzazione: read
Esempio
curl "https://app.kontaktfix.ch/api/v1/lists" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
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.
Autorizzazione: read
Parametri
| idpath, Obbligatorio | uuid |
|---|
Esempio
curl "https://app.kontaktfix.ch/api/v1/lists/<id>" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
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).
Autorizzazione: write, Chiave senza limitazione a liste
Richiesta (3)
| Campo | Tipo | Descrizione |
|---|---|---|
| nameObbligatorio | string | |
| description | string | null | |
| color | "gray" | "iris" | "blue" | "teal" | "green" | "amber" | "orange" | "red" | "pink" | "violet" |
Esempio
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"}'Risposta
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.
Autorizzazione: write, Chiave senza limitazione a liste
Parametri
| idpath, Obbligatorio | uuid |
|---|
Richiesta (3)
| Campo | Tipo | Descrizione |
|---|---|---|
| name | string | |
| description | string | null | |
| color | "gray" | "iris" | "blue" | "teal" | "green" | "amber" | "orange" | "red" | "pink" | "violet" |
Esempio
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"}'Risposta
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.
Autorizzazione: write, Chiave senza limitazione a liste
Parametri
| idpath, Obbligatorio | uuid |
|---|
Esempio
curl -X DELETE "https://app.kontaktfix.ch/api/v1/lists/<id>" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
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.
Autorizzazione: write
Parametri
| idpath, Obbligatorio | uuid | |
|---|---|---|
| contactIdpath, Obbligatorio | uuid |
Esempio
curl -X PUT "https://app.kontaktfix.ch/api/v1/lists/<id>/contacts/<contactId>" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
204 No Content
delete/lists/{id}/contacts/{contactId}
Remove a contact from a list
The contact itself stays. Idempotent.
Autorizzazione: write
Parametri
| idpath, Obbligatorio | uuid | |
|---|---|---|
| contactIdpath, Obbligatorio | uuid |
Esempio
curl -X DELETE "https://app.kontaktfix.ch/api/v1/lists/<id>/contacts/<contactId>" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
204 No Content
Stato della distribuzione
get/sync/status
Delivery status
Connection to Microsoft 365, people by status and the last delivery run.
Autorizzazione: read
Esempio
curl "https://app.kontaktfix.ch/api/v1/sync/status" \
-H "Authorization: Bearer $KONTAKTFIX_API_KEY"Risposta
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
}
}Webhook
I webhook avvisano il Suo sistema quando qualcosa cambia, senza che debba chiedere. Un amministratore aggiunge un indirizzo HTTPS in Impostazioni > API e sceglie gli eventi. Kontaktfix invia un POST con un piccolo contenuto JSON, di solito entro un minuto: { "type": "contact.updated", "timestamp": "2026-10-25T08:15:00.000Z", "data": { "id": "..." } }
Il contenuto contiene solo ID. Lo stato attuale lo ottiene tramite l'API. Così non vengono inviati dati di contatto e un evento in ritardo non crea danni.
Eventi
| contact.created | È stato creato un contatto (app, importazione o API). data.id |
|---|---|
| contact.updated | Un contatto o la sua foto è stato modificato. data.id |
| contact.deleted | È stato eliminato un contatto. data.id |
| list.created | È stata creata una lista. data.id |
| list.updated | Il nome, la descrizione o il colore di una lista è stato modificato. data.id |
| list.deleted | È stata eliminata una lista. data.id |
| list.contacts_changed | Sono stati aggiunti o rimossi contatti da una lista. data.id, data.change, data.count |
| sync.completed | Un ciclo di distribuzione è terminato. data.runId, data.status, cifre |
| delivery.failed | La distribuzione in una cassetta postale non è riuscita. data.userId, data.reason, data.runId |
| recipient.unreachable | Una persona non è raggiungibile, ad es. nessuna cassetta postale. Inviato una volta all'inizio. data.userId, data.reason |
| webhook.test | Inviato con Invia evento di prova. |
Verificare la firma
I webhook sono firmati come Standard Webhooks, quindi funzionano anche le relative librerie. Ogni richiesta ha gli header webhook-id, webhook-timestamp (secondi Unix) e webhook-signature (v1,<firma>).
La firma è HMAC-SHA256 su id.timestamp.body con la parte decodificata in base64 del Suo segreto dopo whsec_. Utilizzi il contenuto grezzo prima del parsing, confronti in tempo costante e rifiuti i timestamp più vecchi di 5 minuti. webhook-id resta uguale nei tentativi ripetuti: così riconosce i doppioni.
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));
});
}Tentativi ripetuti
Risponda entro 10 secondi con uno stato 2xx e svolga il lavoro in seguito. Qualsiasi altra risposta, un reindirizzamento o l'assenza di risposta conta come fallimento e viene ripetuto dopo 1 e 5 minuti, 30 minuti, 2, 5 e 10 ore e ancora 10 ore più tardi, poi abbandonato (circa 28 ore). L'app mostra l'ultimo stato per ogni indirizzo.