---
updatedAt: 2026-10-17T17:21:35.000Z
agentTools:
  projectIndex: https://developer.surense.com/llms.txt
---

# Create a lead

Creates a lead and returns it.

**Customer resolution.** Every lead belongs to a customer, resolved in this order:
1. `customerId` given: that customer (the caller must be allowed to access it).
2. Otherwise `idNumber` given: an accessible customer of the tenant with that ID number. If customers with that ID number exist but none is accessible, the request fails unless the account allows duplicate customers.
3. Otherwise `phoneNumber1` and/or `email` (at least one is required): the accessible customer with that cell phone or email whose name is closest to `firstName`/`lastName`. If matching customers exist but none is accessible, the request fails.

When no customer matches, a new customer is created from the lead's personal details (managed by `managerId`, else `ownerId` - one of them is then required). The customer is committed even if the lead creation then fails. If the new customer conflicts with existing ones, the call fails with error code 40204 and the conflicting customers (set `forceCreation: true` to create it anyway).

**Contact-point reuse.** With `reuseOpenLead: true`, if the customer already has an open lead of the same type, this submission is appended to that lead as a contact point (and its status updated when a non-closed `statusId` is given) instead of creating a new lead; no lead-created event is published.

**Defaults.** `statusId` defaults to the tenant's initial status. With a `templateId`, the template's notes, checklists and assignee are applied (the template must belong to the same lead type). `dueAt` requires `dueAtTimeSet`.

**Side effects:** publishes a lead-created event (triggering automations and webhooks).

**Authorization:** scope `leads:create`.

