---
title: "Получить правила автоматизаций кабинета"
method: GET
path: "/api/v1/automation/rules"
tags: ["Automation"]
---

# Получить правила автоматизаций кабинета

`GET /api/v1/automation/rules`

## Request

- Base URL: `https://erp.akeda.ru`
- URL: `https://erp.akeda.ru/api/v1/automation/rules`
- Auth: one of:
  - HTTP bearer
  - OAuth 2 (authorization code, authorization URL `https://erp.akeda.ru/oauth2/authorize`, token URL `https://erp.akeda.ru/oauth2/token`, scopes: `akeda:delegate`)

Правила кабинета документами «когда → если → то» в той же форме, что
сохраняет конструктор: событие, условие сравнениями, действия со
входами, исполнитель, включено ли, версия. Ассистент смотрит их, прежде
чем предложить новое правило, — чтобы не собрать второе такое же.
Только чтение.

## Headers

- `X-Tenant` string, required

## Response `200`

Правила кабинета

- object
  - `rules` AutomationRuleDocument[], required
    - `id` string, uuid, required
    - `name` string, required
    - `event_type` string, required
    - `condition` string, required: Выражение вычислителя; у правила из конструктора собрано из conditions
    - `conditions` object[], required
      - `field` string, required
      - `op` string, required
      - `value` string
      - `value_to` string
      - `of` string
      - `group` integer
    - `actions` AutomationRuleBlock[], required: Путь «Если да»: действия и паузы по порядку (ERP-1932)
      - `id` string
      - `kind` 'action' | 'wait': Пусто — действие
      - `command` string
      - `inputs` object
      - `wait` object: Пауза: after_event — через amount единиц unit от начала паузы; relative_to_field — до даты поля field (± amount); cancel_on — события, факт которых по той же записи прекращает правило
        - `kind` 'after_event' | 'relative_to_field'
        - `amount` integer
        - `unit` 'minutes' | 'hours' | 'days' | 'working_days'
        - `direction` 'before' | 'after'
        - `field` string
        - `at` string
        - `cancel_on` string[]
    - `branches` AutomationRuleBranch[]: «Если ещё …»: до трёх путей со своим условием, проверяются по порядку
      - `id` string
      - `condition` string: Выражение, собранное сервером из conditions
      - `conditions` object[], required
        - `field` string, required
        - `op` string, required
        - `value` string
        - `value_to` string
        - `of` string
        - `group` integer
      - `actions` AutomationRuleBlock[], required
        - `id` string
        - `kind` 'action' | 'wait': Пусто — действие
        - `command` string
        - `inputs` object
        - `wait` object: Пауза: after_event — через amount единиц unit от начала паузы; relative_to_field — до даты поля field (± amount); cancel_on — события, факт которых по той же записи прекращает правило
          - `kind` 'after_event' | 'relative_to_field'
          - `amount` integer
          - `unit` 'minutes' | 'hours' | 'days' | 'working_days'
          - `direction` 'before' | 'after'
          - `field` string
          - `at` string
          - `cancel_on` string[]
    - `otherwise` AutomationRuleBlock[]: «Иначе»: блоки, когда не подошло ни одно условие; пусто — правило промолчит
      - `id` string
      - `kind` 'action' | 'wait': Пусто — действие
      - `command` string
      - `inputs` object
      - `wait` object: Пауза: after_event — через amount единиц unit от начала паузы; relative_to_field — до даты поля field (± amount); cancel_on — события, факт которых по той же записи прекращает правило
        - `kind` 'after_event' | 'relative_to_field'
        - `amount` integer
        - `unit` 'minutes' | 'hours' | 'days' | 'working_days'
        - `direction` 'before' | 'after'
        - `field` string
        - `at` string
        - `cancel_on` string[]
    - `after_rule_id` string: Очередь (ERP-1613): правило ждёт, пока выполнится правило с этим id на тот же факт; пусто — сразу
    - `doc_version` integer: Версия языка документа правила (rule.schema.json); 2 — пути, паузы и результаты шагов
    - `executor_user_id` integer, required
    - `is_enabled` boolean, required
    - `origin` 'manual' | 'configuration', required
    - `version` integer, required
    - `created_by` integer
    - `created_at` string, date-time
    - `updated_at` string, date-time

## Other responses

- `401`: Сессия, ключ или кабинет не подтверждены
- `403`: Текущая роль не имеет требуемого права

---

[API](https://skmtc.dev/akeda/apis/akeda-erp-client-api.md) · [All operations](https://skmtc.dev/akeda/apis/akeda-erp-client-api/llms.txt) · [OpenAPI document](https://skmtc.dev/akeda/apis/akeda-erp-client-api/revisions/3c60ded179f2?raw)
