Skip to navigation

CRM leads

Send leads from your website, your database, a Google Sheet script or your own CRM straight into Levrage. Every lead you push lands in the CRM like one added by hand: it shows on the lead’s timeline as “API”, stage rules and always-on campaigns react to it, and your webhooks hear about it.

Your key

Create a key in CRM → Settings → API and webhooks in the dashboard and give it Read and write access. A key belongs to one workspace: the leads, stages and custom fields it sees are that workspace’s.

export LEVRAGE_KEY="lev_..."

Add or update one lead

curl -X POST https://api.levrage.ai/v1/crm/leads \
-H "Authorization: Bearer $LEVRAGE_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: form-submission-88231" \
-d '{
"name": "Amit Kumar",
"phone": "9876543210",
"external_id": "12345",
"city": "Hyderabad",
"fields": {"Zone": "Madhapur", "Week": "43", "Plan": "Gold"},
"source": "google_sheet",
"on_conflict": "update"
}'
HTTP 201
{"result": "created", "lead": {"id": "0b6c2f4e-…", "name": "Amit Kumar", "phone": "+919876543210", …}}

The person is matched on external_id, then phone, then email. When one matches, on_conflict decides:

on_conflictWhat happens
error (default)409 conflict, with the lead’s existing_id
updatethe details you sent are applied (custom fields are merged) — "updated", or "unchanged" when nothing differed
ignorethe lead is left as it is — "unchanged"

Send external_id (your own id for the person) on every lead and use "on_conflict": "update". Re-sending the same lead is then always safe: it updates instead of duplicating.

Custom fields

Put your own details inside fields, named by the field’s key (zone) or its label as the dashboard shows it, in any case ("Zone", "ZONE"). GET /v1/crm/fields lists them.

A name with no field in the workspace is a 400 that lists every such name at once, so nothing you send vanishes silently:

{"error": {"code": "invalid_request",
"message": "There are no fields “ZONENAME”, “Week” in this workspace. Add them in CRM → Settings → Fields, or send \"create_missing_fields\": true to have them made as text fields. GET /fields lists the fields there."}}

Add "create_missing_fields": true and those names become text fields instead — labelled as you sent them, with a key made from the name ("DOJ + 7 days OC" → doj_7_days_oc). The answer lists them in created_fields. Up to 50 new fields per request; change a field’s type in the dashboard afterwards if it should be a number, date or choice.

Push many leads — bulk

POST /v1/crm/leads/bulk takes up to 500 leads per request. Each row succeeds or fails on its own, and results has one entry per row, in order.

curl -X POST https://api.levrage.ai/v1/crm/leads/bulk \
-H "Authorization: Bearer $LEVRAGE_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: sheet-2026-10-26-chunk-1" \
-d '{
"on_conflict": "update",
"create_missing_fields": true,
"leads": [
{"name": "Amit Kumar", "phone": "9876543210", "external_id": "12345",
"fields": {"Zone": "Madhapur", "Week": "43"}},
{"name": "Ravi Teja", "phone": "9876500002", "external_id": "12346",
"fields": {"Zone": "Kondapur", "Week": "43"}},
{"name": "Bad number", "phone": "12"}
]
}'
HTTP 200
{"results": [{"index": 0, "result": "created", "lead_id": "…"},
{"index": 1, "result": "updated", "lead_id": "…"},
{"index": 2, "result": "error", "lead_id": null,
"error": {"code": "invalid_request", "message": "“12” isn’t a phone number we can call."}}],
"created": 1, "updated": 1, "unchanged": 0, "failed": 1,
"created_fields": [{"key": "zone", "label": "Zone"}, {"key": "week", "label": "Week"}]}
  • on_conflict, match_on and create_missing_fields apply to every row; a row can set its own.
  • Without create_missing_fields, rows naming fields that don’t exist fail, and the answer adds missing_fields — each such name, once.
  • For a big sheet or table, send chunks of 500, each with its own Idempotency-Key. A key allows 600 requests a minute — 300,000 leads a minute.

Retries and limits

  • Idempotency-Key on any POST: repeating the same request with the same key within 24 hours returns the first answer (with Idempotent-Replayed: true) instead of writing twice. A 400 or 5xx isn’t kept — fix the request and retry with the same key.
  • Rate limit: 600 requests a minute per key. Every answer carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; over the limit you get 429 with Retry-After.
  • Errors always look like {"error": {"code": "…", "message": "…"}} — message is a sentence you can show or log.
StatuscodeWhen
400invalid_requesta field, filter or cursor is wrong — message says which
401api_key_required, invalid_api_keyno key, or an unknown / revoked / expired one
403insufficient_scopethe key has no CRM access, or read-only access
404not_foundnot there, deleted, or another workspace’s
409conflictthe person is already a lead — existing_id is theirs
429rate_limitedover the limit — wait Retry-After seconds

Everything else

GET /v1/crm/leadslist, with updated_since, stage_id, q, tag… and cursor pages — keep a copy in sync
GET · PATCH · DELETE /v1/crm/leads/{id}one lead
POST /v1/crm/leads/{id}/notesa note on the lead’s timeline
GET /v1/crm/leads/{id}/activitiesthe timeline: calls, WhatsApp, notes, stage changes
GET /v1/crm/stages · /pipelines · /fieldsyour setup, with the ids to send

To hear about changes the moment they happen (a call finished, a stage moved, a deal won), add a webhook in CRM → Settings → API and webhooks → Webhooks.