API Documentation
Integrate external tools, capture leads from your website, and automate workflows with the Smarfle CRM API.
API Key Auth
Generate API keys in your organization settings. Include the key in theX-API-Keyheader.
Webhook Events
Receive real-time notifications when events happen in your account. Configure endpoints in settings.
Rate Limited
100 requests per minute per API key. All requests are logged and billed at $0.003/call on Professional+ plans.
REST Endpoints
/api/webhook/leadsProfessional+Create a new lead/client from an external source (website form, Zapier, etc.)
Auth: API Key
/api/webhook/leadsProfessional+Verify your API key and check endpoint availability
Auth: API Key
Example: Create a lead (no SMS)
curl -X POST https://www.smarfle.com/api/webhook/leads \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{
"first_name": "John",
"last_name": "Smith",
"email": "john@example.com",
"phone": "555-0123",
"notes": "Submitted via website contact form"
}'⚠️ SMS Consent (A2P 10DLC compliance)
Lead phones imported via this endpoint default to sms_consent: false. The Smarfle outbound-SMS engine will refuse to text any client whose sms_consent is not true, even if the org owner triggers a campaign or workflow against them. This protects every Smarfle business from TCPA + carrier-policy violations.
To mark the lead as SMS-opted-in, you must:
- Have collected explicit, unchecked-by-default consent on your form (and retain proof — Twilio may request it during a campaign audit)
- Send
sms_consent: truein the request body - Include a
sms_consent_sourcedescribing where consent was collected (e.g."ACME website /quote form, unchecked checkbox, IP 1.2.3.4")
Example: Create a lead WITH SMS consent
curl -X POST https://www.smarfle.com/api/webhook/leads \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{
"first_name": "John",
"last_name": "Smith",
"email": "john@example.com",
"phone": "555-0123",
"sms_consent": true,
"sms_consent_source": "https://acme.com/quote — checkbox unchecked by default, IP captured"
}'Webhook Events
Configure a webhook URL in your organization settings to receive POST requests when these events occur.
| Event | Description |
|---|---|
work_order.created | A new work order is created |
work_order.status_changed | A work order status changes (scheduled, in_progress, completed, invoiced) |
invoice.sent | An invoice is sent to a client |
invoice.paid | An invoice payment is recorded |
client.created | A new client is added |
Getting Started
Generate an API key
Go to Organization Settings and click "Generate API Key". Copy and store it securely.
Test the endpoint
Send a GET request to /api/webhook/leads with your API key to verify connectivity.
Send your first lead
POST a JSON payload with name, email, phone, and optional service/notes fields.
Set up webhooks (optional)
Add your webhook URL in settings to receive event notifications in real time.
Ready to integrate?
API access is available on Professional and Business plans. Start your free trial to get your API key.