# Pipelines

Manage sales pipelines and their stages. Opportunities move through pipeline stages to track progress.

**Base URL:** `https://api.trustpager.com/functions/v1/api/v1`

## Endpoints

### GET /pipelines

List all pipelines.

**Scopes:** `pipelines:read` — [full detail](./pipelines/get-pipelines.md)

### GET /pipelines/:id

Retrieve a pipeline with its stages.

**Scopes:** `pipelines:read` — [full detail](./pipelines/get-pipelines-id.md)

### POST /pipelines

Create a new pipeline. name is required.

**Scopes:** `pipelines:write` — [full detail](./pipelines/post-pipelines.md)

### PATCH /pipelines/:id

Update a pipeline.

**Scopes:** `pipelines:write` — [full detail](./pipelines/patch-pipelines-id.md)

### DELETE /pipelines/:id

Delete a pipeline.

**Scopes:** `pipelines:write` — [full detail](./pipelines/delete-pipelines-id.md)

### GET /pipelines/:id/stages

List stages for a pipeline, ordered by position. Each stage includes a deal_count field (number of opportunities currently in that stage -- field name preserved for backward compatibility) so Kanban column headers can render counts without a second query.

**Scopes:** `pipelines:read` — [full detail](./pipelines/get-pipelines-id-stages.md)

### POST /pipelines/:id/stages

Add a stage to a pipeline.

**Scopes:** `pipelines:write` — [full detail](./pipelines/post-pipelines-id-stages.md)

### PATCH /pipelines/:id/stages/:stageId

Update a pipeline stage.

**Scopes:** `pipelines:write` — [full detail](./pipelines/patch-pipelines-id-stages-stageId.md)

### DELETE /pipelines/:id/stages/:stageId

Delete a pipeline stage.

**Scopes:** `pipelines:write` — [full detail](./pipelines/delete-pipelines-id-stages-stageId.md)

### GET /pipelines/:id/deals

DEPRECATED -- prefer GET /opportunities?pipeline_id=X (legacy alias: GET /deals?pipeline_id=X). The /opportunities endpoint returns the same data plus full pipeline placements on every opportunity and supports additional filters (stage_id, status, search, pagination). This endpoint now also attaches placements for backward compatibility but may be removed in a future version.

**Scopes:** `pipelines:read`, `opportunities:read` — [full detail](./pipelines/get-pipelines-id-deals.md)

### GET /pipelines/:id/summary

Get pipeline summary with opportunity counts and values per stage.

**Scopes:** `pipelines:read` — [full detail](./pipelines/get-pipelines-id-summary.md)
