---
title: Manage pipelines and stages | Lightfield
description: Create, update and delete pipelines and their stages through the REST API, and preview how many records a change clears.
---

The pipeline write endpoints are in beta and aren’t available to every workspace yet. Endpoints, parameters, and response schemas may change, including breaking changes. To read pipeline settings, use the object type’s definitions endpoint with its read scope.

Use the Pipelines API to create, change and delete the pipelines on accounts, contacts, opportunities and custom objects. A pipeline holds its stages in display order, and a record in the pipeline holds one stage’s ID in `$stage`. To move a record between stages, write `$stage` as described in [Pipelines and stages](/using-the-api/fields-and-relationships/index.md#pipelines-and-stages). For how pipelines and stage categories work in the app, see [Pipelines](/help/settings/pipelines/index.md).

## Before you start

Each request needs the object type’s read scope: `accounts:read`, `contacts:read`, `opportunities:read`, or `custom_objects:read` for a custom object. Writes also need `config:create` to create, `config:update` to update or `config:delete` to delete. If you don’t see the required scope in **Settings → API keys**, you can’t select it when creating a new scoped key. See [Scopes](/using-the-api/scopes/index.md).

Creating, updating and deleting also need an API key created by a workspace owner or admin who still has that role. A workspace key’s creator must also have been an owner or admin when they created it. Otherwise the write returns `403`.

Each object type has its own three operations:

| Object type    | Path                                 | Operations                                                                                                                                                                                                       |
| -------------- | ------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Accounts       | `/v1/accounts/pipelines`             | [Create](/api/resources/account/methods/createPipeline/index.md), [update](/api/resources/account/methods/updatePipeline/index.md), [delete](/api/resources/account/methods/deletePipeline/index.md)             |
| Contacts       | `/v1/contacts/pipelines`             | [Create](/api/resources/contact/methods/createPipeline/index.md), [update](/api/resources/contact/methods/updatePipeline/index.md), [delete](/api/resources/contact/methods/deletePipeline/index.md)             |
| Opportunities  | `/v1/opportunities/pipelines`        | [Create](/api/resources/opportunity/methods/createPipeline/index.md), [update](/api/resources/opportunity/methods/updatePipeline/index.md), [delete](/api/resources/opportunity/methods/deletePipeline/index.md) |
| Custom objects | `/v1/objects/{entitySlug}/pipelines` | [Create](/api/resources/object/methods/createPipeline/index.md), [update](/api/resources/object/methods/updatePipeline/index.md), [delete](/api/resources/object/methods/deletePipeline/index.md)                |

## Read pipelines

Read an object type’s pipelines and stages from its [definitions](/using-the-api/fields-and-relationships/index.md#discover-pipelines-and-their-stages). Each `$pipeline` option is a pipeline: its `id`, `slug`, `forecastEnabled` and `description`, with the pipeline’s name in `label`. Each `$stage` option is a stage, and its `parentId` is the `id` of the pipeline that holds it. A stage’s `id` is the option ID records hold in `$stage`.

Update and delete address one pipeline by its `id` (`pd_…`) or its `slug`. Pipelines Lightfield set up for you have a `$` slug, such as `$default-pipeline`. A pipeline on another object type returns `404`.

An archived custom object’s pipelines can still be read, by adding `includeArchived=true` to its definitions request, and deleted, but not created or updated.

## Create a pipeline

[Create a pipeline](/api/resources/opportunity/methods/createPipeline/index.md) needs a `name` that no other pipeline on the object type has. Each stage needs `label`, `color`, `icon` and `category` (`ACTIVE` or `COMPLETED`); the reference lists the accepted colors and icons. `forecastPercentage`, from 0 to 100, is allowed only when `forecastEnabled` is `true`.

Terminal window

```
curl https://api.lightfield.app/v1/opportunities/pipelines \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LIGHTFIELD_API_KEY" \
  -H "Lightfield-Version: 2026-03-01" \
  -d '{
    "name": "Renewals",
    "slug": "renewals",
    "forecastEnabled": true,
    "stages": [
      { "id": "opt_renewal-review", "label": "Review", "color": "BLUE", "icon": "QUALIFICATION", "category": "ACTIVE", "forecastPercentage": 50 },
      { "label": "Renewed", "color": "GREEN", "icon": "CLOSED_WON", "category": "COMPLETED", "forecastPercentage": 100 },
      { "label": "Churned", "color": "RED", "icon": "CLOSED_LOST", "category": "COMPLETED", "forecastPercentage": 0 }
    ]
  }'
```

The response is the pipeline, with its stages in display order:

```
{
  "id": "pd_7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "slug": "renewals",
  "name": "Renewals",
  "description": null,
  "forecastEnabled": true,
  "stages": [
    {
      "id": "opt_renewal-review",
      "label": "Review",
      "description": null,
      "color": "BLUE",
      "icon": "QUALIFICATION",
      "category": "ACTIVE",
      "forecastPercentage": 50
    }
  ]
}
```

This excerpt shows the first stage. A stage sent without an `id` gets a random UUIDv4, returned as `opt_` followed by the UUID. To choose a stage’s ID yourself, send `opt_` followed by a UUID in any letter case, or by groups of lowercase letters and digits separated by single hyphens or underscores, such as `opt_renewal-review`. Stage IDs must be unique across the object type’s pipelines, ignoring case, hyphens and underscores.

Choose your own stage IDs when another system refers to these stages, so the mapping stays readable; otherwise let Lightfield assign them. `slug` is fixed once the pipeline exists, and is derived from `name` if you leave it out. Send one so you can find the pipeline again: a create retried after a lost response returns `409`, because the name and slug are taken, and you can look for its slug among the `$pipeline` options in definitions to confirm the first request succeeded.

## Update a pipeline

[Update a pipeline](/api/resources/opportunity/methods/updatePipeline/index.md) changes only the properties you send. `stages` is different: it’s the full stage list, in the order you want it displayed.

- A stage you keep is matched by its `id`. Properties you leave out are kept, so `{ "id": "opt_renewal-review" }` keeps a stage as it is in its new position.
- An entry with an `id` the pipeline doesn’t have creates a stage with that ID, and needs `label`, `color`, `icon` and `category`, as on create.
- An entry with no `id` creates a new stage every time the request is sent. Give new stages your own IDs if you might retry the request.
- An existing stage left out of the list is deleted, which clears it from every record that holds it. That needs `force=true`, described below.

This request renames the first stage and adds a stage before the two completed ones, which keep the IDs create assigned them:

Terminal window

```
curl https://api.lightfield.app/v1/opportunities/pipelines/renewals \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LIGHTFIELD_API_KEY" \
  -H "Lightfield-Version: 2026-03-01" \
  -d '{
    "stages": [
      { "id": "opt_renewal-review", "label": "In review" },
      { "id": "opt_renewal-quote", "label": "Quote sent", "color": "INDIGO", "icon": "NEGOTIATION", "category": "ACTIVE", "forecastPercentage": 75 },
      { "id": "opt_9d1f6c4e-2b7a-4f0e-8c3d-5a6b7e8f9a01" },
      { "id": "opt_3b2a1c0d-9e8f-4a7b-8c6d-5e4f3a2b1c0d" }
    ]
  }'
```

Setting `forecastEnabled` to `false` clears every stage’s forecast. To clear `description` on the pipeline or a stage, send `null`; an empty string returns `422`.

### Confirm or preview stage deletions

If `stages` leaves out an existing stage, the update returns `409` and changes nothing. The message names each stage it would delete:

```
{
  "error": {
    "type": "conflict",
    "message": "This update would delete the following pipeline stages and clear them from any records that use them: \"Churned\" (opt_3b2a1c0d-9e8f-4a7b-8c6d-5e4f3a2b1c0d). To confirm, send the same request with force=true."
  }
}
```

Before confirming, preview how many records would lose their stage. Add `dryRun=true` with `force=true`; `dryRun` alone still returns the `409`. A dry run runs every check and changes nothing:

Terminal window

```
curl "https://api.lightfield.app/v1/opportunities/pipelines/renewals?dryRun=true&force=true" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LIGHTFIELD_API_KEY" \
  -H "Lightfield-Version: 2026-03-01" \
  -d '{ "stages": [{ "id": "opt_renewal-review" }, { "id": "opt_renewal-quote" }, { "id": "opt_9d1f6c4e-2b7a-4f0e-8c3d-5a6b7e8f9a01" }] }'
```

```
{ "affectedRecordCount": 4 }
```

Send the same request without `dryRun` to delete the stages. The records stay; their stage is cleared, and they’re no longer in any pipeline.

## Delete a pipeline

[Delete a pipeline](/api/resources/opportunity/methods/deletePipeline/index.md) removes it and its stages and clears the stage on every record in it. It can’t be undone. Automations and saved filters that refer to the pipeline are left as they are, so check them afterwards. Preview the impact first with `dryRun=true`:

Terminal window

```
curl -X DELETE "https://api.lightfield.app/v1/opportunities/pipelines/renewals?dryRun=true" \
  -H "Authorization: Bearer $LIGHTFIELD_API_KEY" \
  -H "Lightfield-Version: 2026-03-01"
```

```
{ "affectedRecordCount": 12 }
```

Without `dryRun`, the response has the same shape and reports the records that were cleared. Deleting the pipeline again returns `404`.

## When a write is refused

A refused write changes nothing.

| Status | `code`                                | What to do                                                                                                                                                                                                                                                                                                     |
| ------ | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `403`  | `crm.pipeline.configuration_disabled` | The workspace’s plan doesn’t include multiple pipelines. Without it, the only write allowed is an update to the default opportunity pipeline.                                                                                                                                                                  |
| `403`  | None                                  | The key lacks a required scope, or its creator isn’t an owner or admin. See [Before you start](#before-you-start).                                                                                                                                                                                             |
| `409`  | `crm.pipeline.name_taken`             | Another pipeline on the object type has that name. Choose another, or send again once the other pipeline is renamed or deleted.                                                                                                                                                                                |
| `409`  | `crm.pipeline.slug_taken`             | Another pipeline on the object type has that slug. After a retried create, this can mean your first request succeeded; look for its slug in definitions.                                                                                                                                                       |
| `409`  | `crm.pipeline.stage_id_taken`         | A stage ID matches one on another pipeline of the object type, ignoring case, hyphens and underscores, or newly matches another stage’s label. Choose another ID.                                                                                                                                              |
| `409`  | None                                  | The update leaves out existing stages. [Confirm or preview](#confirm-or-preview-stage-deletions) with `force=true`.                                                                                                                                                                                            |
| `422`  | None                                  | The request needs a change, and `message` says which: for example, a stage ID in the wrong format, a new stage missing a required property, or a forecast while `forecastEnabled` is `false`. Deleting a pipeline or stage that conditional fields use is also refused; remove it from those conditions first. |
| `429`  | None                                  | Another request was changing the same configuration. Send the request again.                                                                                                                                                                                                                                   |

The error format is described in [Errors](/using-the-api/errors/index.md#error-response-format).
