SetStage

[POST] .../v1/lead/setstage

Changes the stage of a CRM lead. Use this workflow method to move an active lead to another stage in the same lead pipeline when the movement is not a successful conversion to a deal. The method validates the lead, target stage, current stage, pipeline ACL, responsible assignment, duplicate-repeat constraints and allowed status transition, updates stage/status/end_date, records stage history and chat system messages, sends LeadStageSet notifications and, for unsuccessful terminal stages, LeadClosed notifications, then returns row_affected with the lead id. The request body is required; id and stage_id must be positive, the target stage must belong to the lead pipeline, successful terminal stages must be handled through Lead/Convert and converted leads cannot be reopened through this method. The caller must have CRM lead edit permission or CRM manage-all access for this workflow; missing body, invalid ids, missing lead or stage, denied pipeline access, missing responsible user for InProgress transition, successful terminal stage usage, duplicate-repeat restrictions, database errors, transaction failures and action-log errors are returned as HTTP 200 ErrorResult business errors.

Request Parameters

Name Type Required Description
comment String Optional Comment for the stage change.
id Int64 Required Lead ID.
stage_id Int64 Required New stage ID.

Request Example

{
  "id": 105,
  "stage_id": 26,
  "comment": "Qualified by operator"
}

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
    ]
  }
}