POST
/api/public/v1/deals/{dealId}/close

Win, lose or re-open a deal

Marks a deal WON or LOST with a reason, or re-opens it with OPEN — which clears the reason and the closed date, because a re-opened deal has neither. Winning one can promote the linked customer’s lifecycle stage to CUSTOMER; that is opt-in via `markContactAsCustomer`, because a won deal does not always mean the relationship changed and the caller is the one who knows.

Required scope

The access token must carry this scope. A token missing it gets 403 Forbidden. Grant them to an API client under Settings → Company → API, and to a teammate under Employee → Permissions.

deals:write

Path Parameters

NameTypeRequiredDescription
dealIdstringRequiredDeal ID.

Request Body

PropertyTypeDescription
statusstringThe outcome, or OPEN to re-open.
reasonstringWhy. Cleared when re-opening.
markContactAsCustomerbooleanOn a WON deal, also promote the linked customer to CUSTOMER.
POSTExample request
curl
curl -X POST "https://www.pxb.app/api/public/v1/deals/{dealId}/close" \
  -H "Authorization: Bearer your_access_token" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "WON",
    "reason": "Signed the annual",
    "markContactAsCustomer": true
  }'
200Example response
json
{
  "message": "Deal updated.",
  "content": {
    "deal": {
      "id": "del_8830",
      "referenceId": 214,
      "locationId": "loc_abc123",
      "pipelineId": "pip_01",
      "stageId": "stg_02",
      "accountId": "acc_7712",
      "ownerId": "emp_44f1",
      "title": "Northwind — annual contract",
      "value": 4800000,
      "currency": "USD",
      "status": "WON",
      "probability": 60,
      "expectedCloseDate": "2026-10-15T00:00:00.000Z",
      "sortOrder": 0,
      "wonLostReason": null,
      "closedAt": "2026-08-29T00:00:00.000Z",
      "stageMovedAt": "2026-08-25T10:00:00.000Z",
      "createdAt": "2026-08-10T09:00:00.000Z",
      "updatedAt": "2026-08-25T10:00:00.000Z"
    }
  }
}

In the console

The same thing done by hand, for anyone comparing the API against the screen they already use.

xRM → Pipeline
/xrm/pipeline
  1. Open a deal card.
  2. Mark it won or lost.