# Change a sequence. A running sequence is paused and needs approving again

`PUT /crm/sequences/{id}` · Rivier · campaigns

Change a sequence. A running sequence is paused and needs approving again.

- Scope: campaigns:write
- Graphql: Mutation.campaignsSequenceUpdate
- Sdk: campaigns.sequence.update
- Cli: campaigns sequence update

## Parameters

- `id` (path, required), string

## Request body

`application/json`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 160
    },
    "agentId": {
      "type": "string",
      "minLength": 1,
      "maxLength": 120
    },
    "audience": {
      "type": "string",
      "minLength": 3,
      "maxLength": 300
    },
    "purpose": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{0,29}$",
      "default": "outreach"
    },
    "steps": {
      "type": "array",
      "items": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,39}$"
              },
              "type": {
                "type": "string",
                "const": "email"
              },
              "brief": {
                "type": "string",
                "minLength": 8,
                "maxLength": 1500
              },
              "waitDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 120,
                "default": 0
              }
            },
            "required": [
              "id",
              "type",
              "brief"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,39}$"
              },
              "type": {
                "type": "string",
                "const": "sms"
              },
              "brief": {
                "type": "string",
                "minLength": 8,
                "maxLength": 1500
              },
              "waitDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 120,
                "default": 0
              }
            },
            "required": [
              "id",
              "type",
              "brief"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,39}$"
              },
              "type": {
                "type": "string",
                "const": "whatsapp"
              },
              "brief": {
                "type": "string",
                "minLength": 8,
                "maxLength": 1500
              },
              "waitDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 120,
                "default": 0
              },
              "templateId": {
                "type": "string",
                "format": "uuid"
              }
            },
            "required": [
              "id",
              "type",
              "brief"
            ],
            "additionalProperties": false
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "pattern": "^[a-z][a-z0-9_]{0,39}$"
              },
              "type": {
                "type": "string",
                "const": "call"
              },
              "brief": {
                "type": "string",
                "minLength": 8,
                "maxLength": 1500
              },
              "waitDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 120,
                "default": 0
              }
            },
            "required": [
              "id",
              "type",
              "brief"
            ],
            "additionalProperties": false
          }
        ]
      },
      "minItems": 1,
      "maxItems": 12
    },
    "window": {
      "type": "object",
      "properties": {
        "days": {
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
          },
          "minItems": 1,
          "maxItems": 7,
          "default": [
            1,
            2,
            3,
            4,
            5
          ]
        },
        "from": {
          "type": "string",
          "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
          "default": "09:00"
        },
        "to": {
          "type": "string",
          "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
          "default": "17:00"
        },
        "timezone": {
          "type": "string",
          "maxLength": 60
        }
      },
      "additionalProperties": false,
      "default": {
        "days": [
          1,
          2,
          3,
          4,
          5
        ],
        "from": "09:00",
        "to": "17:00"
      }
    },
    "limits": {
      "type": "object",
      "properties": {
        "perDay": {
          "type": "integer",
          "minimum": 1,
          "maximum": 5000,
          "default": 50
        },
        "perDomainPerDay": {
          "type": "integer",
          "minimum": 1,
          "maximum": 500,
          "default": 3
        }
      },
      "additionalProperties": false,
      "default": {
        "perDay": 50,
        "perDomainPerDay": 3
      }
    },
    "approval": {
      "type": "string",
      "enum": [
        "person",
        "rule"
      ],
      "default": "person"
    }
  },
  "required": [
    "name",
    "audience",
    "steps"
  ],
  "additionalProperties": false
}
```

## Responses

- `200`: Success
- `400`: The request was malformed
- `401`: No valid credential
- `403`: The credential lacks the scope, origin or address
- `429`: Over the key's rate limit; see Retry-After

## Example

```sh
curl -X PUT 'https://api.rivier.ai/crm/sequences/{id}' \
  -H 'Authorization: Bearer $KEY' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "audience": "string",
  "steps": [
    {
      "id": "string",
      "type": "email",
      "brief": "string"
    }
  ]
}'
```
