> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Publish Workflow

> Publish the current draft as a production workflow version

Publishes the current draft as a new production version. This is the same action as **Publish** in the builder. The new version becomes active, scheduled and webhook triggers start, and the workflow is marked `ACTIVE`.

## Base URL

```
https://api.langdock.com/workflows/v1/publish
```

<Warning>
  **Dedicated deployments**

  Replace `api.langdock.com` with `<your-deployment-url>/api/public` in all requests.
</Warning>

## Required scopes

This endpoint requires the `WORKFLOW_WRITE_API` scope (**Workflow Write API**) and editor access.

## Parameters

| Parameter     | Type   | Required | Description                                                 |
| ------------- | ------ | -------- | ----------------------------------------------------------- |
| `workflowId`  | string | Yes      | UUID of the workflow.                                       |
| `bumpType`    | string | Yes      | Version bump: `major`, `minor`, or `patch`.                 |
| `description` | string | No       | Version description. Maximum: 255 characters.               |
| `timezone`    | string | No       | Valid IANA timezone. Stored only when a valid name is sent. |

Publish is rejected when the draft has a disconnected trigger, when a webhook is unauthenticated and the workspace requires webhook auth, or when the workflow is a template. Pause a live workflow with [update](/en/developer/workflow-api/update-workflow) and `status: "INACTIVE"`.

## Example

```javascript theme={null}
const axios = require("axios");

async function publishWorkflow(workflowId) {
  const response = await axios.post(
    "https://api.langdock.com/workflows/v1/publish",
    {
      workflowId,
      bumpType: "patch",
      description: "Initial production version"
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

  console.log("Published version:", response.data.workflow.activeVersion?.version);
}

publishWorkflow("550e8400-e29b-41d4-a716-446655440000");
```

## Response format

### Success response (200 OK)

```typescript theme={null}
{
  status: "success";
  message: "Workflow published successfully";
  workflow: object;
}
```

`workflow` matches the object on [Workflow API Overview](/en/developer/workflow-api/workflows-overview).

## Error handling

| Status code | Description                                                                                                                                       |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400         | Invalid body, disconnected trigger, webhook auth required, template workflow, or missing draft                                                    |
| 401         | Invalid or missing API key                                                                                                                        |
| 403         | Missing `WORKFLOW_WRITE_API` scope or editor access. A missing workflow, a template, or a workflow in another workspace also returns this status. |
| 429         | Rate limit exceeded                                                                                                                               |
| 500         | Internal server error                                                                                                                             |

<Info>
  Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on [API Key Best Practices](/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>


## OpenAPI

````yaml POST /workflows/v1/publish
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
    description: Production
security:
  - bearerAuth: []
paths:
  /workflows/v1/publish:
    post:
      tags:
        - Workflows
      summary: Publish a workflow
      description: Publishes the current draft as a new production version.
      operationId: publishWorkflow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workflowId
                - bumpType
              properties:
                workflowId:
                  type: string
                  format: uuid
                bumpType:
                  type: string
                  enum:
                    - major
                    - minor
                    - patch
                description:
                  type: string
                  maxLength: 255
                timezone:
                  type: string
                  description: Valid IANA timezone. Stored only when a valid name is sent.
      responses:
        '200':
          description: Workflow published successfully
        '400':
          description: >-
            Invalid body, disconnected trigger, webhook auth required, template
            workflow, or missing draft
        '401':
          description: Invalid or missing API key
        '403':
          description: >-
            Missing WORKFLOW_WRITE_API scope or editor access. A missing
            workflow, a template, or a workflow in another workspace also
            returns this status.
        '429':
          description: Rate limit exceeded
        '500':
          description: Internal server error
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"

````