---
title: "Edit or switch an automation on or off"
method: PATCH
path: "/api/v1/automations/{id}"
---

# Edit or switch an automation on or off

`PATCH /api/v1/automations/{id}`

## Request

- Base URL: `http://127.0.0.1:4310`
- URL: `http://127.0.0.1:4310/api/v1/automations/{id}`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `sfb_session`

## Path parameters

- `id` string, required

## Request body

- object
  - `name` string
  - `channel` 'email' | 'sms' | 'whatsapp'
  - `enabled` boolean
  - `after_weeks` integer
  - `lapsed_days` integer
  - `service_ids` string[]
  - `subject` string
  - `preview_text` string
  - `body` string: Plain text. Merge fields: {{first_name}}, {{client_name}}, {{business_name}}, {{booking_link}}, {{last_service}}
  - `expected_version` integer

## Response `200`

OK

- object

## Other responses

- `400`: Validation error
- `401`: Unauthenticated
- `403`: Forbidden
- `404`: Not found
- `409`: Conflict or invalid state

---

[API](https://skmtc.dev/scalingfirm/apis/tsf-booking-api.md) · [All operations](https://skmtc.dev/scalingfirm/apis/tsf-booking-api/llms.txt) · [OpenAPI document](https://skmtc.dev/scalingfirm/apis/tsf-booking-api/revisions/81704199cd37?raw)