**Errors:** 400 (error code 40001) for invalid phone/email, a duplicate `externalId`, an inactive type/status/owner/assignee, a template that does not match the type, or missing contact details; 400 (error code 40000) when the type, status, owner, assignee or customer is not found or not accessible; 404 for an unknown source, template, agency or custom field; error code 40204 on a customer conflict.

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Lead API",
    "description": "Manages leads — sales opportunities linked to a customer — with their types, statuses, checklists,\ntemplates, imports and exports. Every lead belongs to a customer: creating a lead either attaches it\nto an existing customer (by ID, ID number, phone or email) or creates the customer.\n\nAll data is tenant-scoped and never crosses tenants. A lead is visible to the users allowed to\naccess it: owner, assignee, customer managers and their teams, the agency with the agency-wide\npermission, and sensitive customers only with the matching permission. Types, statuses and\ntemplates are tenant-wide settings; imports and exports are visible only to the user who created\nthem.\n\nAuthenticate with an OAuth2 bearer token. Each operation lists the scope it requires; some fields\nadditionally require a user permission, as stated in the operation description. Authorization\nfailures are returned as HTTP 400 with error code 40000, invalid input as HTTP 400 with error code\n40001, and unknown resources as HTTP 404.\n",
    "version": "1.0.20"
  },
  "servers": [
    {
      "url": "https://api.surense.com/api/v1",
      "description": "Production"
    }
  ],
  "security": [
    {
      "oauth2": []
    }
  ],
  "tags": [
    {
      "name": "Leads",
      "description": "Create, read, search, update, duplicate, transfer and delete leads (sales opportunities linked to a customer), and manage the tenant's lead types, lead statuses and lead fields."
    }
  ],
  "paths": {
    "/leads": {
      "post": {
        "tags": [
          "Leads"
        ],
        "summary": "Create a lead",
        "description": "Creates a lead and returns it.\n\n**Customer resolution.** Every lead belongs to a customer, resolved in this order:\n1. `customerId` given: that customer (the caller must be allowed to access it).\n2. Otherwise `idNumber` given: an accessible customer of the tenant with that ID number. If customers with that ID number exist but none is accessible, the request fails unless the account allows duplicate customers.\n3. Otherwise `phoneNumber1` and/or `email` (at least one is required): the accessible customer with that cell phone or email whose name is closest to `firstName`/`lastName`. If matching customers exist but none is accessible, the request fails.\n\nWhen no customer matches, a new customer is created from the lead's personal details (managed by `managerId`, else `ownerId` - one of them is then required). The customer is committed even if the lead creation then fails. If the new customer conflicts with existing ones, the call fails with error code 40204 and the conflicting customers (set `forceCreation: true` to create it anyway).\n\n**Contact-point reuse.** With `reuseOpenLead: true`, if the customer already has an open lead of the same type, this submission is appended to that lead as a contact point (and its status updated when a non-closed `statusId` is given) instead of creating a new lead; no lead-created event is published.\n\n**Defaults.** `statusId` defaults to the tenant's initial status. With a `templateId`, the template's notes, checklists and assignee are applied (the template must belong to the same lead type). `dueAt` requires `dueAtTimeSet`.\n\n**Side effects:** publishes a lead-created event (triggering automations and webhooks).\n\n**Authorization:** scope `leads:create`.\n\n**Errors:** 400 (error code 40001) for invalid phone/email, a duplicate `externalId`, an inactive type/status/owner/assignee, a template that does not match the type, or missing contact details; 400 (error code 40000) when the type, status, owner, assignee or customer is not found or not accessible; 404 for an unknown source, template, agency or custom field; error code 40204 on a customer conflict.",
        "operationId": "createLead",
        "requestBody": {
          "description": "The lead to create. `typeId` is required, plus either `customerId`, `idNumber`, `phoneNumber1` or `email`.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateLeadRequest"
              },
              "examples": {
                "newProspect": {
                  "summary": "Lead for a new prospect (customer matched or created from contact details)",
                  "description": "newProspect",
                  "value": {
                    "typeId": "3f2b8c1e-7d4a-4e9b-9c2f-1a6d5e8b7c40",
                    "sourceId": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d",
                    "ownerId": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
                    "assignedUserId": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
                    "externalId": "LP-2026-004512",
                    "leadDate": "2026-10-18T07:30:00Z",
                    "dueAt": "2026-10-20T09:00:00Z",
                    "dueAtTimeSet": true,
                    "firstName": "נועה",
                    "lastName": "לוי",
                    "idType": 1,
                    "idNumber": "000000018",
                    "phoneNumber1": "0501234567",
                    "email": "noa.levi@example.com",
                    "city": "תל אביב",
                    "gender": 3,
                    "birthDate": "1988-04-12",
                    "smoker": false,
                    "notes": "מעוניינת בבדיקת ביטוח בריאות ופנסיה",
                    "funnel": "Landing page - health insurance",
                    "utmSource": "facebook",
                    "utmMedium": "cpc",
                    "utmCampaign": "health-q4-2026",
                    "reuseOpenLead": true,
                    "customFields": [
                      {
                        "fieldId": "7e6d5c4b-3a29-4180-9f7e-6d5c4b3a2918",
                        "fieldVal": "ביטוח בריאות"
                      }
                    ]
                  }
                },
                "existingCustomer": {
                  "summary": "Lead for an existing customer",
                  "description": "existingCustomer",
                  "value": {
                    "typeId": "3f2b8c1e-7d4a-4e9b-9c2f-1a6d5e8b7c40",
                    "customerId": "2c4e6a8b-0d1f-4a3c-9e5b-7d9f1b3d5f70",
                    "templateId": "6f5e4d3c-2b1a-4098-8f7e-6d5c4b3a2910",
                    "notes": "חידוש פוליסת רכב"
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/LeadValue"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth2": [
              "leads:create"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ContactPointValue": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Contact point ID (UUID)",
            "format": "uuid",
            "example": "b1c2d3e4-f5a6-4b7c-8d9e-0f1a2b3c4d5e"
          },
          "contactDate": {
            "type": "string",
            "description": "When the submission was received",
            "format": "date-time",
            "example": "2026-10-18T07:30:00Z"
          },
          "externalId": {
            "type": "string",
            "description": "External ID sent with the submission",
            "example": "LP-2026-004512"
          },
          "funnel": {
            "type": "string",
            "description": "Funnel (free text) sent with the submission",
            "example": "Landing page - health insurance"
          },
          "notes": {
            "type": "string",
            "description": "Notes sent with the submission"
          },
          "sourceId": {
            "type": "string",
            "description": "ID (UUID) of the source of the submission",
            "format": "uuid",
            "example": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
          },
          "statusId": {
            "type": "string",
            "description": "ID (UUID) of the status requested by the submission",
            "format": "uuid"
          },
          "phoneNumber1": {
            "type": "string",
            "description": "Cell phone sent with the submission",
            "example": "0501234567"
          },
          "phoneNumber2": {
            "type": "string",
            "description": "Additional phone sent with the submission"
          },
          "email": {
            "type": "string",
            "description": "Email sent with the submission",
            "example": "noa.levi@example.com"
          },
          "utmId": {
            "type": "string",
            "description": "UTM ID"
          },
          "utmSource": {
            "type": "string",
            "description": "UTM source",
            "example": "facebook"
          },
          "utmMedium": {
            "type": "string",
            "description": "UTM medium",
            "example": "cpc"
          },
          "utmCampaign": {
            "type": "string",
            "description": "UTM campaign",
            "example": "health-q4-2026"
          },
          "utmTerm": {
            "type": "string",
            "description": "UTM term"
          },
          "utmContent": {
            "type": "string",
            "description": "UTM content"
          }
        },
        "description": "One inbound submission (contact point) recorded on a lead"
      },
      "LeadValue": {
        "type": "object",
        "properties": {
          "tenantId": {
            "type": "string",
            "format": "uuid"
          },
          "agencyId": {
            "type": "string",
            "format": "uuid"
          },
          "createdDate": {
            "type": "string",
            "format": "date-time"
          },
          "createdBy": {
            "type": "string",
            "format": "uuid"
          },
          "creatorName": {
            "type": "string"
          },
          "lastModifiedDate": {
            "type": "string",
            "format": "date-time"
          },
          "lastModifiedBy": {
            "type": "string",
            "format": "uuid"
          },
          "version": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "type": "string",
            "description": "Lead ID (UUID)",
            "format": "uuid",
            "example": "1b2c3d4e-5f60-4718-8a9b-0c1d2e3f4a5b"
          },
          "number": {
            "type": "integer",
            "description": "Sequential lead number within the tenant",
            "format": "int32",
            "example": 10452
          },
          "externalId": {
            "type": "string",
            "description": "Caller-provided external identifier",
            "example": "LP-2026-004512"
          },
          "documentCount": {
            "type": "integer",
            "description": "Number of documents attached to the lead",
            "format": "int32",
            "example": 2
          },
          "ownerId": {
            "type": "string",
            "description": "ID (UUID) of the user who owns the lead",
            "format": "uuid",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
          },
          "ownerName": {
            "type": "string",
            "description": "Full name of the owner",
            "example": "דנה כהן"
          },
          "assigneeId": {
            "type": "string",
            "description": "ID (UUID) of the user assigned to the lead",
            "format": "uuid",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
          },
          "assigneeName": {
            "type": "string",
            "description": "Full name of the assignee",
            "example": "דנה כהן"
          },
          "assignedUserId": {
            "type": "string",
            "description": "Deprecated: same as `assigneeId`",
            "format": "uuid",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
            "deprecated": true
          },
          "assignedUserName": {
            "type": "string",
            "description": "Deprecated: same as `assigneeName`",
            "example": "דנה כהן",
            "deprecated": true
          },
          "assignedAt": {
            "type": "string",
            "description": "When the current assignee was assigned",
            "format": "date-time",
            "example": "2026-10-18T07:30:00Z"
          },
          "assignedBy": {
            "type": "string",
            "description": "ID (UUID) of the user who assigned the current assignee",
            "format": "uuid",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
          },
          "interestId": {
            "type": "string",
            "description": "ID (UUID) of the lead type (`typeId`; types were formerly called interests)",
            "format": "uuid",
            "example": "3f2b8c1e-7d4a-4e9b-9c2f-1a6d5e8b7c40"
          },
          "interestName": {
            "type": "string",
            "description": "Title of the lead type",
            "example": "ביטוח בריאות"
          },
          "statusId": {
            "type": "string",
            "description": "ID (UUID) of the lead status",
            "format": "uuid",
            "example": "8d1f4a6b-2c3e-4f5a-9b7c-6e0d1a2b3c4d"
          },
          "statusName": {
            "type": "string",
            "description": "Title of the lead status",
            "example": "בטיפול"
          },
          "statusSuccess": {
            "type": "boolean",
            "description": "Whether the current status is a success status",
            "example": false
          },
          "statusClosed": {
            "type": "boolean",
            "description": "Whether the current status closes the lead",
            "example": false
          },
          "statusDate": {
            "type": "string",
            "description": "When the lead entered its current status",
            "format": "date-time",
            "example": "2026-10-18T07:30:00Z"
          },
          "lastStatusUpdateBy": {
            "type": "string",
            "description": "ID (UUID) of the user who last changed the status",
            "format": "uuid",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
          },
          "priority": {
            "type": "integer",
            "description": "Lead priority (pin level)",
            "format": "int32",
            "example": 0
          },
          "leadDate": {
            "type": "string",
            "description": "Date-time the lead was received",
            "format": "date-time",
            "example": "2026-10-18T07:30:00Z"
          },
          "successDate": {
            "type": "string",
            "description": "Date the lead reached a success status",
            "format": "date"
          },
          "closedDate": {
            "type": "string",
            "description": "Date the lead was closed",
            "format": "date"
          },
          "closedReason": {
            "type": "string",
            "description": "Reason given when closing the lead"
          },
          "dueDate": {
            "type": "string",
            "description": "Deprecated: date part of `dueAt`",
            "format": "date",
            "example": "2026-10-20"
          },
          "dueTime": {
            "type": "string",
            "description": "Deprecated: time part of `dueAt` (Israel time)",
            "format": "time-local",
            "example": "12:00:00"
          },
          "dueAt": {
            "type": "string",
            "description": "Due date-time for handling the lead",
            "format": "date-time",
            "example": "2026-10-20T09:00:00Z"
          },
          "dueAtTimeSet": {
            "type": "boolean",
            "description": "Whether `dueAt` carries a meaningful time of day",
            "example": true
          },
          "overduePeriod": {
            "type": "string",
            "description": "How long the lead is overdue (ISO-8601 period), when past its due date"
          },
          "sourceId": {
            "type": "string",
            "description": "ID (UUID) of the lead source",
            "format": "uuid",
            "example": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
          },
          "existingLead": {
            "type": "boolean",
            "description": "Whether the lead was created for an already existing customer",
            "example": false
          },
          "customerId": {
            "type": "string",
            "description": "ID (UUID) of the lead's customer",
            "format": "uuid",
            "example": "2c4e6a8b-0d1f-4a3c-9e5b-7d9f1b3d5f70"
          },
          "customerManagerId": {
            "type": "string",
            "description": "ID (UUID) of the customer's (first) manager",
            "format": "uuid",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
          },
          "customerManagers": {
            "type": "array",
            "description": "IDs (UUID) of the customer's managers",
            "items": {
              "type": "string",
              "description": "IDs (UUID) of the customer's managers",
              "format": "uuid"
            }
          },
          "customerSensitive": {
            "type": "boolean",
            "description": "Whether the customer is sensitive (visible only to users with the sensitive-customers permission)",
            "example": false
          },
          "idType": {
            "type": "integer",
            "description": "Customer Identity Type:<br/>1 - ת.ז<br/>2 - דרכון<br/>3 - רישיון נהיגה<br/>4 - אחר<br/>5 - ח.פ<br/>6 - ח.צ",
            "format": "int32",
            "enum": [
              1,
              2,
              3,
              4,
              5,
              6
            ]
          },
          "idNumber": {
            "type": "string",
            "description": "Identity number of the customer",
            "example": "000000018"
          },
          "idCardIssueDate": {
            "type": "string",
            "description": "Israeli ID card issue date",
            "format": "date",
            "example": "2015-06-01"
          },
          "firstName": {
            "type": "string",
            "description": "Customer first name",
            "example": "נועה"
          },
          "lastName": {
            "type": "string",
            "description": "Customer last name",
            "example": "לוי"
          },
          "customerFullName": {
            "type": "string",
            "description": "Customer full name (same as `fullName`)",
            "example": "נועה לוי"
          },
          "fullName": {
            "type": "string",
            "description": "Customer full name (first then last)",
            "example": "נועה לוי"
          },
          "customerFullNameReverse": {
            "type": "string",
            "description": "Customer full name, last name first (same as `fullNameReverse`)",
            "example": "לוי נועה"
          },
          "fullNameReverse": {
            "type": "string",
            "description": "Customer full name, last name first",
            "example": "לוי נועה"
          },
          "cellNumber": {
            "type": "string",
            "description": "Customer cell phone (same as `phoneNumber1`)",
            "example": "0501234567"
          },
          "phoneNumber": {
            "type": "string",
            "description": "Customer additional phone (same as `phoneNumber2`)",
            "example": "036123456"
          },
          "phoneNumber1": {
            "type": "string",
            "description": "Customer cell phone",
            "example": "0501234567"
          },
          "phoneNumber2": {
            "type": "string",
            "description": "Customer additional phone",
            "example": "036123456"
          },
          "email": {
            "type": "string",
            "description": "Customer email",
            "example": "noa.levi@example.com"
          },
          "otherEmail": {
            "type": "string",
            "description": "Customer secondary email"
          },
          "customerStatusId": {
            "type": "string",
            "description": "ID (UUID) of the customer's status",
            "format": "uuid"
          },
          "mailingStatus": {
            "type": "integer",
            "description": "Mailing Status:<br/>1 - אושר דיוור<br/>2 - לא אושר דיוור<br/>3 - הוסר מדיוור<br/>4 - לא התבקש אישור",
            "format": "int32",
            "enum": [
              1,
              2,
              3,
              4
            ]
          },
          "customerDeath": {
            "type": "boolean",
            "description": "Whether the customer is deceased",
            "example": false
          },
          "swiftnessProxyInviteDate": {
            "type": "string",
            "description": "Date the pension clearing-house (Swiftness) power of attorney was sent for signature",
            "format": "date"
          },
          "swiftnessProxySignDate": {
            "type": "string",
            "description": "Date the pension clearing-house power of attorney was signed",
            "format": "date"
          },
          "swiftnessProxyExpired": {
            "type": "boolean",
            "description": "Whether the pension clearing-house power of attorney has expired"
          },
          "lastE9100DataDate": {
            "type": "string",
            "description": "Date of the latest pension clearing-house (E9100) data",
            "format": "date"
          },
          "hbProxyInviteDate": {
            "type": "string",
            "description": "Date the Har HaBituah power of attorney was sent for signature",
            "format": "date"
          },
          "hbProxySignDate": {
            "type": "string",
            "description": "Date the Har HaBituah power of attorney was signed",
            "format": "date"
          },
          "hbProxyExpired": {
            "type": "boolean",
            "description": "Whether the Har HaBituah power of attorney has expired"
          },
          "hbDataDate": {
            "type": "string",
            "description": "Date of the latest Har HaBituah (insurance) data",
            "format": "date"
          },
          "policiesProxyInviteDate": {
            "type": "string",
            "description": "Date the insurance-policies power of attorney was sent for signature",
            "format": "date"
          },
          "policiesProxySignDate": {
            "type": "string",
            "description": "Date the insurance-policies power of attorney was signed",
            "format": "date"
          },
          "street": {
            "type": "string",
            "description": "Street name",
            "example": "הרצל"
          },
          "streetNumber": {
            "type": "string",
            "description": "Street number",
            "example": "12"
          },
          "apartmentNumber": {
            "type": "string",
            "description": "Apartment number",
            "example": "5"
          },
          "postalBox": {
            "type": "integer",
            "description": "Postal box (P.O.B.) number",
            "format": "int32"
          },
          "city": {
            "type": "string",
            "description": "City",
            "example": "תל אביב"
          },
          "postalCode": {
            "type": "integer",
            "description": "Postal (ZIP) code",
            "format": "int32",
            "example": 6100001
          },
          "gender": {
            "type": "integer",
            "description": "Gender:<br/>1 - לא מוגדר<br/>2 - זכר<br/>3 - נקבה",
            "format": "int32",
            "enum": [
              1,
              2,
              3
            ]
          },
          "birthDate": {
            "type": "string",
            "description": "Customer birth date",
            "format": "date",
            "example": "1988-04-12"
          },
          "death": {
            "type": "boolean",
            "description": "Whether the customer is deceased",
            "example": false
          },
          "age": {
            "type": "integer",
            "description": "Age in years",
            "format": "int32",
            "example": 38
          },
          "maritalStatus": {
            "type": "integer",
            "description": "Marital Status:<br/>1 - רווק/ה<br/>2 - נשוי/אה<br/>3 - גרוש/ה<br/>4 - אלמן/ה<br/>5 - ידוע/ה בציבור",
            "format": "int32",
            "enum": [
              1,
              2,
              3,
              4,
              5
            ]
          },
          "profession": {
            "type": "string",
            "description": "Customer profession"
          },
          "monthlyIncome": {
            "type": "integer",
            "description": "Monthly income, in ILS",
            "format": "int32",
            "example": 15000
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes",
            "example": "מעוניינת בבדיקת ביטוח בריאות ופנסיה"
          },
          "unseen": {
            "type": "boolean",
            "description": "Whether the lead has not been viewed yet",
            "example": true
          },
          "employerName": {
            "type": "string",
            "description": "Employer name",
            "example": "אלקטרה"
          },
          "smoker": {
            "type": "boolean",
            "description": "Whether the person smokes",
            "example": false
          },
          "meetingDate": {
            "type": "string",
            "description": "Date of the scheduled meeting",
            "format": "date"
          },
          "meetingTime": {
            "type": "string",
            "description": "Time of the scheduled meeting",
            "format": "time-local"
          },
          "meetingFirstScheduledDate": {
            "type": "string",
            "description": "When a meeting was first scheduled for the lead",
            "format": "date-time"
          },
          "meetingFirstScheduledById": {
            "type": "string",
            "description": "ID (UUID) of the user who first scheduled a meeting",
            "format": "uuid"
          },
          "meetingFirstScheduledByName": {
            "type": "string",
            "description": "Name of the user who first scheduled a meeting"
          },
          "meetingCoordinatedDate": {
            "type": "string",
            "description": "When the meeting was coordinated",
            "format": "date-time"
          },
          "meetingCoordinatedById": {
            "type": "string",
            "description": "ID (UUID) of the user who coordinated the meeting",
            "format": "uuid"
          },
          "meetingCoordinatedByName": {
            "type": "string",
            "description": "Name of the user who coordinated the meeting"
          },
          "meetingLocation": {
            "type": "string",
            "description": "Meeting location"
          },
          "meetingCoordinatorId": {
            "type": "string",
            "description": "ID (UUID) of the meeting coordinator",
            "format": "uuid"
          },
          "meetingCoordinatorName": {
            "type": "string",
            "description": "Name of the meeting coordinator"
          },
          "tags": {
            "type": "array",
            "description": "IDs (UUID) of the lead's tags",
            "items": {
              "type": "string",
              "description": "IDs (UUID) of the lead's tags",
              "format": "uuid"
            }
          },
          "customFields": {
            "uniqueItems": true,
            "type": "array",
            "description": "Custom field values of the lead",
            "items": {
              "$ref": "#/components/schemas/SmartDialogFieldValue"
            }
          },
          "checkLists": {
            "uniqueItems": true,
            "type": "array",
            "description": "Checklists of the lead, in display order",
            "items": {
              "$ref": "#/components/schemas/SmartDialogCheckList"
            }
          },
          "nextItem": {
            "$ref": "#/components/schemas/SmartDialogCheckListItem"
          },
          "lastActivityDate": {
            "type": "string",
            "description": "When the last activity was logged on the lead",
            "format": "date-time"
          },
          "lastActivityBy": {
            "type": "string",
            "description": "ID (UUID) of the user who logged the last activity",
            "format": "uuid"
          },
          "sharable": {
            "type": "boolean",
            "description": "Whether the lead can be shared"
          },
          "appMailAddress": {
            "type": "string",
            "description": "Email address that files emails into this lead"
          },
          "lastExternalPartyId": {
            "type": "string",
            "description": "ID (UUID) of the external party the lead was last transferred to",
            "format": "uuid"
          },
          "lastTransferDate": {
            "type": "string",
            "description": "When the lead was last transferred to an external party",
            "format": "date-time"
          },
          "tromStats": {
            "$ref": "#/components/schemas/TromStats"
          },
          "utmId": {
            "type": "string",
            "description": "UTM ID",
            "example": "utm-4512"
          },
          "utmSource": {
            "type": "string",
            "description": "UTM source",
            "example": "facebook"
          },
          "utmMedium": {
            "type": "string",
            "description": "UTM medium",
            "example": "cpc"
          },
          "utmCampaign": {
            "type": "string",
            "description": "UTM campaign",
            "example": "health-q4-2026"
          },
          "utmTerm": {
            "type": "string",
            "description": "UTM term"
          },
          "utmContent": {
            "type": "string",
            "description": "UTM content"
          },
          "contactPointCount": {
            "type": "integer",
            "description": "Number of contact points (inbound submissions) recorded on the lead",
            "format": "int32",
            "example": 1
          },
          "lastContactPointDate": {
            "type": "string",
            "description": "Date-time of the latest contact point",
            "format": "date-time",
            "example": "2026-10-18T07:30:00Z"
          },
          "contactPoints": {
            "type": "array",
            "description": "Contact-point history, oldest first (returned by single-lead operations; absent in search results)",
            "items": {
              "$ref": "#/components/schemas/ContactPointValue"
            }
          },
          "typeId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "description": "A lead: a sales opportunity linked to a customer, with the customer's details"
      },
      "SmartDialogCheckList": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "name": {
            "type": "string"
          },
          "position": {
            "type": "integer",
            "format": "int32"
          },
          "items": {
            "uniqueItems": true,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SmartDialogCheckListItem"
            }
          },
          "done": {
            "type": "boolean"
          },
          "doneItems": {
            "type": "integer",
            "format": "int64"
          },
          "todoItems": {
            "type": "integer",
            "format": "int64"
          }
        },
        "description": "Checklists of the lead, in display order"
      },
      "SmartDialogCheckListItem": {
        "required": [
          "description"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "checkListId": {
            "type": "string",
            "format": "uuid"
          },
          "position": {
            "type": "integer",
            "format": "int32"
          },
          "description": {
            "minLength": 1,
            "type": "string"
          },
          "done": {
            "type": "boolean"
          }
        },
        "description": "The next not-done checklist item"
      },
      "SmartDialogFieldValue": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string",
            "format": "uuid"
          },
          "type": {
            "type": "integer",
            "format": "int32"
          },
          "value": {
            "type": "object"
          }
        },
        "description": "Custom field values of the lead"
      },
      "TromStats": {
        "type": "object",
        "properties": {
          "validityMonth": {
            "type": "string"
          },
          "calculatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "tzvira": {
            "type": "number"
          },
          "tzviraHon": {
            "type": "number"
          },
          "tzviraKitzba": {
            "type": "number"
          },
          "tzviraPitsuim": {
            "type": "number"
          },
          "tzviraPensia": {
            "type": "number"
          },
          "tzviraPensiaVatika": {
            "type": "number"
          },
          "tzviraMenaalim": {
            "type": "number"
          },
          "tzviraHishtalmut": {
            "type": "number"
          },
          "tzviraGemelLeashkaa": {
            "type": "number"
          },
          "tzviraGemel": {
            "type": "number"
          },
          "tzviraGemel190": {
            "type": "number"
          },
          "tzviraHisahonFinansi": {
            "type": "number"
          },
          "tzviraAlternativiim": {
            "type": "number"
          },
          "tzviraNihulTikim": {
            "type": "number"
          },
          "tzviraNezila": {
            "type": "number"
          },
          "hafkadot": {
            "type": "number"
          },
          "hafkadotHishtalmut": {
            "type": "number"
          },
          "hafkadotGemelLeashkaa": {
            "type": "number"
          },
          "dmeiNihulHazuim": {
            "type": "number"
          },
          "revahimMithilatShana": {
            "type": "number",
            "deprecated": true
          },
          "avgNetReturnPercentStartYear": {
            "type": "number"
          },
          "kitzbaHazuyaKolelHafkadot": {
            "type": "number"
          },
          "kitzbaHazuyaLeloHafkadot": {
            "type": "number"
          },
          "kayamHalvaot": {
            "type": "boolean"
          },
          "kayamIkulimShiabudim": {
            "type": "boolean"
          },
          "premia": {
            "type": "number"
          },
          "kayamHaim": {
            "type": "boolean"
          },
          "premiaHaim": {
            "type": "number"
          },
          "kayamHaimMashkanta": {
            "type": "boolean"
          },
          "premiaHaimMashkanta": {
            "type": "number"
          },
          "kayamBriut": {
            "type": "boolean"
          },
          "premiaBriut": {
            "type": "number"
          },
          "kayamMahalotKashot": {
            "type": "boolean"
          },
          "premiaMahalotKashot": {
            "type": "number"
          },
          "kayamTeunotIshiot": {
            "type": "boolean"
          },
          "premiaTeunotIshiot": {
            "type": "number"
          },
          "kayamSiudi": {
            "type": "boolean"
          },
          "premiaSiudi": {
            "type": "number"
          },
          "kayamSiudiKupah": {
            "type": "boolean"
          },
          "kayamAka": {
            "type": "boolean"
          },
          "kayamNehutMiteuna": {
            "type": "boolean"
          },
          "kitzbaNehut": {
            "type": "number"
          },
          "kitzbaLealman": {
            "type": "number"
          },
          "kitzbaLeyetom": {
            "type": "number"
          },
          "kisuiHadPaamiSheerim": {
            "type": "number"
          }
        },
        "description": "Statistics of the lead's pre-meeting (TROM) process"
      },
      "CreateLeadRequest": {
        "required": [
          "typeId"
        ],
        "type": "object",
        "properties": {
          "agencyId": {
            "type": "string",
            "description": "ID (UUID) of the agency of the lead, used only when no customer is resolved (defaults to the caller's agency); otherwise the lead takes the customer's agency",
            "format": "uuid",
            "example": "5d4c3b2a-1f0e-4d9c-8b7a-6f5e4d3c2b1a"
          },
          "externalId": {
            "type": "string",
            "description": "Your own identifier for the lead (e.g. from a landing page or CRM); must be unique within the tenant",
            "example": "LP-2026-004512"
          },
          "reuseOpenLead": {
            "type": "boolean",
            "description": "When true, append this submission as a contact point to the customer's newest open lead of the same type instead of creating a new lead. A new lead is still created if the customer has no open lead of that type. Defaults to false.",
            "example": false
          },
          "templateId": {
            "type": "string",
            "description": "ID (UUID) of a lead template to apply (notes, checklists, assignee); it must belong to the lead's type",
            "example": "6f5e4d3c-2b1a-4098-8f7e-6d5c4b3a2910"
          },
          "typeId": {
            "type": "string",
            "description": "ID (UUID) of an active lead type (`GET /leads/types`). Also accepted as `interestId`.",
            "example": "3f2b8c1e-7d4a-4e9b-9c2f-1a6d5e8b7c40"
          },
          "sourceId": {
            "type": "string",
            "description": "ID (UUID) of the lead source (customer source)",
            "example": "9a8b7c6d-5e4f-4a3b-8c2d-1e0f9a8b7c6d"
          },
          "statusId": {
            "type": "string",
            "description": "ID (UUID) of an active lead status (`GET /leads/statuses`); defaults to the tenant's initial status",
            "example": "8d1f4a6b-2c3e-4f5a-9b7c-6e0d1a2b3c4d"
          },
          "ownerId": {
            "type": "string",
            "description": "ID (UUID) of the active user who owns the lead; also the manager of a newly created customer when `managerId` is absent",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
          },
          "assignedUserId": {
            "type": "string",
            "description": "ID (UUID) of the active user assigned to handle the lead; ignored when the template defines an assignee",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f"
          },
          "leadDate": {
            "type": "string",
            "description": "Date-time the lead was received (ISO-8601)",
            "example": "2026-10-18T07:30:00Z"
          },
          "dueAt": {
            "type": "string",
            "description": "Due date-time for handling the lead (ISO-8601); requires `dueAtTimeSet`",
            "example": "2026-10-20T09:00:00Z"
          },
          "dueAtTimeSet": {
            "type": "boolean",
            "description": "Whether `dueAt` carries a meaningful time of day (false: only the date counts); required with `dueAt`",
            "example": true
          },
          "dueDate": {
            "type": "string",
            "description": "Deprecated: use `dueAt`. Due date, used only when `dueAt` is absent.",
            "format": "date",
            "example": "2026-10-20",
            "deprecated": true
          },
          "dueTime": {
            "type": "string",
            "description": "Deprecated: use `dueAt`. Due time, used with `dueDate`.",
            "format": "time-local",
            "example": "09:00:00",
            "deprecated": true
          },
          "notes": {
            "type": "string",
            "description": "Free-text notes; replaced by the template's notes when the template has some",
            "example": "מעוניינת בבדיקת ביטוח בריאות ופנסיה"
          },
          "funnel": {
            "type": "string",
            "description": "Funnel (free text) recorded on the contact point for this submission",
            "example": "Facebook - summer campaign"
          },
          "customerId": {
            "type": "string",
            "description": "ID (UUID) of an existing customer the caller can access. Optional: when absent the customer is matched by `idNumber`, else by `phoneNumber1`/`email` (at least one is then required), or created.",
            "example": "2c4e6a8b-0d1f-4a3c-9e5b-7d9f1b3d5f70"
          },
          "managerId": {
            "type": "string",
            "description": "Deprecated. ID (UUID) of the user managing a newly created customer; defaults to `ownerId` (one of them is required when a customer must be created)",
            "format": "uuid",
            "example": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f",
            "deprecated": true
          },
          "firstName": {
            "type": "string",
            "description": "First name (used for a newly created customer, and to pick the closest matching customer)",
            "example": "נועה"
          },
          "lastName": {
            "type": "string",
            "description": "Last name (used for a newly created customer, and to pick the closest matching customer)",
            "example": "לוי"
          },
          "idType": {
            "type": "integer",
            "description": "Customer Identity Type:<br/>1 - ת.ז<br/>2 - דרכון<br/>3 - רישיון נהיגה<br/>4 - אחר<br/>5 - ח.פ<br/>6 - ח.צ",
            "format": "int32",
            "example": 1,
            "enum": [
              1,
              2,
              3,
              4,
              5,
              6
            ]
          },
          "idNumber": {
            "type": "string",
            "description": "Identity number; used to find an existing customer when `customerId` is absent",
            "example": "000000018"
          },
          "idCardIssueDate": {
            "type": "string",
            "description": "Israeli ID card issue date (ISO-8601 date)",
            "example": "2015-06-01"
          },
          "email": {
            "type": "string",
            "description": "Email address; must be valid. Used to find an existing customer when neither `customerId` nor `idNumber` is given.",
            "example": "noa.levi@example.com"
          },
          "phoneNumber1": {
            "type": "string",
            "description": "Cell phone number; must be a valid phone number. Used to find an existing customer when neither `customerId` nor `idNumber` is given.",
            "example": "0501234567"
          },
          "phoneNumber2": {
            "type": "string",
            "description": "Additional phone number; must be a valid phone number",
            "example": "036123456"
          },
          "street": {
            "type": "string",
            "description": "Street name",
            "example": "הרצל"
          },
          "streetNumber": {
            "type": "string",
            "description": "Street number",
            "example": "123"
          },
          "apartmentNumber": {
            "type": "string",
            "description": "Apartment number",
            "example": "5"
          },
          "mailBox": {
            "type": "integer",
            "description": "Mail box number",
            "format": "int32",
            "example": 1234
          },
          "zipCode": {
            "type": "integer",
            "description": "Postal (ZIP) code",
            "format": "int32",
            "example": 6100001
          },
          "city": {
            "type": "string",
            "description": "City",
            "example": "תל אביב"
          },
          "gender": {
            "type": "integer",
            "description": "Gender:<br/>1 - לא מוגדר<br/>2 - זכר<br/>3 - נקבה",
            "format": "int32",
            "example": 3,
            "enum": [
              1,
              2,
              3
            ]
          },
          "birthDate": {
            "type": "string",
            "description": "Birth date (ISO-8601 date)",
            "example": "1988-04-12"
          },
          "birthDateYearOnly": {
            "type": "boolean",
            "description": "Only the birth year is known; the new customer's birthDate is then stored as Jan 1 of that year",
            "example": false
          },
          "age": {
            "type": "integer",
            "description": "Age in years",
            "format": "int32",
            "example": 38
          },
          "maritalStatus": {
            "type": "integer",
            "description": "Marital Status:<br/>1 - רווק/ה<br/>2 - נשוי/אה<br/>3 - גרוש/ה<br/>4 - אלמן/ה<br/>5 - ידוע/ה בציבור",
            "format": "int32",
            "example": 2,
            "enum": [
              1,
              2,
              3,
              4,
              5
            ]
          },
          "childCount": {
            "type": "integer",
            "description": "Number of children",
            "format": "int32",
            "example": 2
          },
          "employerName": {
            "type": "string",
            "description": "Employer name",
            "example": "אלקטרה"
          },
          "smoker": {
            "type": "boolean",
            "description": "Whether the person smokes",
            "example": false
          },
          "monthlyIncome": {
            "type": "integer",
            "description": "Monthly income, in ILS",
            "format": "int32",
            "example": 15000
          },
          "employmentStatus": {
            "type": "integer",
            "description": "Employment Status:<br/>1 - שכיר/ה<br/>2 - עצמאי/ת<br/>3 - שכיר/ה ועצמאי/ת<br/>4 - שכיר/ה בעל/ת שליטה<br/>5 - לא מועסק/ת<br/>6 - שכיר/ה בעל/ת שליטה ועצמאי/ת<br/>7 - פנסיונר/ית",
            "format": "int32",
            "example": 1,
            "enum": [
              1,
              2,
              3,
              4,
              5,
              6,
              7
            ]
          },
          "mailingStatus": {
            "type": "integer",
            "description": "Mailing Status:<br/>1 - אושר דיוור<br/>2 - לא אושר דיוור<br/>3 - הוסר מדיוור<br/>4 - לא התבקש אישור",
            "format": "int32",
            "example": 1,
            "enum": [
              1,
              2,
              3,
              4
            ]
          },
          "forceCreation": {
            "type": "boolean",
            "description": "When a new customer must be created and customer-service reports conflicting existing customers (error 40204), set to true to create it anyway",
            "example": false
          },
          "customFields": {
            "type": "array",
            "description": "Custom field values to set; each `fieldId` must be a lead field of the tenant (`GET /leads/customfields`), and the caller must be allowed to write it",
            "items": {
              "$ref": "#/components/schemas/CustomFieldEntry"
            }
          },
          "utmId": {
            "maxLength": 511,
            "minLength": 0,
            "type": "string",
            "description": "UTM ID of the campaign link (also recorded on the contact point)",
            "example": "utm-4512"
          },
          "utmSource": {
            "type": "string",
            "description": "UTM source",
            "example": "google"
          },
          "utmMedium": {
            "type": "string",
            "description": "UTM medium",
            "example": "cpc"
          },
          "utmCampaign": {
            "type": "string",
            "description": "UTM campaign",
            "example": "health-q4-2026"
          },
          "utmTerm": {
            "type": "string",
            "description": "UTM term",
            "example": "insurance"
          },
          "utmContent": {
            "type": "string",
            "description": "UTM content",
            "example": "banner"
          }
        },
        "description": "Request to create a new lead"
      },
      "CustomFieldEntry": {
        "type": "object",
        "properties": {
          "fieldId": {
            "type": "string",
            "description": "ID (UUID) of the lead field",
            "format": "uuid",
            "example": "7e6d5c4b-3a29-4180-9f7e-6d5c4b3a2918"
          },
          "fieldVal": {
            "type": "object",
            "description": "Value of the field, typed according to the field (string, number, boolean or date string); null values are skipped",
            "example": "ביטוח בריאות"
          }
        },
        "description": "Custom field entry"
      }
    },
    "securitySchemes": {
      "oauth2": {
        "type": "oauth2",
        "description": "OAuth2 client credentials. Tokens are issued by the Surense authorization server and presented as `Authorization: Bearer <token>`.",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://api.surense.com/oauth/token",
            "scopes": {
              "leads:read": "Read leads, lead types, statuses, templates and checklist templates",
              "leads:create": "Create leads, including bulk creation and duplication",
              "leads:update": "Update leads",
              "leads:delete": "Delete leads",
              "leads:checklists:manage": "Create, edit, reorder and delete lead checklists and their items",
              "global:metadata:manage": "Manage tenant settings such as lead types, statuses and templates",
              "global:import": "Import data from files",
              "global:export": "Export data to files",
              "global:dashboards:read": "Read dashboards"
            }
          }
        }
      }
    }
  }
}
```