# Publish Workflow

Make the draft the version that runs. The draft is checked first, exactly as Validate Workflow checks it; meta.warnings lists what is not set up yet. Send the revision you last read in If-Match. The draft is unchanged, so meta.revision stays the same.

`POST https://connect.mindcloud.co/v2/workflows/:workflowId/publish`

Permissions: `workflow:edit`.

## Parameters

### Path

- `workflowId` (string, required): The workflow's id.

### Headers

- `If-Match` (string, required): Required. The revision you last read: the `revision` from its read (Get Workflow Definition for a workflow, Get Analytics Page Definition for an Analytics page, Get Analytics Data Source Table for a fixed source's table), or `meta.revision` from your last change to it. The `ETag` header of either answer is the same value, ready to send back. The change applies only if nobody changed it since: otherwise it answers 412 with the current revision in `error.details.revision`. Send it as a strong entity tag (`"r_..."`): a weak one (`W/"..."`) never matches and answers 412. Without it the request answers 428.
- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. A key can also act in its child organizations, and, with "Use this key across all of your organizations" on, in every organization its creator can open in the app. List them with GET /v2/companies. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

### Body

- `description` (string): What changed in this version.
- `bump` (string): patch, minor or major.
  Which part of the version number goes up. patch (the default): 0.0.14 to 0.0.15.
  Default: `patch`
  Allowed values:
    - `patch`
    - `minor`
    - `major`

## Example request

```bash
curl --request POST \
  --url 'https://connect.mindcloud.co/v2/workflows/Wq3kZ8pLx2Nb/publish' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
  "description": "Skip cancelled orders",
  "bump": "patch"
}'
```

## Response fields

- `version` (string): The new version number.
- `description` (string): What changed in this version.
- `isPublished` (boolean): Always true: this version now runs.
- `createdOn` (date): When it was published.
