Endpoints / createLead

createLead

Lead erstellen (strict)

Strict-Schema. Für tolerante Marketing-Webhooks → intakeLead oder processIntake nutzen.

HTTP Request

POST https://dev.vitabyte.ch/v1/sales/createLead
Auth basicAuth apiKey

Request Parameters

Pflicht: ispatient (0 oder 1) und mindestens eines von contact.lastname, communication.mail, communication.mobile, communication.phone.
Für Marketing-Formulare stattdessen intakeLead oder processIntake verwenden — die vertragen ein flaches, tolerantes Schema.

Parameter Pflicht Typ Beispiel / Default
ispatient

1 = Patienten-Pipeline, 0 = Kontakt-Pipeline.

required integer
enum: 0 | 1
1
contact

title, salutation, firstname, lastname, alias, gender, dob, civilStatus, nationality.

optional object
address

street, zip, city, country, countryCode.

optional object
communication

mail, mail2, phone, phone2, mobile, mobile2.

optional object
medical

bloodType, height, weight, job, hxData.

optional object
insurance

kvg, kvgPoliceNr, vvg, payerType.

optional object
commercial

Kommerzielle Zusatzangaben zum Lead.

optional object
folderId

Default 1 (Patient) bzw. 11 (Kontakt).

optional integer
1
source

Quellcode aus getReferenceData(kinds=["sources"]).

optional string
M
assigneeId

User-ID des Bearbeiters.

optional integer
default: 0
flags

Flag-Codes aus getReferenceData(kinds=["flags"]).

optional array
what

Anliegen des Leads.

optional string
Knie-Schmerzen
idempotencyKey

Empfohlen bei automatisierten Aufrufen.

optional string

Response Parameters

Fehler mit HTTP 400: At least one of contact.lastname, communication.mail, communication.mobile, communication.phone is required. bzw. Failed to create lead.

Field Typ Beschreibung
leadId integer ID des neuen Leads
uniqid string Stabile externe ID — für Integrationen der leadId vorzuziehen

Demo

Parameter und Beispiele stammen aus der internen API-Collection; die OpenAPI-Spec weicht für diesen Endpoint davon ab.

POST https://dev.vitabyte.ch/v1/sales/createLead
Payload
{
    "ispatient": 1,
    "folderId": 1,
    "source": "M",
    "assigneeId": 0,
    "contact": {
        "title": "Herr",
        "salutation": "Herr",
        "firstname": "Max",
        "lastname": "Mustermann",
        "gender": "M",
        "dob": "1980-02-21",
        "nationality": "CH"
    },
    "address": {
        "street": "Musterstrasse 1",
        "zip": "8000",
        "city": "Zürich",
        "country": "Schweiz",
        "countryCode": "CH"
    },
    "communication": {
        "mail": "max@example.com",
        "phone": "+41 44 000 00 00",
        "mobile": "+41 79 000 00 00"
    },
    "insurance": {
        "kvg": "Helsana"
    },
    "what": "Knie-Schmerzen",
    "flags": []
}
Response
{
    "status": true,
    "msg": "Success",
    "result": {
        "leadId": 12345,
        "uniqid": "5f2b9c41a7e34"
    }
}