---
title: "Publish a revision"
method: POST
path: "/v1/automations/{automationId}/revisions"
tags: ["Automations"]
---

# Publish a revision

`POST /v1/automations/{automationId}/revisions`

## Request

- Base URL: `https://api.banksync.io`
- URL: `https://api.banksync.io/v1/automations/{automationId}/revisions`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer

Publish the draft as an immutable revision and request its grant. Runs use it at once — except on an automation that is on under an approved grant: there it waits (`live: false`) until a member approves its grant, and the revision that runs stays. Refused while the draft or its grant request has blocking findings; publishing an unchanged draft answers the same revision. A `requested` grant is approved by a workspace owner or admin in the app, at `grant.approveAt`; an API key cannot approve it.

## Path parameters

- `automationId` string, required: Automation ID

## Headers

- `Idempotency-Key` string: Makes a retry safe: the same key with the same request replays the first answer for 24 hours instead of running twice, and the same key with a different request is a 409 `IDEMPOTENCY_KEY_REUSED`. Refusals a retry can outlive — 408, 409, 423, 425, 429 and every 5xx — are never replayed, so retrying with the same key after the cause clears runs the request.

## Response `200`

The revision this content already was (nothing new was made)

- object
  - `success` true, required
  - `data` object, required
    - `revision` object, required
      - `hash` string, required: The revision’s content hash: its identity.
      - `number` integer, required
      - `engineStage` integer, required
      - `publishedAt` string, required
      - `publishedBy` object, required
        - `kind` string, required
    - `replayed` boolean
    - `live` boolean: False when it waits for a person to approve its grant before runs use it; the revision that runs stays until then.
    - `grant` object, nullable: The new revision’s grant request. `requested` waits for an owner or admin to approve it under Automations → Approvals; an agent or an API key cannot approve it. Dry runs and step tests do not need it.
      - `id` string, required
      - `status` 'requested' | 'active' | 'needs_reapproval' | 'revoked' | 'expired', required
      - `approveAt` string: The page where a person approves it, when the host has one: give it to them.

## Other responses

- `201`: The new revision
- `400`: Invalid input, or the draft has blocking findings — `code` names the refusal (`AUTOMATION_BLOCKED_BY_FINDINGS`, `AUTOMATION_SECRET_REFUSED`, …) and `details[]` each finding with its node
- `401`: Unauthorized
- `403`: Forbidden — missing scope, insufficient role, a credential narrowed to some accounts, or a grant the caller does not hold
- `404`: Not found — or automations are not enabled for this workspace
- `409`: Conflict — the draft moved since you read it (`AUTOMATION_VERSION_CONFLICT`), the automation is not published or not active, or a grant does not hold (`AUTOMATION_GRANT_STATE`)
- `429`: The automation’s admission refused the run and does not queue (`AUTOMATION_ADMISSION_REFUSED`, `AUTOMATION_RATE_LIMITED`): `code` names which, and the `Retry-After` header says how many seconds to wait before trying again. A start that queues is a 202, not this.
- `503`: Automations are paused while an incident is worked (`AUTOMATIONS_STOPPED`) or not configured here (`AUTOMATIONS_UNAVAILABLE`): `code` names which, and the `Retry-After` header says how many seconds to wait before retrying

---

[API](https://skmtc.dev/banksync/apis/banksync-api.md) · [All operations](https://skmtc.dev/banksync/apis/banksync-api/llms.txt) · [OpenAPI document](https://skmtc.dev/banksync/apis/banksync-api/revisions/94465f5ee922?raw)
