> For the complete documentation index, see [llms.txt](https://teamleader-sdk.mcore-services.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teamleader-sdk.mcore-services.dev/api-reference/deals/deal-pipelines.md).

# Deal Pipelines

Manage deal pipelines in Teamleader Focus.

```php
Teamleader::dealPipelines()
```

|                          |                                                                       |
| ------------------------ | --------------------------------------------------------------------- |
| Class                    | `McoreServices\TeamleaderSDK\Resources\Deals\Pipelines`               |
| Create / update / delete | ✓ / ✓ / ✓                                                             |
| Pagination               | `page_size` / `page_number`; the response includes `meta` with totals |

## Endpoints

* `dealPipelines.create`
* `dealPipelines.delete`
* `dealPipelines.duplicate`
* `dealPipelines.list`
* `dealPipelines.markAsDefault`
* `dealPipelines.update`

## Filters

Passed as the first argument to `list()`. Any other key throws.

| Filter   | Description                                                                             |
| -------- | --------------------------------------------------------------------------------------- |
| `ids`    | Array of deal pipeline UUIDs to filter by                                               |
| `status` | Filter by pipeline status (open, pending\_deletion) — a string is wrapped into an array |
| `term`   | Search the pipeline name                                                                |

## Accepted values

Public constants on the class. Body fields and enum values outside these lists throw before the request is sent.

| Constant   | Values                     |
| ---------- | -------------------------- |
| `STATUSES` | `open`, `pending_deletion` |

## Methods

### `list()`

```php
list(array $filters = [], array $options = []): array
```

List deal pipelines with enhanced filtering and pagination

* `$filters` — Filters to apply
* `$options` — Additional options (pagination, includes)

### `create()`

```php
create(array $data): array
```

Create a new deal pipeline

* `$data` — Pipeline data

### `update()`

```php
update($id, array $data): array
```

Update a deal pipeline

* `$id` — Pipeline UUID
* `$data` — Update data

### `delete()`

```php
delete($id, ...$additionalParams): array
```

Delete a deal pipeline, optionally migrating its phases

Deals in the deleted pipeline's phases are moved to the phases named in $migratePhases, each entry being \['old\_phase\_id' => ..., 'new\_phase\_id' => ...].

* `$id` — Pipeline UUID to delete
* `$additionalParams` — Expects an array of phase migrations as the first param

**Throws** `InvalidArgumentException` When the migration argument is not an array

### `duplicate()`

```php
duplicate(string $id): array
```

Duplicate an existing deal pipeline

* `$id` — Source pipeline UUID

### `markAsDefault()`

```php
markAsDefault(string $id): array
```

Mark a pipeline as default

* `$id` — Pipeline UUID

### `open()`

```php
open(): array
```

Get only open pipelines

### `search()`

```php
search(string $term, array $options = []): array
```

Search pipelines by name

### `pendingDeletion()`

```php
pendingDeletion(): array
```

Get pipelines pending deletion

### `byIds()`

```php
byIds(array $ids): array
```

Get pipelines by specific IDs

* `$ids` — Array of pipeline UUIDs

### `getAvailableStatuses()`

```php
getAvailableStatuses(): array
```

Get available status values for filtering
