Complete Task
Mark the lead's currently-open (PENDING) task as complete. You don't need to know the internal task ID — Superfone finds the lead's open task and closes it.
If the lead has no open task, the request returns 400 No open task found for this lead.
Requires the x-api-key header. See Overview for details.
HTTP Request
POST /enterprise/api/lead/:lead_id/task/complete
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
lead_id | number | Yes | Internal lead ID. Get this from Get Lead. |
Request Body
No request body is required. The endpoint takes no parameters beyond :lead_id.
Try it
Code Examples
- cURL
- JavaScript
- Python
curl -X POST https://prod-api.superfone.co.in/superfone/enterprise/api/lead/12345/task/complete \
-H "x-api-key: your_api_key_here"
const leadId = 12345;
const response = await fetch(
`https://prod-api.superfone.co.in/superfone/enterprise/api/lead/${leadId}/task/complete`,
{
method: 'POST',
headers: { 'x-api-key': process.env.SF_API_KEY }
}
);
const result = await response.json();
console.log(result.data);
import os
import requests
lead_id = 12345
response = requests.post(
f'https://prod-api.superfone.co.in/superfone/enterprise/api/lead/{lead_id}/task/complete',
headers={'x-api-key': os.environ['SF_API_KEY']}
)
print(response.json()['data'])
Success Response
Status Code: 200 OK
Returns the closed task with task_status: "COMPLETE".
{
"data": {
"id": 4567,
"org_id": 42,
"customer_id": 12345,
"title": null,
"type": "FOLLOW_UP_CALL",
"due_date": "2026-05-20T15:00:00.000Z",
"notify_at": "2026-05-20T14:50:00.000Z",
"notify": true,
"task_status": "COMPLETE",
"status": "COMPLETE",
"assignee_user_id": 678,
"created_by": 1,
"updated_by": 1,
"created_at": "2026-05-19T08:30:00.000Z",
"updated_at": "2026-05-19T11:45:00.000Z"
},
"message": "success"
}
Error Responses
| Status | Message | When it occurs |
|---|---|---|
400 | lead_id must be a number | URL contains a non-numeric :lead_id |
400 | No open task found for this lead | The lead has no PENDING task. Calling this on a lead whose task is already complete (or never had one) returns this error. |
401 | UnAuthorized, Please Provide Valid API Key | Missing or invalid x-api-key |
404 | Lead not found | lead_id doesn't exist, or belongs to a different account |
Which task gets closed?
If the lead has more than one open task (for example, a REMINDER alongside a FOLLOW_UP_CALL), the most recently created open task is closed. In practice you typically have at most one open non-reminder task at a time — Superfone closes prior non-reminder tasks when Create Task is called with another non-reminder type.
Related Endpoints
- Create Task — Add a new task to a lead
- List Tasks — Paginated task history (open + completed)