Developer Resources

API Support & Setup Guide

Everything you need to connect your business to LS MarketFlow — capture leads, sync daily metrics, and generate trend intelligence, all from your own tools.

Overview

The LS MarketFlow API lets your business push data into the platform and pull insights out — no login required for server-to-server calls. There are four core capabilities:

Capture Leads

Submit leads from your website or CRM into your pipeline.

Trend Intelligence

Send customer interaction text and get AI-analyzed insights back.

Retrieve Reports

Pull your saved trend reports into dashboards or spreadsheets.

Sync Metrics

Push daily call and booking metrics automatically via webhook.

New here? Your API key is generated when your business account is created. If you don't have one yet, contact your account manager or request access.

Authentication

Most endpoints identify your business using an API key. Include it in every request as either an HTTP header or a query parameter:

Option 1 — Header (recommended)

X-Business-API-Key: YOUR_API_KEY

Option 2 — Query parameter

https://lsmarketflow.com/functions/trendReportsApi?api_key=YOUR_API_KEY

Option 3 — Business slug (for embeds)

For embedded widgets where you don't want to expose the API key, use your public slug instead:

?biz=YOUR_BUSINESS_SLUG

Keep your API key secret

Treat it like a password. Never commit it to public repos or expose it in client-side code that runs in a browser. Use the slug method for public embeds.

Lead Capture API

Submit a new lead directly from your website form, CRM, or automation tool. The lead is saved to your pipeline and you're notified by email automatically.

POSThttps://lsmarketflow.com/functions/captureLead

Request

curl -X POST https://lsmarketflow.com/functions/captureLead \
  -H "X-Business-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contact_name": "Jane Smith",
    "email": "jane@acme.com",
    "phone": "404-555-0199",
    "business_name": "Acme Auto Repair",
    "industry": "auto_repair",
    "biggest_challenge": "Missing calls after hours",
    "interested_services": ["missed-call-capture", "review-generation"]
  }'

Response

{
  "ok": true,
  "lead_id": "6a872f6b4ddbd92fc26675f4"
}

Required fields

  • contact_name — customer's name
  • email — customer's email
  • All other fields (phone, industry, biggest_challenge, interested_services, preferred_demo_time, notes) are optional.

Prefer an embed? No code needed

Drop this iframe onto any page to capture leads with a pre-built form:

<iframe
  src="https://lsmarketflow.com/embed/lead-capture?biz=YOUR_BUSINESS_SLUG"
  width="100%"
  height="520"
  frameborder="0"
  style="border-radius:12px; border:1px solid #e2e8f0;">
</iframe>

Trend Reports API

Retrieve your saved trend reports (most recent 50) to display in your own dashboard, export to a spreadsheet, or feed into another system.

GEThttps://lsmarketflow.com/functions/trendReportsApi

Request

curl -H "X-Business-API-Key: YOUR_API_KEY" \
  https://lsmarketflow.com/functions/trendReportsApi

Response

{
  "success": true,
  "reports": [
    { "id": "...", "week_label": "Week of Aug 18, 2026", "status": "complete", ... },
    { "id": "...", "week_label": "Week of Aug 11, 2026", "status": "complete", ... }
  ]
}

Daily Metrics Webhook

Push your daily call and booking metrics into the platform so your weekly reports and revenue-leak analysis stay current. This endpoint uses a separate webhook secret (not your API key) — set it up under Insights → Data Sources.

POSThttps://lsmarketflow.com/functions/webhookIngest

Request

curl -X POST https://lsmarketflow.com/functions/webhookIngest \
  -H "Content-Type: application/json" \
  -d '{
    "secret": "YOUR_WEBHOOK_SECRET",
    "metric_date": "2026-08-20",
    "total_calls": 42,
    "missed_calls": 7,
    "after_hours_calls": 11,
    "appointment_requests": 15,
    "booked_appointments": 12,
    "new_customers": 5,
    "repeat_customers": 8
  }'

Fields

  • secret * — your webhook secret from Data Sources
  • metric_date * — the date for these metrics (YYYY-MM-DD)
  • total_calls, missed_calls, after_hours_calls — call volume metrics
  • appointment_requests, booked_appointments — booking metrics
  • new_customers, repeat_customers — customer metrics

Errors & Status Codes

StatusMeaning
200Success — request completed normally
400Bad Request — missing or invalid required field
401Unauthorized — missing, invalid, or inactive API key / webhook secret
403Forbidden — authenticated but not allowed to perform this action
405Method Not Allowed — wrong HTTP verb (e.g. GET on a POST endpoint)
500Server Error — something went wrong on our side; retry shortly

Best Practices

Store keys in environment variables

Never hardcode your API key in source files. Load it from an environment variable or secret manager.

Use the slug for public embeds

For website widgets visible to visitors, use ?biz=YOUR_SLUG instead of the API key to keep it private.

Handle the trend API asynchronously

Trend analysis takes 10–30 seconds. Call it from a background job or cron, not a live page request.

Retry on 5xx with backoff

Transient server errors happen. Retry failed requests after a short delay, with exponential backoff.

Sync metrics daily

Push your daily metrics once per day (e.g. overnight) so weekly reports have complete data.

Ready to connect?

Grab your API key from your business settings and start with the Lead Capture endpoint — it's the fastest way to test your connection.

Talk to our team