---
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

## Changes

- **2026-05-30** `57aaacdfd18e` — 1 breaking, 1 warning
  - removed the required property `enabled` from the response with the `200` status
  - removed the request property `enabled`
- **2026-05-27** `5111129c5643` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/fabro-sh/apis/fabro-run-api/changes/api/v1/automations/:id/put.md)

---

[API](https://skmtc.dev/fabro-sh/apis/fabro-run-api.md) · [All operations](https://skmtc.dev/fabro-sh/apis/fabro-run-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/fabro-sh/fabro-run-api/revisions/57aaacdfd18e/schema)
