Skip to main content

Endpoints

MethodPathDescription
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

List Opportunities

GET /api/opportunities/
Authorization: Bearer <token>
Query Parameters:
ParameterTypeDescription
pageintegerPage number
limitintegerResults per page (max: 100)
stagestringFilter by pipeline stage
accountIdstringFilter by account
assignedTostringFilter by assigned user ID
closeDateAfterISO8601Filter by expected close date
closeDateBeforeISO8601Filter by expected close date
valueMinnumberFilter by minimum deal value
valueMaxnumberFilter by maximum deal value
searchstringSearch 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"
    }
  ]
}

Create an Opportunity

POST /api/opportunities/
Authorization: Bearer <token>
Content-Type: application/json
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

Get an Opportunity

GET /api/opportunities/{id}/
Authorization: Bearer <token>
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"
}

Update an Opportunity

PATCH /api/opportunities/{id}/
Authorization: Bearer <token>
Content-Type: application/json
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.

Delete an Opportunity

DELETE /api/opportunities/{id}/
Authorization: Bearer <token>
Response: 204 No Content

Pipeline Stage Values

ValueLabel
prospectingProspecting
qualificationQualification
needs_analysisNeeds Analysis
proposalProposal
negotiationNegotiation
closed_wonClosed Won
closed_lostClosed Lost