# Publish a workflow — it goes live

TAKES EFFECT IMMEDIATELY: freezes the current draft as a new immutable version and makes the rule live, stamped with the publisher's account — whose seat every run then acts with, and never more than it. It validates first, with the same code `post_workflows_validate` runs, and answers 422 "this workflow cannot run yet" with the problems rather than publishing something broken. To CHECK a definition without going live, call validate; to fire a published one by hand, `post_workflows_id_run`.

Access class: `workspace:admin`.

## Endpoint

`POST /v1/workflows/{id}/publish`

## Parameters

| Name | In | Type | Required |
| --- | --- | --- | --- |
| id | path | string | Yes |

## Request body

Content type: `application/json`.

```json
{
  "body": {},
  "params": {
    ":id": "string"
  },
  "query": {}
}
```

## Responses

### 201

the action's answer

Content type: `application/json`.

```json
{
  "data": {
    "version": {
      "createdAt": "string",
      "definition": "string",
      "id": 1,
      "publishedByUserId": 1,
      "rolledBackFrom": 1,
      "runAsAccountId": "",
      "version": 1,
      "workflowId": 1
    },
    "workflow": {
      "createdAt": "string",
      "createdByUserId": 1,
      "definition": "string",
      "description": "string",
      "id": 1,
      "key": "string",
      "name": "string",
      "publishedAt": "string",
      "runAsAccountId": "",
      "status": "string",
      "updatedAt": "string",
      "version": 1
    }
  }
}
```

### default

a refusal: `{"error": "<what a person needs to read>"}`. 401 no credential, 402 the plan does not include this, 403 the seat does not, 404 the thing does not exist or is not yours to see.

Content type: `application/json`.

```json
{
  "error": "string"
}
```
