RaabtaHQ
Close a deal as won or lost

Close a deal as won or lost

POST/api/v1/deals/{id}/close

scope deals:writeIdempotent

Sets the outcome; optionally the final value. A deal that is already closed returns 409 conflict.

Path parameters

NameTypeDescription
idrequired
string (uuid)Deal id

Body

application/json
NameTypeDescription
outcomerequired
string (enum)wonlost
valueoptional
numberFinal value, if it changed
Request
curl -X POST "https://your-crm.example.com/api/v1/deals/e5f6a7b8-c9d0-4e1f-8a3b-4c5d6e7f8a9b/close" \
  -H "Authorization: Bearer $RAABTA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 6f1c2a9e-3b4d-4c5e-8f7a-9b0c1d2e3f4a" \
  -d '{
    "outcome": "won",
    "value": 12000
  }'
Response · 200 OK
{
  "data": {
    "id": "e5f6a7b8-c9d0-4e1f-8a3b-4c5d6e7f8a9b",
    "title": "Khan Trading — annual package",
    "value": 12000,
    "currency": "AED",
    "status": "won",
    "pipeline_id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
    "stage_id": "c3d4e5f6-a7b8-4c9d-8e1f-2a3b4c5d6e7f",
    "stage": {
      "id": "c3d4e5f6-a7b8-4c9d-8e1f-2a3b4c5d6e7f",
      "name": "Qualified"
    },
    "contact_id": "9d7e4c11-5a2b-4f7c-8e3d-2a1b0c9d8e7f",
    "conversation_id": null,
    "assigned_to": "2f3e4d5c-6b7a-4c8d-9e0f-1a2b3c4d5e6f",
    "notes": null,
    "expected_close_date": "2026-10-15",
    "created_at": "2026-09-01T08:15:00.000Z",
    "updated_at": "2026-09-02T10:00:00.000Z"
  }
}

Response

Wrapped in { data: … }
NameTypeDescription
idrequired
string (uuid)UUID
titlerequired
stringWhat the deal is for
valuerequired
numberDeal value as a number (the API coerces the decimal column)
currencyrequired
string | nullISO 4217 code
statusrequired
string (enum)Outcome; a deal is open until it is closedopenwonlost
pipeline_idrequired
string (uuid)UUID
stage_idrequired
string (uuid)UUID
stagerequired
object | nullThe stage the deal currently sits in
stage.idrequired
string (uuid)UUID
stage.namerequired
stringStage name
contact_idrequired
string (uuid) | null
conversation_idrequired
string (uuid) | null
assigned_torequired
string (uuid) | nullMember user id
notesrequired
string | nullFree-text notes on the deal
expected_close_daterequired
string | nullYYYY-MM-DD
created_atrequired
string (date-time)ISO 8601 timestamp
updated_atrequired
string (date-time)ISO 8601 timestamp

Errors

StatusCodeWhen
400bad_requestThe request could not be parsed: malformed JSON, an invalid cursor, or a query parameter of the wrong shape.
400validation_errorThe body or query failed validation. `details` lists each failing field with a `path` and a `message`.
401unauthorizedNo usable API key: the Authorization header is missing or malformed, or the key is unknown, revoked or expired. The three are deliberately indistinguishable.
403forbiddenThe key is valid but lacks the scope this endpoint requires, or the request came from an address outside the key’s IP allowlist. The message says which.
403account_suspendedThe account this key belongs to is suspended. Rotating the key will not help; contact support.
404not_foundNo such resource in this account. A resource that exists in another account also returns this.
409conflictThe request conflicts with current state: a duplicate phone number on create, an invalid state transition, or an idempotent request that is still in flight.
422unprocessableThe request was well-formed but cannot be carried out. `reason` is a stable string saying why (for example `outside_window` or `stage_not_in_pipeline`).
429rate_limitedThe per-key budget, or the per-IP budget for failed authentication, is exhausted. Honour `Retry-After` before retrying.
500internalSomething failed on our side. Safe to retry with the same Idempotency-Key; quote `request_id` if it persists.