Deals
Deals represent sales opportunities moving through your pipeline. Assign deals to workflows and stages, track value and currency, map buying-committee contact roles, and forecast revenue.
The Deal Object
Section titled “The Deal Object”| Field | Type | Description |
|---|---|---|
id | uuid | Unique identifier for the lost reason |
account_id | uuid | ID of the account that owns the lost reason |
label | string | Display label for the reason, e.g. Price or Chose a competitor; account-customizable. Closing a deal as lost stores this text in the deal’s closed_reason |
display_order | int | Ordering position of the reason relative to other reasons |
created_at | datetime | ISO 8601 timestamp when the reason was created |
Add a deal lost reason
Section titled “Add a deal lost reason”Endpoint: deal-lost-reasons-create
Appends a reason to the end of the account’s list.
| Field | Type | Required | Description |
|---|---|---|---|
label | string | Yes | Display label for the reason, e.g. Price or Chose a competitor |
curl -X POST https://api.driftwoodapp.com/api/deal-lost-reasons-create \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"label": "..."}'Remove a deal lost reason
Section titled “Remove a deal lost reason”Endpoint: deal-lost-reasons-delete
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | ID of the lost reason to remove. Fails with deal_lost_reasons.in_use while any deal was lost for it |
curl -X POST https://api.driftwoodapp.com/api/deal-lost-reasons-delete \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"id": "..."}'List deal lost reasons
Section titled “List deal lost reasons”Endpoint: deal-lost-reasons-list
Returns the account’s lost reasons in display order. Clients offer these when a deal moves to a lost stage and send the chosen reason’s ID as lost_reason_id on deals-update. For a reason not in the list, send closed_reason text instead.
Reorder deal lost reasons
Section titled “Reorder deal lost reasons”Endpoint: deal-lost-reasons-reorder
| Field | Type | Required | Description |
|---|---|---|---|
ids | string[] | Yes | Lost reason IDs in their new display order |
curl -X POST https://api.driftwoodapp.com/api/deal-lost-reasons-reorder \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"ids": []}'Rename a deal lost reason
Section titled “Rename a deal lost reason”Endpoint: deal-lost-reasons-update
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | ID of the lost reason to rename |
label | string | Yes | New label. Deals lost for this reason show the new label |
curl -X POST https://api.driftwoodapp.com/api/deal-lost-reasons-update \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"id": "...", "label": "..."}'List deals with expected close dates
Section titled “List deals with expected close dates”Endpoint: deals-calendar
Close a deal (won or lost) — deprecated
Section titled “Close a deal (won or lost) — deprecated”Endpoint: deals-close
Deprecated: use deals-update with a won or lost stage_id (and optionally closed_reason), which closes the deal the same way. This operation is kept for existing clients and behaves identically, except that it requires a reason.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | No | ID of the deal to close |
stage_id | string | No | ID of the won or lost stage to move the deal into |
reason | string | No | Reason for closing the deal |
curl -X POST https://api.driftwoodapp.com/api/deals-close \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'Link a contact to a deal
Section titled “Link a contact to a deal”Endpoint: deals-contacts-add
List contacts linked to a deal
Section titled “List contacts linked to a deal”Endpoint: deals-contacts-list
Remove a contact from a deal
Section titled “Remove a contact from a deal”Endpoint: deals-contacts-remove
Create a new deal
Section titled “Create a new deal”Endpoint: deals-create
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Name of the deal |
description | string | No | Free-form description of the deal |
stage_id | string? | No | ID of the workflow stage to place the deal in; defaults to the workflow’s default stage when omitted. A won or lost stage creates the deal closed (closed_at set, probability 100 or 0) |
closed_reason | string? | No | Reason typed in by hand for a won or lost deal (e.g. Other); saved only when stage_id is a won or lost stage. For a listed lost reason send lost_reason_id instead |
lost_reason_id | string? | No | ID of one of the account’s lost reasons (deal-lost-reasons-list); saved only when the deal ends up in a lost stage. Takes the place of closed_reason |
workflow_id | string? | No | ID of the deal workflow to use; defaults to the account’s default workflow when omitted |
company_id | string? | No | ID of the company to associate with the deal |
assigned_to | string? | No | ID of the user to assign the deal to |
value | int? | No | Monetary value of the deal in integer minor units (cents) of the currency |
probability | int? | No | Win probability as an integer percentage from 0 to 100; values outside the range are clamped. Defaults to the stage’s default probability when omitted |
expected_close_date | string? | No | Expected close date as an ISO 8601 date (YYYY-MM-DD) |
currency | string? | No | ISO 4217 currency code for the deal value; defaults to the account’s default currency when a value is set and this is omitted One of: USD, EUR, GBP, JPY, CAD, AUD, CHF, CNY, SEK, NOK, DKK, NZD, SGD, HKD, KRW, MXN, BRL, INR, ZAR, TRY, PLN, CZK, HUF, ILS, THB, MYR, PHP, IDR, RON, BGN, ISK |
timezone | string? | No | IANA timezone name used for interpreting the deal’s dates |
notes | string | No | Free-form notes about the deal |
tags | string[] | No | List of tag labels to apply to the deal |
custom_fields | object? | No | Custom field values keyed by field definition, validated against the account’s deal custom field definitions |
curl -X POST https://api.driftwoodapp.com/api/deals-create \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "..."}'Delete a deal
Section titled “Delete a deal”Endpoint: deals-delete
Get a monthly forecast: open deals by expected close month, deals won by month, and overdue deals
Section titled “Get a monthly forecast: open deals by expected close month, deals won by month, and overdue deals”Endpoint: deals-forecast
| Field | Type | Required | Description |
|---|---|---|---|
months | int | No | Number of months to forecast forward, counting the current month, from 1 to 24; defaults to 12 and is clamped to 24 |
past_months | int | No | Number of earlier months to include, so won totals can be compared with the forecast; from 0 to 12, defaults to 0 |
workflow_id | string? | No | Only count deals in this deal workflow; all workflows when omitted |
assigned_to | string? | No | Only count deals assigned to this user; everyone when omitted |
curl -X POST https://api.driftwoodapp.com/api/deals-forecast \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'Get a deal by ID
Section titled “Get a deal by ID”Endpoint: deals-get
Get deal pipeline insights with summary, win rate, and breakdowns
Section titled “Get deal pipeline insights with summary, win rate, and breakdowns”Endpoint: deals-insights
| Field | Type | Required | Description |
|---|---|---|---|
start_date | string | Yes | Start of the reporting period as an ISO 8601 date (YYYY-MM-DD) |
end_date | string | Yes | End of the reporting period as an ISO 8601 date (YYYY-MM-DD), inclusive |
compare_start_date | string | No | Start of an optional comparison period as an ISO 8601 date (YYYY-MM-DD); supply with compare_end_date to include comparison metrics |
compare_end_date | string | No | End of an optional comparison period as an ISO 8601 date (YYYY-MM-DD), inclusive |
curl -X POST https://api.driftwoodapp.com/api/deals-insights \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"start_date": "...", "end_date": "..."}'List deals with filters
Section titled “List deals with filters”Endpoint: deals-list
| Field | Type | Required | Description |
|---|---|---|---|
search | string | No | Text to match against deal name and related fields |
tags | string[] | No | Filter to deals having all of these tag labels |
stage_id | string? | No | Filter to deals in this workflow stage |
company_id | string? | No | Filter to deals associated with this company |
assigned_to | string? | No | Filter to deals assigned to this user |
is_closed | bool? | No | Filter by closed state; true returns closed deals, false returns open deals, omit for all |
cursor | string | No | Opaque pagination cursor returned by a previous list response |
limit | int | No | Maximum number of deals to return in the page |
curl -X POST https://api.driftwoodapp.com/api/deals-list \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'Get pipeline value and deal counts broken down by stage
Section titled “Get pipeline value and deal counts broken down by stage”Endpoint: deals-pipeline-stats
| Field | Type | Required | Description |
|---|---|---|---|
workflow_id | string? | No | ID of the workflow to compute pipeline stats for; defaults to the account’s default workflow when omitted |
curl -X POST https://api.driftwoodapp.com/api/deals-pipeline-stats \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'Reopen a closed deal — deprecated
Section titled “Reopen a closed deal — deprecated”Endpoint: deals-reopen
Deprecated: use deals-update with an open stage_id, which reopens the deal the same way (clears closed_at and closed_reason, resets probability to the stage default). Kept for existing clients.
Update a deal
Section titled “Update a deal”Endpoint: deals-update
| Field | Type | Required | Description |
|---|---|---|---|
id | string | No | ID of the deal to update |
workflow_id | string? | No | ID of the workflow to move the deal to; when changed without a stage_id the deal moves to the new workflow’s default stage |
name | string? | No | New name for the deal |
description | string? | No | New description for the deal |
stage_id | string? | No | ID of the workflow stage to move the deal to. Moving into a won or lost stage closes the deal: closed_at is set and probability becomes 100 (won) or 0 (lost). Moving into an open stage reopens it: closed_at and closed_reason are cleared and probability resets to the stage default |
closed_reason | string? | No | Reason typed in by hand for a won or lost deal (e.g. Other); saved only when the deal ends up in a won or lost stage, ignored otherwise. Clears lost_reason_id |
lost_reason_id | string? | No | ID of one of the account’s lost reasons (deal-lost-reasons-list); saved only when the deal ends up in a lost stage. Takes the place of closed_reason |
company_id | string? | No | ID of the company to associate; pass an empty string to clear the association |
assigned_to | string? | No | ID of the user to assign; pass an empty string to clear the assignment |
value | int? | No | Monetary value of the deal in integer minor units (cents) of the currency |
probability | int? | No | Win probability as an integer percentage from 0 to 100; values outside the range are clamped |
expected_close_date | string? | No | Expected close date as an ISO 8601 date (YYYY-MM-DD) |
currency | string? | No | ISO 4217 currency code for the deal value One of: USD, EUR, GBP, JPY, CAD, AUD, CHF, CNY, SEK, NOK, DKK, NZD, SGD, HKD, KRW, MXN, BRL, INR, ZAR, TRY, PLN, CZK, HUF, ILS, THB, MYR, PHP, IDR, RON, BGN, ISK |
timezone | string? | No | IANA timezone name used for interpreting the deal’s dates |
notes | string? | No | New notes for the deal |
tags | string[] | No | Replacement list of tag labels for the deal |
custom_fields | object? | No | Custom field values to merge, validated against the account’s deal custom field definitions |
curl -X POST https://api.driftwoodapp.com/api/deals-update \ -H "Authorization: Bearer YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{}'Error Codes
Section titled “Error Codes”| Code | Description |
|---|---|
deal_lost_reasons.label_required | Label required |
deal_lost_reasons.label_too_long | Label too long |
deal_lost_reasons.duplicate | Duplicate |
deal_lost_reasons.invalid_id | Invalid id |
deal_lost_reasons.not_found | Not found |
deal_lost_reasons.in_use | In use |
deals.invalid_id | Invalid id |
deals.invalid_stage_id | Invalid stage id |
deals.invalid_stage | Invalid stage |
deals.stage_not_closed | Stage not closed |
deals.reason_required | Reason required |
deals.not_found | Not found |
deals.name_required | Name required |
deals.invalid_workflow_id | Invalid workflow id |
deals.invalid_company_id | Invalid company id |
deals.invalid_assigned_to | Invalid assigned to |
deals.invalid_custom_fields | Invalid custom fields |
deals.dates_required | Dates required |
deals.invalid_start_date | Invalid start date |
deals.invalid_end_date | Invalid end date |
deals.invalid_compare_start_date | Invalid compare start date |
deals.invalid_compare_end_date | Invalid compare end date |
deals.stage_not_open | Stage not open |