---
title: "Replace automation"
method: PUT
path: "/api/v1/automations/{id}"
tags: ["Automations"]
---

# Replace automation

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

Replaces an automation definition when `If-Match` matches the current automation revision.

## Path parameters

- `id` string, required

## Headers

- `If-Match` string, required

## Request body

- ReplaceAutomationRequest — Request body for replacing an automation.
  - `name` string, required
  - `description` string, nullable
  - `target` AutomationTarget, required — Repository and workflow selected by an automation.
    - `repository` string, required — GitHub repository slug in `owner/repo` form.
    - `ref` string, required — Branch, tag, or SHA selector resolved when materializing a run.
    - `workflow` string, required — Workflow slug or path resolved in the target repository.
  - `triggers` AutomationTrigger[], required
    - union — Automation trigger configuration. Unknown `type` discriminator values are reported by handlers as domain validation errors with HTTP 422.
      - AutomationApiTrigger — Trigger that allows callers to create runs through the automation API.
        - `id` string, required
        - `type` 'api', required
        - `enabled` boolean, required
      - AutomationScheduleTrigger — Cron schedule trigger evaluated in UTC.
        - `id` string, required
        - `type` 'schedule', required
        - `enabled` boolean, required
        - `expression` string, required — Five-field cron expression evaluated in UTC.

## Response `200`

Automation replaced

- Automation — Public automation definition.
  - `id` string, required
  - `revision` string, required — Stable revision used with `If-Match` for optimistic concurrency.
  - `name` string, required
  - `description` string, nullable, required
  - `target` AutomationTarget, required — Repository and workflow selected by an automation.
    - `repository` string, required — GitHub repository slug in `owner/repo` form.
    - `ref` string, required — Branch, tag, or SHA selector resolved when materializing a run.
    - `workflow` string, required — Workflow slug or path resolved in the target repository.
  - `triggers` AutomationTrigger[], required
    - union — Automation trigger configuration. Unknown `type` discriminator values are reported by handlers as domain validation errors with HTTP 422.
      - AutomationApiTrigger — Trigger that allows callers to create runs through the automation API.
        - `id` string, required
        - `type` 'api', required
        - `enabled` boolean, required
      - AutomationScheduleTrigger — Cron schedule trigger evaluated in UTC.
        - `id` string, required
        - `type` 'schedule', required
        - `enabled` boolean, required
        - `expression` string, required — Five-field cron expression evaluated in UTC.

## Other responses

- `400` — Malformed JSON request body or invalid revision header
- `404` — Automation not found
- `409` — Automation revision mismatch
- `422` — Automation failed domain validation
- `428` — Missing required `If-Match` header

---

[API](https://skmtc.net/fabro-sh/apis/fabro-run-api.md) · [All operations](https://skmtc.net/fabro-sh/apis/fabro-run-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/fabro-sh/fabro-run-api/versions/bee030053823/schema)
