## Update a flow

`PATCH /v1/tasks/flows/:flowId`

Changes the settings of an existing task flow by its ID.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|----------|
| `flowId` (path) | number | yes | Flow ID, a positive integer. List: [`GET /v1/tasks/flows`](/docs/entities/tasks/flows-list) |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `flowData` | object | yes | New values of the flow fields. Sent to Bitrix24 unchanged; the flow ID is taken from the path |
| `flowData.id` | number | no | Flow ID. If passed, it must be a number equal to `flowId` from the path |
| `flowData.name` | string | no | Flow name. It must not match the name of another flow in the Bitrix24 account |
| `flowData.plannedCompletionTime` | number | no | Time to complete a task, in seconds, for example `86400` — one day |
| `flowData.distributionType` | string | no | How tasks reach assignees: `manually` — a moderator assigns them, `queue` — in turn among the employees in `responsibleList`, `himself` — employees take tasks themselves |
| `flowData.responsibleList` | array | no | Who receives the tasks: an array of pairs like `["user", "3"]`, where the second element is the employee ID as a string. With `manually`, the list holds the flow moderator. List: [`GET /v1/users`](/docs/entities/users/list) |
| `flowData.groupId` | number | no | ID of the workgroup to bind the flow to. List: [`GET /v1/workgroups`](/docs/entities/workgroups/list) |
| `flowData.ownerId` | number | no | Flow administrator ID. List: [`GET /v1/users`](/docs/entities/users/list) |
| `flowData.taskCreators` | array | no | Who can submit tasks to the flow: an array of pairs. `[["meta-user", "all-users"]]` — all employees |
| `flowData.description` | string | no | Flow description. If not passed, reset to an empty string |
| `flowData.matchWorkTime` | number | no | `1` — weekends and holidays are skipped when the deadline is calculated, `0` — they are counted. If not passed, reset to `1` |
| `flowData.responsibleCanChangeDeadline` | number | no | `1` — the assignee can change the task deadline, `0` — cannot. If not passed, reset to `1` |
| `flowData.taskControl` | number | no | `1` — a completed task goes to its creator for review, `0` — no review. If not passed, reset to `0` |
| `flowData.notifyAtHalfTime` | number | no | `1` — remind the assignee halfway to the deadline, `0` — no reminder. If not passed, reset to `0` |
| `flowData.notifyOnQueueOverflow` | number | no | Notify the flow administrator when the number of tasks in the queue exceeds this number. If not passed, reset to `null` — no notification |
| `flowData.notifyOnTasksInProgressOverflow` | number | no | Notify the flow administrator when the number of tasks in progress exceeds this number. If not passed, reset to `null` — no notification |
| `flowData.notifyWhenEfficiencyDecreases` | number | no | Notify the flow administrator when efficiency drops below this value, in percent. If not passed, reset to `null` — no notification |
| `analyticsParams` | object | no | Internal Bitrix24 analytics tags. They do not affect the flow |

The body must not contain keys other than `flowData` and `analyticsParams`. Flags are passed as the numbers `1` and `0` and come back in the response as `true` and `false`.

**Important:** the fields marked "If not passed, reset to …" are reset on every call, including a call with `"flowData": {}`. Other fields missing from `flowData` keep their current values. To change one setting without losing the others, read the flow with [`GET /v1/tasks/flows/:flowId`](/docs/entities/tasks/flows-get) and pass the resettable fields with their current values.

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/tasks/flows/20" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "flowData": {
      "name": "Website request processing",
      "description": "Customer requests from the website",
      "plannedCompletionTime": 172800
    }
  }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/tasks/flows/20" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "flowData": {
      "name": "Website request processing",
      "description": "Customer requests from the website",
      "plannedCompletionTime": 172800
    }
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/flows/20', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    flowData: {
      name: 'Website request processing',
      description: 'Customer requests from the website',
      plannedCompletionTime: 172800,
    },
  }),
})

