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

# PATCH /v1/crm/pipelines/{pipeline_id}/stages/{stage_id}

> Rename a stage, or make it — or stop it being — a won or lost stage.

Renames a stage, or changes its `outcome`. Send either or both. Making a stage the pipeline's won (or lost) stage turns the stage that held that outcome into an ordinary one. Deals already in the stage keep their status; the outcome applies to deals moved in from now on.

<Note>Needs the `crm.pipelines:write` scope.</Note>

## Path parameters

| Field | Type | Required | Notes |
| :- | :- | :- | :- |
| `pipeline_id` | integer | Yes | The pipeline's id. |
| `stage_id` | integer | Yes | The stage's id, in this pipeline. |

## Body

| Field | Type | Required | Notes |
| :- | :- | :- | :- |
| `name` | string | No | Its new name. Up to 100 characters, and not a name another stage of this pipeline has. |
| `outcome` | string | No | `won` or `lost` to make it a closing stage; empty (`""`) to make it an ordinary stage. |

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH "https://api.fireflo.au/v1/crm/pipelines/3/stages/14" \
    -H "Authorization: Bearer $OMNI_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "name": "Order placed",
    "outcome": "won"
  }'
  ```

  ```python Python theme={null}
  import os

  import requests

  response = requests.patch(
      "https://api.fireflo.au/v1/crm/pipelines/3/stages/14",
      headers={"Authorization": f"Bearer {os.environ['OMNI_API_KEY']}"},
      json={
          "name": "Order placed",
          "outcome": "won"
      },
  )
  print(response.status_code, response.json())
  ```

  ```javascript Node theme={null}
  const response = await fetch("https://api.fireflo.au/v1/crm/pipelines/3/stages/14", {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.OMNI_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      "name": "Order placed",
      "outcome": "won"
    }),
  });
  console.log(response.status, await response.json());
  ```
</CodeGroup>

## Response

`200 OK` — the stage.

```json theme={null}
{
  "id": 14,
  "name": "Order placed",
  "order": 3,
  "outcome": "won"
}
```

## Errors

Every refusal is `{"error": {"code", "message", "field"}}`; `field` is there when one input is at fault.

| Status | Error code | When |
| :- | :- | :- |
| 400 | `invalid_request` | `name` is empty, too long or already a stage's in this pipeline, or `outcome` isn't `won`, `lost` or empty (`field` names it). |
| 404 | `not_found` | No pipeline of this account's has that id. |
| 404 | `not_found` | That pipeline has no stage with that id. |
| 404 | `module_off` | The account doesn't have Pipelines on. |
| 403 | `scope_missing` | The key doesn't have the `crm.pipelines:write` scope. |

Any request can also be refused for its key, its account or its rate (`key_required`, `invalid_key`, `account_suspended`, `plan_excludes_api`, `address_not_allowed`, `rate_limited`); see [the overview](/api-reference/overview).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.