Bulk import & search leads
Goal: create leads in bulk and find them later with rich filters.
Import
Create each lead (optionally with contacts) via POST /v1/leads/with-contacts — see
Create a lead. Tag a group of imports with a shared batch_name so you
can find or act on them together:
curl -s https://api.sance.ai/v1/leads/with-contacts \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{
"lead": { "product_id": 42, "stage_id": 7, "batch_name": "q3-import",
"crm_fields": { "industry": "manufacturing", "budget": "50000" } },
"contacts": [ { "contact": "+15551234567", "contact_type": "phone", "is_main": true } ]
}'
Search
The simple GET /v1/leads/ supports basic filters (stage, name, active/test, tags, a single
CRM field). For multi-condition queries use POST /v1/leads/search, which adds multiple
stages, multiple ids, and composite CRM-field conditions:
curl -s https://api.sance.ai/v1/leads/search \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{
"product_id": 42,
"stage_ids": [7, 8],
"is_active": true,
"crm_fields_conditions": {
"operator": "AND",
"conditions": [
{ "field": "industry", "operator": "EQUALS", "value": "manufacturing" },
{ "field": "budget", "operator": "IS_NOT_EMPTY" }
]
},
"page": 1, "limit": 50
}'
Per-condition operator values include EQUALS, NOT_EQUALS, IN, NOT_IN,
STARTS_WITH, ENDS_WITH, CONTAINS, EXISTS, NOT_EXISTS, IS_EMPTY, IS_NOT_EMPTY;
the top-level operator joins them with AND or OR. GET /v1/leads/count returns just
the total for the simple filters.
See: POST /v1/leads/with-contacts, GET /v1/leads/, POST /v1/leads/search,
GET /v1/leads/count.