---
title: "Unpublish an automation"
description: "Take it off live without deleting: enrollment stops, versions and history are kept. `POST /api/v1/automations/{id}/unpublish`"
url: https://www.unitpost.com/docs/automations/post-automations-id-unpublish
section: "Automations API reference"
updated: 2026-12-01
---
# Unpublish an automation

`POST /api/v1/automations/{id}/unpublish`

Take it off live without deleting: enrollment stops, versions and history are kept. On a live automation, runs in progress finish on their version. On a paused one, the runs the pause holds END by default (`held_runs: "end"`), so nothing more is sent to those people; `held_runs: "release"` lets them finish instead, and is refused (409) while the pause's cause still holds, as Resume is. `runs` in the response counts what happened. A staff pause can't be unpublished. Publish again to relaunch. Requires the `automations:publish` capability.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | — |

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `held_runs` | enum | no | What happens to the runs a pause holds, when the automation is paused: `end` (default) ends them, so nothing more is sent to those people; `release` lets them finish on their version, refused (409) while the pause's cause still holds, as Resume is. Ignored on a live automation: its runs in progress finish. One of: `end`, `release`. |

## Response fields (200)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `object` | string | yes | — |
| `id` | string | yes | — |
| `name` | string | yes | — |
| `description` | string \| null | yes | — |
| `status` | enum | yes | One of: `draft`, `active`, `paused`, `archived`. |
| `pause_reason` | enum \| null | yes | — |
| `published_version` | integer \| null | yes | — |
| `has_draft_changes` | boolean | yes | — |
| `trigger` | object \| null | yes | — |
| `active_runs` | integer | yes | — |
| `total_runs` | integer | yes | — |
| `failed_runs_30d` | integer | yes | — |
| `last_run_at` | string \| null | yes | — |
| `archived_at` | string \| null | yes | When it was archived; null unless `status` is `"archived"`. |
| `delete_after` | string \| null | yes | When an archived automation is deleted for good unless it is unarchived first (archive time plus the retention period, 30 days by default); null unless `status` is `"archived"`. |
| `created_at` | string | yes | — |
| `updated_at` | string | yes | — |
| `heads_up` | object[] | no | On create and update: values in the saved draft that couldn't be verified here (an invented template id, a sender on a domain that isn't verified). They're kept; publish refuses them until fixed. |
| `warnings` | string[] | no | Update only: what this edit changed that you didn't write, in plain words. Today one case: with `maxConcurrentRunsPerSubject` left out, a custom-event journey's runs per person at once follows its graph, so an edit that adds or removes a match on the event's own data (`{{event.data.<key>}}` in a Wait for event, the goal or the exit rule, or a Wait until on an event date), or a policy sent without the field, moves it (1 or 10). The sentence names the old and new value, why, and how to keep the old one. Absent when nothing did. Tell the user. |
| `generated_secrets` | object[] | no | On create and update, when this write generated a Call webhook block's signing secret (a new block whose `secret` was left out, or `"generate"`): the secret, this once. Reads only ever show a placeholder. |
| `runs` | object | yes | — |

## Responses

| Status | Description |
| --- | --- |
| 200 | The automation, now a draft, with `runs: { ended, released, expired }`. |
| 401 | Missing or invalid API key. |
| 403 | Insufficient scope. |
| 404 | Automation not found. |
| 409 | Not active or paused (an archived one answers `automation_archived`), a staff pause, or `held_runs: "release"` while the pause's cause still holds. |
| 422 | A bad field or an unknown key. |

## Example request

```bash
curl -X POST 'https://www.unitpost.com/api/v1/automations/atm_123/unpublish' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'User-Agent: my-app/1.0' \
  -H 'Content-Type: application/json' \
  -d '{
    "held_runs": "end"
  }'
```

## Example response (200)

```json
{
  "object": "automation",
  "id": "id_123",
  "name": "Example",
  "description": "string",
  "status": "draft",
  "pause_reason": "user",
  "published_version": 0,
  "has_draft_changes": false,
  "trigger": {
    "kind": "string",
    "config": {}
  },
  "active_runs": 0,
  "total_runs": 1,
  "failed_runs_30d": 0,
  "last_run_at": "2026-01-01T00:00:00.000Z",
  "archived_at": "2026-01-01T00:00:00.000Z",
  "delete_after": "string",
  "created_at": "2026-01-01T00:00:00.000Z",
  "updated_at": "2026-01-01T00:00:00.000Z",
  "heads_up": [
    {
      "code": "sender_not_an_address",
      "node_id": "node_123",
      "field": "string",
      "resource_type": "template",
      "value": "string",
      "message": "string"
    }
  ],
  "warnings": [
    "string"
  ],
  "generated_secrets": [
    {
      "node_id": "node_123",
      "secret": "string"
    }
  ],
  "runs": {
    "ended": 0,
    "released": 0,
    "expired": 0
  }
}
```

## Links

- HTML reference (with Node.js, Python, Ruby, PHP, Laravel, Go, Java, Rust, .NET and CLI examples): https://www.unitpost.com/docs/automations/post-automations-id-unpublish
- OpenAPI 3.1 (full schemas): https://www.unitpost.com/api/v1/openapi.json
