# Update sequence

Updates a sequence. Fields you leave out keep their current values.

```http
PATCH https://api.pozy.ai/v1/sequences/{sequenceId}
```

- Area: Automations / Sequences
- Auth: Authorization: Bearer pz_live_...

## Path parameters

- `sequenceId` (string, required)

## Request body

Content type: `application/json`

- `name`, string
- `description`, string
- `steps`, array of object
  - `order`, integer, required
  - `delayMinutes`, integer, required
  - `message`, object
    - `text`, string
  - `template`, object
    - `name`, string
    - `language`, string
    - `variableMapping`, map of object: Keys are free-form; each value has these fields
      - `field`, string: One of `name`, `phone`, `email`, `company`, `custom`
      - `customValue`, string
- `exitOnReply`, boolean
- `exitOnUnsubscribe`, boolean

## Example request

```bash
curl -X PATCH "https://api.pozy.ai/v1/sequences/67ea9094754757c09f3c81ba" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Acme",
  "description": "A short description",
  "steps": [
    {
      "order": 1,
      "delayMinutes": 1
    }
  ],
  "exitOnReply": true
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/sequences/67ea9094754757c09f3c81ba", {
  method: "PATCH",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Acme",
    description: "A short description",
    steps: [
      {
        order: 1,
        delayMinutes: 1
      }
    ],
    exitOnReply: true
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.patch(
    "https://api.pozy.ai/v1/sequences/67ea9094754757c09f3c81ba",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "name": "Acme",
        "description": "A short description",
        "steps": [
            {
                "order": 1,
                "delayMinutes": 1,
            },
        ],
        "exitOnReply": True,
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `success`, boolean
- `sequence`, object
  - `id`, string
  - `name`, string
  - `description`, string
  - `status`, string
  - `steps`, array of object
  - `exitOnReply`, boolean
  - `exitOnUnsubscribe`, boolean
  - `updatedAt`, string (date-time)

```json
{
  "success": true,
  "sequence": {
    "id": "6bfebd43ddc270f6d2c56fc5",
    "name": "Acme",
    "description": "A short description",
    "status": "active",
    "steps": [
      {}
    ],
    "exitOnReply": true,
    "exitOnUnsubscribe": true,
    "updatedAt": "2026-10-02T09:00:00.000Z"
  }
}
```