const { success, data } = await res.json()
if (success) {
  console.log('New name:', data.name)
}
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/tasks/flows/20', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    flowData: {
      name: 'Website request processing',
      description: 'Customer requests from the website',
      plannedCompletionTime: 172800,
    },
  }),
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | `true` on success |
| `data` | object | The flow after the change. The set of fields is the same as in the [`GET /v1/tasks/flows/:flowId`](/docs/entities/tasks/flows-get) response |
| `data.id` | number | Flow ID |
| `data.taskCreators` | array | An empty array, even if `taskCreators` was passed in the request or set earlier. The saved value is in [`GET /v1/tasks/flows/:flowId`](/docs/entities/tasks/flows-get) |
| `data.team` | array | An empty array. The flow team is in [`GET /v1/tasks/flows/:flowId`](/docs/entities/tasks/flows-get) |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 20,
    "creatorId": 1,
    "ownerId": 1,
    "groupId": 178,
    "templateId": 0,
    "efficiency": 100,
    "active": true,
    "plannedCompletionTime": 172800,
    "activity": "2026-10-20T00:23:04+00:00",
    "name": "Website request processing",
    "description": "Customer requests from the website",
    "distributionType": "queue",
    "responsibleList": [
      ["user", "3"]
    ],
    "demo": false,
    "responsibleCanChangeDeadline": true,
    "matchWorkTime": true,
    "matchSchedule": false,
    "taskControl": false,
    "notifyAtHalfTime": false,
    "notifyOnQueueOverflow": null,
    "notifyOnTasksInProgressOverflow": null,
    "notifyWhenEfficiencyDecreases": null,
    "taskCreators": [],
    "team": [],
    "trialFeatureEnabled": false
  }
}
```

## Error response example

422 — no flow with this `flowId` exists:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Unknown error. [Flow: 267]",
    "b24Code": "0"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `INVALID_PARAMS` | `flowId` is not a positive integer. Message: `flowId must be a positive safe integer` |
| 400 | `INVALID_PARAMS` | The body is not an object or contains keys other than `flowData` and `analyticsParams`. Message: `body must be an object with supported fields only` |
| 400 | `INVALID_PARAMS` | `flowData` is not passed or is not an object. Message: `flowData must be an object` |
| 400 | `INVALID_PARAMS` | `flowData.id` is not equal to `flowId` from the path or is passed as a string. Message: `flowData.id must match flowId` |
| 400 | `INVALID_PARAMS` | `analyticsParams` is not an object. Message: `analyticsParams must be an object` |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `INVALID_API_KEY` | The key is not found |
| 401 | `TOKEN_MISSING` | The key has no Bitrix24 tokens |
| 403 | `SCOPE_DENIED` | The key has neither the `task` nor the `tasks` scope |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in read-only mode. `error.details.switchUrl` holds the address of the section where the mode is changed |
| 422 | `BITRIX_ERROR` | No flow with this `flowId` exists. The message looks like `Unknown error. [Flow: 267]`; there is no `404` response in this case |
| 422 | `BITRIX_ERROR` | The name is taken by another flow. Message: `A flow with this name already exists` |
| 429 | `RATE_LIMITED` | The request rate to Bitrix24 or to the platform is exceeded. Retry after the delay in the `Retry-After` header |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unreachable or returned a server error |
| 503 | `BITRIX_TIMEOUT` | Bitrix24 did not respond in time |

Full list of common API errors — [Errors](/docs/errors).

## See also

- [Flows and flow tasks](/docs/entities/tasks/flows)
- [Get a flow](/docs/entities/tasks/flows-get)
- [List flows](/docs/entities/tasks/flows-list)
- [Create a flow](/docs/entities/tasks/flows-create)
- [Toggle flow activity](/docs/entities/tasks/flows-activate)
- [Employees](/docs/entities/users)
- [Workgroups](/docs/entities/workgroups)
