Close
[POST] .../v1/deal/close
Closes a CRM deal. Close a deal directly with a selected terminal stage in the deal pipeline. The method validates the deal, pipeline access and terminal stage, marks the deal Won or Lost based on the stage success flag, sets close_date, records stage history and chat system messages, closes the linked deal chat, sends DealStageSet and DealClosed webhooks, cancels deal notifications and returns row_affected with the deal id. The request body is required; id and stage_id must be positive and stage_id must be a terminal stage that belongs to the deal pipeline. The caller must have CRM deal edit permission or CRM manage-all access; missing body, invalid ids, missing deal or terminal stage, denied pipeline access, storage errors are returned as HTTP 200 ErrorResult.
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | Int64 | Required | Deal ID. |
| stage_id | Int64 | Required | Terminal stage ID in the deal pipeline. |
Request Example
{
"id": 230,
"stage_id": 36
}
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": [
230
]
}
}