SmileCloudDocs

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

FieldTypeDescription
first_namestring, requiredMax 120.
last_namestringMax 120.
phonestringRequired unless email is given.
emailstringRequired unless phone is given.
sourcestring, requiredfacebook, website, phone, walk_in, referral, bot, or other.
notestringFree text (the form message, a bot conversation summary) — lands as a note on the lead's activity timeline. Max 2000.
external_idstringIdempotency key, unique per clinic — e.g. the Meta leadgen id or your form submission id. Strongly recommended.
attributionobjectMarketing attribution — see below.
metaobjectFree-form payload stored on the lead (form answers, custom fields). Max 50 top-level keys.
bash
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..."
    }
  }'
json
{
  "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.

bash
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:

BodyResult
(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 aloneNo patient is created. The lead is linked to this existing patient.
json
{
  "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.

StatusMeaning
201Converted by this request.
200The 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.
400The body is invalid, patient_id doesn't exist or isn't a valid id, or patient_id was combined with patient fields.
404No lead with this id.
409A 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:

KeyMeaning
utm_source, utm_medium, utm_campaign, utm_term, utm_contentStandard UTM parameters.
gclidGoogle Ads click id.
fbclid / ctwa_clidMeta click id / click-to-WhatsApp click id.
ttclidTikTok click id.
referrer_url, landing_page_urlWhere the visitor came from and landed.
campaign_nameHuman-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.

BlueprintTriggerDownload
Facebook Lead Ads → SmileCloudFacebook 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 attributionsmilecloud-facebook-lead-ads.json
Website form (webhook) → SmileCloudWebhooks → 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 fieldssmilecloud-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):

  1. Create a Zap with the channel as the trigger (e.g. Facebook Lead Ads → New Lead).
  2. Add a Webhooks by Zapier → POST action to https://api.smile-app.co.il/v1/leads.
  3. Set the Authorization: Bearer sk_live_... header with an API key that carries only the leads:write scope.
  4. Map the form fields to first_name, phone, email, set source accordingly, and map the platform's lead/submission id to external_id so retried deliveries never create duplicates.
  5. 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.