Leads
Leads are potential patients captured before they book - a website form submission, a bot conversation, a Facebook Lead Ad. External channels push leads in with the leads:write scope, and the clinic qualifies and assigns them inside SmileCloud. There is no leads:read; to follow new leads as they arrive, subscribe to the lead.created webhook. The one thing the API can do to an existing lead is convert it to a patient.
#Create a lead
POST /v1/leads — scope: leads:write
| Field | Type | Description |
|---|---|---|
first_name | string, required | Max 120. |
last_name | string | Max 120. |
phone | string | Required unless email is given. |
email | string | Required unless phone is given. |
source | string, required | facebook, website, phone, walk_in, referral, bot, or other. |
note | string | Free text (the form message, a bot conversation summary) — lands as a note on the lead's activity timeline. Max 2000. |
external_id | string | Idempotency key, unique per clinic — e.g. the Meta leadgen id or your form submission id. Strongly recommended. |
attribution | object | Marketing attribution — see below. |
meta | object | Free-form payload stored on the lead (form answers, custom fields). Max 50 top-level keys. |
curl -X POST https://api.smile-app.co.il/v1/leads \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"first_name": "Dana",
"last_name": "Levi",
"phone": "0501234567",
"source": "website",
"note": "Interested in teeth whitening",
"external_id": "form-8817",
"attribution": {
"utm_source": "google",
"utm_campaign": "summer-whitening",
"gclid": "Cj0KCQjw..."
}
}'
{
"data": {
"id": "112",
"external_id": "form-8817",
"first_name": "Dana",
"last_name": "Levi",
"phone": "0501234567",
"email": null,
"source": "website",
"status": "new",
"attribution": { "utm_source": "google", "utm_campaign": "summer-whitening", "gclid": "Cj0KCQjw..." },
"created_at": "2026-08-02T14:05:00+03:00"
}
}
201 means the lead was created. 200 means it already existed - either the same external_id was replayed, or the phone/email matched an open lead (not converted or lost); the submission is then preserved on that lead's activity timeline instead of creating a duplicate, and the matched lead is returned (its status shows where it already got to).
#Convert a lead to a patient
POST /v1/leads/{id}/convert — scopes: leads:write and patients:write
Turns a lead into a patient, the same way the clinic does from the leads screen: the patient is created, the lead is marked converted and linked to it, and the lead.converted webhook fires. {id} is the lead id returned by Create a lead and carried by the lead.* webhooks.
It needs both scopes because it files a patient record. A key that only captures leads can't convert them.
curl -X POST https://api.smile-app.co.il/v1/leads/4102/convert \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{ "id_number": "123456782", "birth_date": "1990-04-12" }'
The body is optional, and takes one of three forms:
| Body | Result |
|---|---|
| (empty) | A new patient is created from the lead's name, phone and email. |
Patient fields: first_name, last_name, phone, email, id_number, gender (male / female), birth_date (YYYY-MM-DD) | A new patient is created; each field sent overrides the lead's. |
patient_id alone | No patient is created. The lead is linked to this existing patient. |
{
"data": {
"id": "4102",
"status": "converted",
"patient": { "id": "8842" },
"converted_at": "2026-07-01T09:00:00+03:00"
}
}
The response is the lead's id and status and the patient it became, not the lead's own details. patient carries only the id, unless the key also holds patients:read, which adds first_name, last_name and phone. Use the patient id to book an appointment or record a payment.
| Status | Meaning |
|---|---|
201 | Converted by this request. |
200 | The lead already had its patient, and that patient is returned unchanged, so a retry is safe. This holds even if the clinic has since moved the lead to another status. |
400 | The body is invalid, patient_id doesn't exist or isn't a valid id, or patient_id was combined with patient fields. |
404 | No lead with this id. |
409 | A patient with this phone or ID number already exists, so no duplicate was created. Find that patient and retry with patient_id. Also returned when the lead is already converted to a different patient than the patient_id sent, or when the patient it was converted to has since been deleted. |
#Attribution
attribution is a flat key→value map recording where the lead came from. It is deliberately generic - any key is accepted (values max 512 chars, max 30 keys), so every channel a clinic pipes leads through can attach whatever it knows. Conventional keys:
| Key | Meaning |
|---|---|
utm_source, utm_medium, utm_campaign, utm_term, utm_content | Standard UTM parameters. |
gclid | Google Ads click id. |
fbclid / ctwa_clid | Meta click id / click-to-WhatsApp click id. |
ttclid | TikTok click id. |
referrer_url, landing_page_url | Where the visitor came from and landed. |
campaign_name | Human-readable campaign label. |
Send it if you have it
Attribution can't be reconstructed later. Pass click ids and UTM tags at capture time even if you don't use them yet - they make conversion reporting and offline-conversion feedback possible down the road.
#Ready-made Make scenarios
Two importable Make blueprints already carry the field mapping below. In Make, create a scenario, open the ⋯ menu and choose Import Blueprint, then connect the trigger and paste the clinic's leads:write key into the Authorization header of the Send to SmileCloud module.
| Blueprint | Trigger | Download |
|---|---|---|
| Facebook Lead Ads → SmileCloud | Facebook Lead Ads → New Lead + Get Lead Details; splits full_name, maps phone_number/email, sends the leadgen id as external_id and campaign/ad/form names as attribution | smilecloud-facebook-lead-ads.json |
| Website form (webhook) → SmileCloud | Webhooks → Custom webhook for Elementor, WordPress, Wix, landing pages and Google Ads lead forms; expects first_name, last_name, phone, email, message, submission_id and UTM fields | smilecloud-website-form-webhook.json |
The Hebrew walkthrough for clinics and their agencies lives on the Smile Academy.
#Connecting channels with Zapier
The recommended way to connect Facebook Lead Ads, Google Ads lead forms, landing-page builders and similar channels is Zapier (or any equivalent automation platform):
- Create a Zap with the channel as the trigger (e.g. Facebook Lead Ads → New Lead).
- Add a Webhooks by Zapier → POST action to
https://api.smile-app.co.il/v1/leads. - Set the
Authorization: Bearer sk_live_...header with an API key that carries only theleads:writescope. - Map the form fields to
first_name,phone,email, setsourceaccordingly, and map the platform's lead/submission id toexternal_idso retried deliveries never create duplicates. - Map ad/campaign fields into
attribution(e.g.campaign_name,fbclid).
Least privilege
Mint a dedicated key holding only leads:write for each automation. A leaked form-integration key then can't read a single patient record, or create one: converting a lead needs patients:write as well.