---
title: "Create automation"
method: POST
path: "/api/v1/automations"
tags: ["Automations"]
---

# Create automation

`POST /api/v1/automations`

Creates a new automation definition.

## Request body

- CreateAutomationRequest — Request body for creating an automation.
  - `id` string, required
  - `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 `201`

Automation created

- 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
- `409` — Automation id already exists
- `422` — Automation failed domain validation

---

[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/revisions/52f1d8aaf083/schema)
