Leads — Examples
Each example below shows a complete curl request. Replace {enterpriseId} with your enterprise ID and YOUR_SYNC_TOKEN with a valid Sync token.
Create a lead with custom fields and an embedded custom action
Single call: create the lead, set custom fields, and append a custom action.
bash
curl -X POST "https://next.telecrm.in/autoupdate/v2/enterprise/{enterpriseId}/lead" \
-H "Authorization: Bearer YOUR_SYNC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"fields": {
"name": "Jane Doe",
"phone": "919999999999",
"email": "jane.doe@example.com",
"contact_source": "Website",
"interests": ["VIP", "Returning"],
"deal_size": 1000
},
"actions": [
{
"type": "1001",
"fields": {
"note": "Site visit completed",
"outcome": "Interested"
}
}
]
}'Search by phone, then read the matching lead
Two calls. First, find the lead's ID:
bash
curl -X POST "https://next.telecrm.in/autoupdate/v2/enterprise/{enterpriseId}/lead/search" \
-H "Authorization: Bearer YOUR_SYNC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"fields": {
"phone": "919999999999"
}
}'The response includes data[].fields but not the lead ID directly. Use GET /lead/{leadId}?includeActions=true once you have the ID from another source (a webhook, a previous create response, etc.) to retrieve the full timeline.
Search Won leads with action history filter
Find leads in Won status that received an outgoing call from a specific agent in April 2026.
bash
curl -X POST "https://next.telecrm.in/autoupdate/v2/enterprise/{enterpriseId}/lead/search?limit=50" \
-H "Authorization: Bearer YOUR_SYNC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"fields": {
"status": ["Won"]
},
"actions": {
"type": ["OUTGOING_CALL"],
"performed_by": "agent@company.com",
"performed_at": {
"from": "01/04/2026 00:00:00",
"to": "30/04/2026 23:59:59"
}
}
}'Update a lead's status and rating
bash
curl -X POST "https://next.telecrm.in/autoupdate/v2/enterprise/{enterpriseId}/lead/603d2b2f9b1e8a001c8e4f5c" \
-H "Authorization: Bearer YOUR_SYNC_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"fields": {
"status": "Qualified",
"rating": 5
}
}'Handle a partial-success response on creation
When some fields fail validation, the lead is still created and the offending fields appear in remarks:
json
{
"lead_id": "603d2b2f9b1e8a001c8e4f5c",
"actions": [
{ "action_id": null, "status": "IGNORED" }
],
"remarks": [
{ "field": "fields.rating", "status": "IGNORED", "remark": "Rating must be between 1 and 5" },
{ "field": "actions[0].fields.email", "status": "IGNORED", "remark": "Email is invalid" }
]
}The lead exists at lead_id and has the valid fields. The invalid rating was dropped, and the action was skipped because of an invalid email field on it. Re-issue the bad fields via POST /lead/{leadId} and the bad action via POST /lead/{leadId}/action after fixing the validation errors.