Skip to content

Opportunities API

https://<your-host>/api/opportunities/

List

GET /api/opportunities/?stage=proposal&close_date__lte=2026-12-31
Authorization: Bearer <token>
{
  "count": 47,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": "o001-…",
      "name": "Acme, Annual 2026",
      "account": { "id": "a001-…", "name": "Acme Corp" },
      "amount": "24000.00",
      "currency": "USD",
      "stage": "proposal",
      "probability": 60,
      "close_date": "2026-06-30",
      "owner": { "id": "u034-…", "email": "rep@yours.com" },
      "stakeholders": [
        { "id": "c012-…", "first_name": "Jane", "last_name": "Doe" }
      ],
      "custom_fields": { "competitor": "incumbent_vendor" },
      "created_at": "2026-03-01T10:00:00Z"
    }
  ]
}

Filterable fields: stage, owner, account, close_date__gte, close_date__lte, amount__gte, tags, cf_<key>.

Create

POST /api/opportunities/
{
  "name": "Acme, Annual 2026",
  "account_id": "a001-…",
  "amount": "24000",
  "currency": "USD",
  "stage": "discovery",
  "close_date": "2026-06-30",
  "stakeholder_ids": ["c012-…"],
  "custom_fields": { "competitor": "incumbent_vendor" }
}

probability defaults from the stage if you omit it.

Detail

GET /api/opportunities/<id>/

Returns the opportunity plus activities, stakeholders (full contact records), and custom_field_definitions.

Update / delete

PATCH  /api/opportunities/<id>/
PUT    /api/opportunities/<id>/
DELETE /api/opportunities/<id>/

Stage transitions

The endpoint is move/, not transition/, and the stage is one of six fixed values rather than something your org configures:

POST /api/opportunities/<id>/move/
{ "stage": "NEGOTIATION" }

Opportunity.stage is a CharField with six choices: PROSPECTING, QUALIFICATION, PROPOSAL, NEGOTIATION, CLOSED_WON, CLOSED_LOST. You cannot rename them or add your own, and there is no per-org pipeline policy to validate a move against.

Forecast

There is no forecast endpoint. The weighted figure the web app shows on its pipeline page is computed by the client from the list response: each deal carries an amount and a probability, and the client sums amount x probability. If you want a forecast from your own code, list the deals over the window you care about and do the same arithmetic.