Skip to main content

Quickstart

Create an API key, create a lead, then receive the webhook LMS sends about it.

Set up your environment

Every example below reads these four values from the environment. Replace each your-… value with your own; you get the key in step 1.

  • LMS_WORKSPACE: your workspace slug, the first part of your LMS web address (/your-workspace/lms/leads).
  • CAMPAIGN_ID: open the campaign in the LMS and copy the ID from the address bar, or call List campaigns (scope campaigns.read).
Environment (Shell)
export LMS_API="https://lms.iotindia.ai"export LMS_API_KEY="lms_your-key-id.your-secret"   # from step 1export LMS_WORKSPACE="your-workspace"export CAMPAIGN_ID="your-campaign-id"

1. Create an API key

In the LMS, open Settings → Integrations → API keys and choose Create API key. Give it a name, pick the acting member (the key acts as this person, so their permissions and data access apply too) and select the scopes leads.read, leads.write, campaigns.read (to look up campaign IDs) and events.read.

Copy the token (lms_…) when it is shown: it is displayed only once, and LMS keeps just a hash. Store it in your secret manager, set LMS_API_KEY, then check that it works:

Check the key (Shell)
curl "$LMS_API/v1/integrations" \  -H "Authorization: Bearer $LMS_API_KEY"
Response (200 OK, shortened) (JSON)
{  "id": "5c6d7e8f-9a0b-4c1d-8e2f-3a4b5c6d7e8f",  "kind": "API_KEY",  "scopes": [    "leads.read",    "leads.write",    "campaigns.read",    "events.read"  ],  "eventFeed": true}

A 200 lists the key's scopes and the operations they grant. A 401 means the token is missing, incomplete, revoked or expired. A 403 on a later call has two causes, so check both: the key lacks the operation's scope, or its acting member lacks the permission or access to the record, for example to the campaign you create the lead in.

2. Create a lead

The Idempotency-Key makes the call safe to retry. Create it once per lead and save it; every attempt for that lead sends the saved key, so a retry after a timeout returns the original result instead of a second lead.

Run once per new lead
# Once per new lead. A retry reuses it; the next lead gets a new one.export IDEMPOTENCY_KEY="$(uuidgen)"
Create a lead (rerun to retry)
BASE="$LMS_API/v1/tenants/$LMS_WORKSPACE"# Rerun this command to retry: it sends the same saved key.curl -X POST "$BASE/lms/leads" \  -H "Authorization: Bearer $LMS_API_KEY" \  -H "Idempotency-Key: ${IDEMPOTENCY_KEY:?create the key first}" \  -H "Content-Type: application/json" \  -d "$(cat <<JSON  {    "campaignId": "${CAMPAIGN_ID}",    "fullName": "Asha Verma",    "city": "Pune",    "productInterest": "Rooftop solar, 5 kW",    "contacts": [      {        "contactType": "PHONE",        "value": "+919812345678",        "isPrimary": true      },      { "contactType": "EMAIL", "value": "asha@example.com" }    ]  }JSON)"

To retry, run only the request again. To create a different lead, create a new key first. More on keys in Idempotency.

Response (201 Created) (JSON)
{  "created": true,  "leadId": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10"}

If the person already exists under the campaign's duplicate rules, you get 200 with created: false, the existing leadId and repeatEnquiry: true. Sending leads from another system with your own field names? Use a Partner API source instead, so the LMS mapping and routing apply.

3. Receive a webhook

Open Settings → Integrations → Webhooks, choose Add endpoint, enter your HTTPS URL and subscribe to lead.created. Copy the signing secret (whsec_…). Use Send test event to check your endpoint, then create another lead: within seconds LMS posts an event like this.

Webhook request (HTTP)
POST /webhooks/lms HTTP/1.1Content-Type: application/jsonwebhook-id: 0f7e6d5c-4b3a-4291-8f7e-000000000001webhook-timestamp: 1796119200webhook-signature: v1,NpQ+PN4rb78B6pM7XeQ3EaLm2l2E2+qetE9P60FJ3ew={  "id": "0f7e6d5c-4b3a-4291-8f7e-000000000001",  "type": "lead.created",  "version": 1,  "timestamp": "2026-12-01T10:00:00.000Z",  "workspace": "your-workspace",  "data": {    "lead": {      "id": "0b6c7a52-4f0e-4c1a-9d43-3f2a7c1e9b10",      "contact": {        "name": "Asha Verma",        "phone": "+919812345678",        "email": "asha@example.com"      },      "company": "Verma Traders",      "city": "Pune",      "state": "Maharashtra",      "country": "India",      "productInterest": "Rooftop solar, 5 kW",      "priority": 2,      "stage": {        "id": "8c7b6a59-4d3e-4f2a-9b1c-0d9e8f7a6b5c",        "name": "New",        "category": "new"      },      "process": {        "id": "3a4b5c6d-7e8f-4a0b-9c1d-2e3f4a5b6c7d",        "name": "Solar sales"      },      "campaign": {        "id": "2c3d4e5f-6a7b-4c8d-9e0f-1a2b3c4d5e6f",        "name": "Pune rooftop launch"      },      "owner": {        "userId": "9e8d7c6b-5a49-4382-8170-6f5e4d3c2b1a",        "team": {          "id": "4b5c6d7e-8f90-4a1b-8c2d-3e4f5a6b7c8d",          "name": "West inside sales"        }      },      "source": {        "id": "1f2e3d4c-5b6a-4798-8a7b-6c5d4e3f2a1b",        "name": "Meta Lead Ads",        "channel": "META"      },      "receivedAt": "2026-12-01T09:58:12.000Z",      "createdAt": "2026-12-01T09:58:13.000Z",      "updatedAt": "2026-12-01T10:00:00.000Z"    }  }}

This example is signed with the secret whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw, so you can test your verifier with it (ignore the timestamp tolerance while you do). Verify the signature before you trust the body, respond with any 2xx within 15 seconds, and process the event asynchronously. The webhooks guide has verification code for Node.js, Python, PHP and the shell. Can't receive inbound HTTPS? Poll the change feed with the events.read scope instead.