> ## 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.

# Update Workflow

> Update workflow metadata or the draft graph

Updates metadata or the draft graph for a workflow the API key user can edit. Updating the draft does not publish a new version.

Send either metadata (including `limits`) or a graph update in one request. Do not mix them.

## Base URL

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

<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.                                                                                                                                            |
| `name`        | string | No       | Workflow name. Maximum: 60 characters.                                                                                                                           |
| `description` | string | No       | Workflow description. Maximum: 500 characters.                                                                                                                   |
| `status`      | string | No       | `ACTIVE` or `INACTIVE`. `ACTIVE` requires a published version. Use `INACTIVE` to pause a live workflow.                                                          |
| `timezone`    | string | No       | Valid IANA timezone. Stored when `status` is omitted or `ACTIVE`. Ignored when `status` is `INACTIVE` so a pause does not overwrite the scheduled cron timezone. |
| `nodes`       | array  | No       | Full draft node replacement. Must be sent together with `edges`, and not with `patch` or metadata.                                                               |
| `edges`       | array  | No       | Full draft edge replacement. Must be sent together with `nodes`.                                                                                                 |
| `patch`       | object | No       | Incremental graph operations instead of a full `nodes` and `edges` replacement. Cannot be sent with `nodes` and `edges` or with metadata.                        |
| `limits`      | object | No       | Execution caps. Omitted fields stay unchanged. Send `null` on a field to clear it. May be sent with other metadata, not with a graph update.                     |

To replace the draft graph, send both `nodes` and `edges`. To apply an incremental graph edit, send `patch`. Sending a redacted secret value from [get](/en/developer/workflow-api/get-workflow) keeps the stored secret. Send a new non-empty value to rotate a secret, or `null` to clear a secret-named field.

## Example

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

async function pauseWorkflow(workflowId) {
  const response = await axios.patch(
    "https://api.langdock.com/workflows/v1/update",
    {
      workflowId,
      status: "INACTIVE"
    },
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
      }
    }
  );

  console.log("Status:", response.data.workflow.status);
}

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

## Response format

### Success response (200 OK)

```typescript theme={null}
{
  status: "success";
  message: "Workflow updated 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, mixed graph and metadata, `nodes` without `edges`, no fields, or activate without a published version                                                                                                                        |
| 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. A **Meeting End** graph write without Meetings returns `MEETINGS_FEATURE_FLAG_DISABLED`. |
| 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 PATCH /workflows/v1/update
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/update:
    patch:
      tags:
        - Workflows
      summary: Update a workflow
      description: >-
        Updates metadata or the draft graph. Updating the draft does not publish
        a new version.
      operationId: updateWorkflow
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workflowId
              properties:
                workflowId:
                  type: string
                  format: uuid
                name:
                  type: string
                  maxLength: 60
                description:
                  type: string
                  maxLength: 500
                status:
                  type: string
                  enum:
                    - ACTIVE
                    - INACTIVE
                timezone:
                  type: string
                  description: Valid IANA timezone.
                nodes:
                  type: array
                  items:
                    type: object
                edges:
                  type: array
                  items:
                    type: object
                patch:
                  type: object
                  description: >-
                    Incremental graph operations. Cannot be sent with nodes and
                    edges or with metadata.
                limits:
                  type: object
                  description: >-
                    Execution caps. Omitted fields stay unchanged. Send null on
                    a field to clear it.
      responses:
        '200':
          description: Workflow updated successfully
        '400':
          description: >-
            Invalid body, mixed graph and metadata, nodes without edges, no
            fields, or activate without a published version
        '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"

````