# Pipeline & Deal Endpoints {#pipeline--deal-endpoints}


Manage sales pipelines with multiple stages and deals that progress through the pipeline.


## Base Paths {#base-paths}


| Resource  | Path             |
| --------- | ---------------- |
| Pipelines | `/api/pipelines` |
| Deals     | `/api/deals`     |


## Pipeline Endpoints {#pipeline-endpoints}



### List Pipelines (Paginated) {#list-pipelines-paginated}


```
GET /api/pipelines/pagination
Authorization: Bearer {token}
```


### Find All Pipelines {#find-all-pipelines}


```
GET /api/pipelines
Authorization: Bearer {token}
```


### Get Pipeline by ID {#get-pipeline-by-id}


```
GET /api/pipelines/:id
Authorization: Bearer {token}
```


### Get Pipeline Deals {#get-pipeline-deals}


Retrieves all deals associated with a specific pipeline.

```
GET /api/pipelines/:pipelineId/deals
Authorization: Bearer {token}
```


### Create Pipeline {#create-pipeline}


```
POST /api/pipelines
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "Enterprise Sales",
  "description": "Pipeline for enterprise deals",
  "organizationId": "uuid",
  "stages": [
    { "name": "Prospecting", "index": 0 },
    { "name": "Qualification", "index": 1 },
    { "name": "Proposal", "index": 2 },
    { "name": "Negotiation", "index": 3 },
    { "name": "Closed Won", "index": 4 }
  ]
}
```


### Update Pipeline {#update-pipeline}


```
PUT /api/pipelines/:id
Authorization: Bearer {token}
Content-Type: application/json

{
  "name": "Updated Pipeline Name"
}
```


### Delete Pipeline {#delete-pipeline}


```
DELETE /api/pipelines/:id
Authorization: Bearer {token}
```


## Deal Endpoints {#deal-endpoints}



### List Deals {#list-deals}


```
GET /api/deals
Authorization: Bearer {token}
```


### Get Deal by ID {#get-deal-by-id}


```
GET /api/deals/:id
Authorization: Bearer {token}
```


### Create Deal {#create-deal}


```
POST /api/deals
Authorization: Bearer {token}
Content-Type: application/json

{
  "title": "Acme Corp Enterprise License",
  "stageId": "stage-uuid",
  "clientId": "contact-uuid",
  "probability": 75
}
```


### Update Deal {#update-deal}


```
PUT /api/deals/:id
Authorization: Bearer {token}
Content-Type: application/json

{
  "stageId": "next-stage-uuid",
  "probability": 90
}
```


### Delete Deal {#delete-deal}


```
DELETE /api/deals/:id
Authorization: Bearer {token}
```


## Data Model {#data-model}


```typescript
interface IPipeline {
  id: string;
  name: string;
  description?: string;
  isActive: boolean;
  stages?: IPipelineStage[];
  organizationId: string;
  tenantId: string;
}

interface IPipelineStage {
  id: string;
  name: string;
  index: number;
  description?: string;
  pipelineId: string;
  deals?: IDeal[];
}

interface IDeal {
  id: string;
  title: string;
  probability?: number;
  stageId: string;
  stage?: IPipelineStage;
  clientId?: string;
  client?: IOrganizationContact;
  createdByUserId?: string;
  tenantId: string;
}
```


## Pipeline Flow {#pipeline-flow}






```mermaid
graph LR
    A[Prospecting] --> B[Qualification]
    B --> C[Proposal]
    C --> D[Negotiation]
    D --> E[Closed Won]
    D --> F[Closed Lost]
```






## Permissions {#permissions}


| Action             | Required Permission    |
| ------------------ | ---------------------- |
| View pipelines     | `VIEW_SALES_PIPELINES` |
| Create/edit/delete | `EDIT_SALES_PIPELINES` |


## Related Pages {#related-pages}


- [Sales Pipelines Feature](https://sourcey-gauzy.pages.dev/features/sales-pipelines/index.md) — feature guide
- [Contact Endpoints](https://sourcey-gauzy.pages.dev/api/contact-endpoints/index.md) — CRM contacts
- [CRM Overview](https://sourcey-gauzy.pages.dev/features/crm-overview/index.md) — CRM module
