Opportunities
Endpoints
Available endpoints for managing opportunities.
| Method | Path | Description |
|---|
GET | /api/opportunities/ | List opportunities |
POST | /api/opportunities/ | Create an opportunity |
GET | /api/opportunities/{id}/ | Get an opportunity |
PATCH | /api/opportunities/{id}/ | Update an opportunity |
DELETE | /api/opportunities/{id}/ | Delete an opportunity |
Opportunities
List Opportunities
GET /api/opportunities/
Authorization: Bearer <token>
Retrieve a paginated list of opportunities with optional filters.
Query Parameters:
| Parameter | Type | Description |
|---|
page | integer | Page number |
limit | integer | Results per page (max: 100) |
stage | string | Filter by pipeline stage |
accountId | string | Filter by account |
assignedTo | string | Filter by assigned user ID |
closeDateAfter | ISO8601 | Filter by expected close date |
closeDateBefore | ISO8601 | Filter by expected close date |
valueMin | number | Filter by minimum deal value |
valueMax | number | Filter by maximum deal value |
search | string | Search by opportunity name |
Response:
{
"count": 18,
"next": null,
"previous": null,
"results": [
{
"id": "opp_01HX...",
"name": "Acme Corp — Enterprise License",
"accountId": "acc_01HX...",
"accountName": "Acme Corp",
"value": 48000,
"stage": "negotiation",
"probability": 70,
"closeDate": "2025-04-30",
"assignedTo": "usr_01HX...",
"source": "inbound",
"createdAt": "2025-01-20T10:00:00Z",
"updatedAt": "2025-03-15T09:30:00Z"
}
]
}
Creation
Create an Opportunity
POST /api/opportunities/
Authorization: Bearer <token>
Content-Type: application/json
Create a new opportunity linked to an account.
Request body:
{
"name": "TechCorp — Professional Services Q2",
"accountId": "acc_02HX...",
"value": 24000,
"stage": "qualification",
"probability": 40,
"closeDate": "2025-06-30",
"assignedTo": "usr_01HX...",
"source": "outbound",
"contactIds": ["cnt_01HX...", "cnt_03HX..."],
"description": "Professional services engagement for data migration project"
}
Required fields: name, accountId
Response: 201 Created
Opportunity Details
Get an Opportunity
GET /api/opportunities/{id}/
Authorization: Bearer <token>
Retrieve full details of a specific opportunity.
Response:
{
"id": "opp_01HX...",
"name": "TechCorp — Professional Services Q2",
"accountId": "acc_02HX...",
"accountName": "TechCorp Inc",
"value": 24000,
"stage": "qualification",
"probability": 40,
"closeDate": "2025-06-30",
"closedDate": null,
"lossReason": null,
"assignedTo": "usr_01HX...",
"assignedToName": "Alex Johnson",
"source": "outbound",
"contactIds": ["cnt_01HX...", "cnt_03HX..."],
"description": "Professional services engagement for data migration project",
"createdAt": "2025-03-01T12:00:00Z",
"updatedAt": "2025-03-01T12:00:00Z"
}
Updates
Update an Opportunity
PATCH /api/opportunities/{id}/
Authorization: Bearer <token>
Content-Type: application/json
Update fields such as stage, probability, or outcome.
Example — close a deal:
{
"stage": "closed_won",
"closedDate": "2025-03-25",
"probability": 100
}
Example — log a loss:
{
"stage": "closed_lost",
"lossReason": "Chose competitor — price was primary objection"
}
Response: 200 OK with the updated opportunity object.
Deletion
Delete an Opportunity
DELETE /api/opportunities/{id}/
Authorization: Bearer <token>
Permanently remove an opportunity.
Response: 204 No Content
Pipeline
Pipeline Stage Values
| Value | Label |
|---|
prospecting | Prospecting |
qualification | Qualification |
needs_analysis | Needs Analysis |
proposal | Proposal |
negotiation | Negotiation |
closed_won | Closed Won |
closed_lost | Closed Lost |