---
title: "Create / edit a routine"
locale: en
url: https://tlg.builera.app/en/docs/reference/rest/routines.save
verified: 2026-10-24
app_version: "2.0"
generated: true
---

# Create / edit a routine

A repeat — { kind: weekly, times: ["08:00"], days: [1..5] } or { kind: every, hours: N } in each account's own timezone — that runs a sequence of steps for the chosen accounts / tags. Steps are like sequences_run but the account field is filled in per account (only per-account, non-dangerous operations, waits and event waits). Slots outside an account's run hours are skipped when it follows its schedule. Updating needs expectedRevision.

A repeat — { kind: weekly, times: ["08:00"], days: [1..5] } or { kind: every, hours: N } in each account's own timezone — that runs a sequence of steps for the chosen accounts / tags. Steps are like sequences_run but the account field is filled in per account (only per-account, non-dangerous operations, waits and event waits). Slots outside an account's run hours are skipped when it follows its schedule. Updating needs expectedRevision.

## Overview

| Name | Value |
| --- | --- |
| Code | `routines.save` |
| Scope needed | `automation.write` |
| Risk | Write |
| May need confirmation | No |
| Runs as | Answers right away |
| Needs `Idempotency-Key` | No |
| Member roles allowed | `owner`, `manager` |
| In the app | Automation → Routines → Save |

## Input fields

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `uuid` | No |   |
| `name` | `text` | Yes |   |
| `enabled` | `true/false` | No |   |
| `schedule` | `object` | Yes |   |
| `target` | `object` | Yes |   |
| `steps` | `object[]` | Yes |   |
| `expectedRevision` | `integer` | No |   |

## Example request

```bash
curl -X POST https://tlg.builera.app/api/public/v2/ops/routines.save \
  -H "Authorization: Bearer $TELEGRAM_AUTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"…","schedule":"…","target":"…","steps":[]}'
```

## Output fields (`data`)

| Field | Type | Required |
| --- | --- | --- |
| `ok` | `true` | Yes |
| `id` | `text` | Yes |
| `revision` | `null \| number` | Yes |

## Example answer

```json
{
  "data": {
    "ok": true,
    "id": "00000000-0000-4000-8000-000000000000",
    "revision": 1
  }
}
```

## Using it over MCP

Not listed on any profile: call `tools_describe` then `tools_run` with `code: "routines.save"`. Tool name when listed: `routines_save`.
