arrow-right-to-arcexport_lead

Each row represents one lead with all contact and lifecycle data pre-joined into a flat table.

Example Query

-- Incremental load: fetch new, updated, and deleted records since last sync
SELECT *
FROM export_lead
WHERE updated_at >= '2024-01-15T00:00:00Z'
   OR deleted_at >= '2024-01-15T00:00:00Z';

Fields

Lead Core

Field
Type
Description

id

string

Lead ID

source

string

Top-level lead source: Web, Phone, Fax, InPerson, EMR, Unknown

utm_source

string

UTM source parameter

utm_medium

string

UTM medium parameter

utm_campaign

string

UTM campaign parameter

utm_term

string

UTM term parameter

utm_content

string

UTM content parameter

origin

string

Lead origin: External, Manual, LeadPage

lead_type

string

Lead type: MQL (Marketing Qualified), SQL (Sales Qualified)

engagement_type

string

NewPatient or ReturningPatient

is_using_insurance

boolean

Whether the lead is using insurance

Lead Task Lifecycle

Field
Type
Description

priority

string

Lead priority level: Urgent, High, Medium, Low

task_status_name

string

Current lead task status name

service_name

string

Service display name

marketing_source_name

string

Marketing source display name

closed_lost_reason_name

string

Closed-lost reason display name

closed_lost_note

string

Free-text note on closed-lost

Timestamps

Field
Type
Description

created_at

time

When the lead was created

updated_at

time

When the lead was last updated

deleted_at

time

When the lead was soft-deleted

opened_at

time

When the lead task was opened

started_at

time

When the lead task was started

completed_at

time

When the lead task was completed (closed won)

closed_at

time

When the lead task was closed (closed lost)

due_date

time

Lead task due date

next_follow_up_date

time

Next scheduled follow-up date

first_encounter_date

time

Date of the patient's first encounter

transferred_at

time

When the lead was transferred

Contact Info

Field
Type
Description

first_name

string

Contact first name

last_name

string

Contact last name

full_name

string

Contact full name

email

string

Primary email

personal_email

string

Personal email

work_email

string

Work email

phone_number

string

Primary phone number

cell_phone

string

Cell phone number

home_phone

string

Home phone number

work_phone

string

Work phone number

contact_preference

string

Preferred contact method

sms_consent

boolean

Whether SMS consent was given

emergency_contact_name

string

Emergency contact name

emergency_contact_phone

string

Emergency contact phone

emergency_contact_relation

string

Emergency contact relationship

Demographics

Field
Type
Description

gender

string

Gender

gender_identity

string

Gender identity

preferred_pronouns

string

Preferred pronouns

date_of_birth

string

Date of birth

marital_status

string

Marital status

occupation

string

Occupation/job title

employer

string

Employer name

Address

Field
Type
Description

address_line

string

Street address

address_city

string

City

address_state

string

State

address_postal_code

string

Postal code

address_country

string

Country

Referring Provider

Field
Type
Description

referring_provider_first_name

string

Referring provider first name

referring_provider_last_name

string

Referring provider last name

referring_provider_display_name

string

Referring provider display name

referring_provider_npi

string

Referring provider NPI

referring_provider_external_id

string

Referring provider external EMR ID

Timestamps (Billing)

Field
Type
Description

acknowledged_billing_at

time

When billing was acknowledged

Internal IDs

Field
Type
Description

provider_organization_id

string

Organization ID

location_id

string

Location ID

payer_id

string

Payer ID

benefit_id

string

Benefit ID

patient_id

string

Matched patient ID

owner_id

string

Assigned owner (user) ID

task_status_id

string

Task status ID

service_id

string

Service ID

patient_case_id

string

Patient case ID

duplicate_of_id

string

Lead this is a duplicate of

closed_lost_reason_id

string

Closed-lost reason ID

marketing_source_id

string

Marketing source ID

referral_id

string

Referral ID

referring_provider_id

string

Referring provider ID

acknowledged_billing_by_id

string

User who acknowledged billing

External EMR IDs

Field
Type
Description

external_patient_id

string

Patient ID in external EMR

external_appointment_id

string

Appointment ID in external EMR

external_patient_case_id

string

Patient case ID in external EMR

external_location_id

string

Location ID in external EMR

external_payer_id

string

Payer ID in external EMR

referring_provider_external_id

string

Referring provider ID in external EMR

Last updated