> ## Documentation Index
> Fetch the complete documentation index at: https://docs.parsalink.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Opportunities API

> REST endpoints for creating, reading, updating, and deleting opportunity (deal) records in ParsaLink.

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "linear-gradient(90deg, #143D4E 0%, #1C758A 100%)",
color: "#FFFFFF",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
boxShadow: "0 8px 24px rgba(20, 61, 78, 0.18)"
}}
>
  Opportunities
</div>

## Endpoints

<div
  style={{

border: "1px solid rgba(48, 200, 202, 0.22)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#2C768D",
boxShadow: "0 10px 26px rgba(28, 117, 138, 0.08)"
}}
  className="dark:!bg-[#0B0B0B] dark:!border-gray-800 dark:!text-cyan-300 dark:shadow-none"
>
  Available endpoints for managing opportunities.
</div>

<div
  style={{
background: "linear-gradient(135deg, rgba(20, 61, 78, 0.04) 0%, rgba(28, 117, 138, 0.08) 100%)",
border: "1px solid #CDD1D3",
borderRadius: "18px",
padding: "8px 12px 2px 12px",
marginBottom: "22px",
boxShadow: "0 10px 30px rgba(20, 61, 78, 0.06)"
}}
>
  | 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 |
</div>

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "rgba(48, 200, 202, 0.12)",
color: "#1C758A",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
border: "1px solid rgba(48, 200, 202, 0.28)"
}}
>
  Opportunities
</div>

## List Opportunities

```http theme={null}
GET /api/opportunities/
Authorization: Bearer <token>
```

<div
  style={{

border: "1px solid rgba(48, 200, 202, 0.22)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#2C768D",
boxShadow: "0 10px 26px rgba(28, 117, 138, 0.08)"
}}
  className="dark:!bg-[#0B0B0B] dark:!border-gray-800 dark:!text-cyan-300 dark:shadow-none"
>
  Retrieve a paginated list of opportunities with optional filters.
</div>

**Query Parameters:**

<div
  style={{
 border: "1px solid #CDD1D3",
borderRadius: "18px",
padding: "8px 12px 2px 12px",
marginBottom: "22px",
boxShadow: "0 10px 30px rgba(20, 61, 78, 0.05)"
}}
  className="dark:!bg-black dark:!border-gray-800 dark:shadow-none"
>
  | 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    |
</div>

**Response:**

```json theme={null}
{
  "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"
    }
  ]
}
```

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "linear-gradient(90deg, #143D4E 0%, #1C758A 100%)",
color: "#FFFFFF",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
boxShadow: "0 8px 24px rgba(20, 61, 78, 0.18)"
}}
>
  Creation
</div>

## Create an Opportunity

```http theme={null}
POST /api/opportunities/
Authorization: Bearer <token>
Content-Type: application/json
```

<div
  style={{

border: "1px solid rgba(48, 200, 202, 0.22)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#2C768D",
boxShadow: "0 10px 26px rgba(28, 117, 138, 0.08)"
}}
  className="dark:!bg-[#0B0B0B] dark:!border-gray-800 dark:!text-cyan-300 dark:shadow-none"
>
  Create a new opportunity linked to an account.
</div>

**Request body:**

```json theme={null}
{
  "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`

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "rgba(255, 111, 97, 0.12)",
color: "#FF6F61",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
border: "1px solid rgba(255, 111, 97, 0.24)"
}}
>
  Opportunity Details
</div>

## Get an Opportunity

```http theme={null}
GET /api/opportunities/{id}/
Authorization: Bearer <token>
```

<div
  style={{

border: "1px solid rgba(48, 200, 202, 0.22)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#2C768D",
boxShadow: "0 10px 26px rgba(28, 117, 138, 0.08)"
}}
  className="dark:!bg-[#0B0B0B] dark:!border-gray-800 dark:!text-cyan-300 dark:shadow-none"
>
  Retrieve full details of a specific opportunity.
</div>

**Response:**

```json theme={null}
{
  "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"
}
```

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "rgba(48, 200, 202, 0.12)",
color: "#1C758A",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
border: "1px solid rgba(48, 200, 202, 0.28)"
}}
>
  Updates
</div>

## Update an Opportunity

```http theme={null}
PATCH /api/opportunities/{id}/
Authorization: Bearer <token>
Content-Type: application/json
```

<div
  style={{

border: "1px solid rgba(48, 200, 202, 0.22)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#2C768D",
boxShadow: "0 10px 26px rgba(28, 117, 138, 0.08)"
}}
  className="dark:!bg-[#0B0B0B] dark:!border-gray-800 dark:!text-cyan-300 dark:shadow-none"
>
  Update fields such as stage, probability, or outcome.
</div>

**Example — close a deal:**

```json theme={null}
{
  "stage": "closed_won",
  "closedDate": "2025-03-25",
  "probability": 100
}
```

**Example — log a loss:**

```json theme={null}
{
  "stage": "closed_lost",
  "lossReason": "Chose competitor — price was primary objection"
}
```

**Response:** `200 OK` with the updated opportunity object.

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "linear-gradient(90deg, #143D4E 0%, #1C758A 100%)",
color: "#FFFFFF",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
boxShadow: "0 8px 24px rgba(20, 61, 78, 0.18)"
}}
>
  Deletion
</div>

## Delete an Opportunity

```http theme={null}
DELETE /api/opportunities/{id}/
Authorization: Bearer <token>
```

<div
  style={{

border: "1px solid rgba(28, 117, 138, 0.18)",
borderRadius: "16px",
padding: "16px 18px",
marginBottom: "20px",
color: "#212121",
boxShadow: "0 10px 26px rgba(20, 61, 78, 0.07)"
}}
  className="dark:!bg-[#0B0B0B] dark:!border-gray-800 dark:!text-gray-200 dark:shadow-none"
>
  Permanently remove an opportunity.
</div>

**Response:** `204 No Content`

***

<div
  style={{ 
display: "inline-flex",
alignItems: "center",
gap: "8px",
background: "rgba(255, 111, 97, 0.12)",
color: "#FF6F61",
fontSize: "12px",
fontWeight: "700",
marginBottom: "10px",
padding: "8px 14px",
letterSpacing: "0.08em",
textTransform: "uppercase",
borderRadius: "999px",
border: "1px solid rgba(255, 111, 97, 0.24)"
}}
>
  Pipeline
</div>

## Pipeline Stage Values

<div
  style={{

border: "1px solid #CDD1D3",
borderRadius: "18px",
padding: "8px 12px 2px 12px",
marginBottom: "22px",
boxShadow: "0 10px 30px rgba(20, 61, 78, 0.05)"
}}
  className="dark:!bg-black dark:!border-gray-800 dark:shadow-none"
>
  | Value            | Label          |
  | ---------------- | -------------- |
  | `prospecting`    | Prospecting    |
  | `qualification`  | Qualification  |
  | `needs_analysis` | Needs Analysis |
  | `proposal`       | Proposal       |
  | `negotiation`    | Negotiation    |
  | `closed_won`     | Closed Won     |
  | `closed_lost`    | Closed Lost    |
</div>
