Deals
Manage your sales pipeline. Deals move through stages from lead to paid, and can drive invoicing via contract type and rates.
Required scopes:deals:readdeals:write
All endpoints require authentication with an API key via Authorization: Bearer anch_... — see Authentication. A :write scope implicitly includes its :read scope.
Quick example
curl "https://your-domain.com/api/deals?stage=proposal&sortBy=valueCents&sortOrder=desc" \
-H "Authorization: Bearer anch_your_api_key"Endpoints
GET
/api/dealsPOST
/api/dealsGET
/api/deals/{id}PATCH
/api/deals/{id}DELETE
/api/deals/{id}GET/api/deals
Query parameters
| Field | Type | Description |
|---|---|---|
search | string | Full-text search across deal titles |
stage | string | Filter by pipeline stage (see enumeration below) |
companyId | string | Filter to deals for a specific company |
ownerUserId | string | Filter to deals owned by a specific user |
sortBy | string | title, valueCents, closeDate, or createdAt |
sortOrder | string | asc or desc |
limit | integer | Page size (default: 50) |
offset | integer | Pagination offset (default: 0) |
Response (200)
{
"data": [ { "id": "dl_...", "title": "Acme expansion", "stage": "proposal", ... } ],
"meta": { "total": 17, "limit": 50, "offset": 0 }
}POST/api/deals
Body fields
| Field | Type | Description |
|---|---|---|
titlerequired | string | Deal title |
valueCents | integer | Deal value in cents (default: 0) |
currency | string | ISO currency code (default: USD) |
stage | string | Pipeline stage (default: lead) |
closeDate | integer | string | Expected close date — Unix ms or ISO string |
ownerUserId | string | User who owns the deal |
companyId | string | Associated company |
contractType | string | fixed, hourly, milestone, or retainer |
hourlyRateCents | integer | Hourly rate in cents (for hourly contracts) |
estimatedHours | number | Estimated hours (for hourly contracts) |
Response (201)
{ "id": "dl_V1StGXR8Z5jdHi6B" }GET/api/deals/{id}
Response (200)
{
"data": {
"id": "dl_V1StGXR8Z5jdHi6B",
"organizationId": "org_4f90...",
"title": "Acme expansion",
"valueCents": 2400000,
"currency": "USD",
"stage": "proposal",
"closeDate": 1739577600000,
"ownerUserId": "usr_...",
"companyId": "cmp_...",
"contractType": "hourly",
"hourlyRateCents": 15000,
"estimatedHours": 160,
"createdAt": 1736899200000,
"updatedAt": 1736899200000,
"deletedAt": null
}
}PATCH/api/deals/{id}
PUT is also accepted. All fields are optional; only provided fields are updated.
Body fields
| Field | Type | Description |
|---|---|---|
title | string | Deal title |
valueCents | integer | Deal value in cents (default: 0) |
currency | string | ISO currency code (default: USD) |
stage | string | Pipeline stage (default: lead) |
closeDate | integer | string | Expected close date — Unix ms or ISO string |
ownerUserId | string | User who owns the deal |
companyId | string | Associated company |
contractType | string | fixed, hourly, milestone, or retainer |
hourlyRateCents | integer | Hourly rate in cents (for hourly contracts) |
estimatedHours | number | Estimated hours (for hourly contracts) |
Response (200)
{ "ok": true }DELETE/api/deals/{id}
Deals are soft-deleted and excluded from subsequent list and get requests.
Response (200)
{ "ok": true }Enumerations
Pipeline stages
lead— New, unqualified opportunityqualified— Qualified and actively workedproposal— Proposal sentwon— Deal won, contract not yet activecontract_active— Work in progresspending_invoice— Work complete, awaiting invoicingpaid_complete— Invoiced and paidlost— Deal lost
Contract types
fixedhourlymilestoneretainer
Notes
- Monetary values are integers in cents.
- GET/POST/DELETE /api/deals/{id}/recurring manages recurring invoice schedules for a deal.