Close

[POST] .../v1/lead/close

Closes a CRM lead. Use this workflow method to close a lead as unsuccessful without creating a deal. The method validates the lead, pipeline access, current status and closing stage, resolves the pipeline lost stage when stage_id is omitted, marks the lead Closed, sets end_date, records stage history and chat system messages, closes the linked lead chat, writes an action log record, sends LeadStageSet and LeadClosed webhooks, cancels lead notifications and returns row_affected with the lead id. The request body is required and id must be positive; optional stage_id must be a terminal unsuccessful stage in the lead pipeline, successful terminal stages are rejected here and must be handled through Lead/Convert. The caller must have CRM lead edit permission or CRM manage-all access for this workflow; missing body, invalid id, missing lead or stage, denied pipeline access, already converted leads, success-stage misuse, database errors, transaction failures and action-log errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
id Int64 Required Lead ID.
stage_id Int64 Optional Unsuccessful terminal stage ID where is_terminal is true and is_success is false.

Request Example

{
  "id": 105,
  "stage_id": 29
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Update Update operation result.

Response Example

{
  "ok": true,
  "result": {
    "row_affected": 1,
    "ids": [
      105
    ]
  }
}