For AI agents: markdown of this page — /docs-content-en/entities/tasks/flows-activate.md documentation index — /llms.txt

Toggle flow activity

POST /v1/tasks/flows/:flowId/activate

Turns an inactive flow on and an active flow off: each call switches the flow to the opposite state.

Parameters

Parameter Type Required Description
ParameterflowId (path) Typenumber Requiredyes DescriptionFlow ID. List: GET /v1/tasks/flows

No request body is required; fields in the body are ignored.

Examples

curl — personal key

Terminal
curl -X POST 'https://vibecode.bitrix24.com/v1/tasks/flows/20/activate' \
  -H 'X-Api-Key: YOUR_API_KEY'

curl — OAuth application

Terminal
curl -X POST 'https://vibecode.bitrix24.com/v1/tasks/flows/20/activate' \
  -H 'X-Api-Key: YOUR_APP_KEY' \
  -H 'Authorization: Bearer USER_SESSION_TOKEN'

JavaScript — personal key

javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/tasks/flows/20/activate', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})
const result = await response.json()
console.log(result.data)

JavaScript — OAuth application

javascript
const response = await fetch('https://vibecode.bitrix24.com/v1/tasks/flows/20/activate', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})
const result = await response.json()
console.log(result.data)

Response fields

Field Type Description
Fieldsuccess Typeboolean Descriptiontrue on success
Fielddata Typeboolean Descriptiontrue — the flow was toggled. The response is the same whether the flow was turned on or off. Read the new state from the active field in GET /v1/tasks/flows/:flowId

Response example

JSON
{
  "success": true,
  "data": true
}

Error response example

422 — no flow with this ID exists:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Flow with this ID does not exist.",
    "b24Code": "0"
  }
}

The error.message text comes in the Bitrix24 account language.

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionflowId is not a positive integer: flowId must be a positive safe integer
HTTP400 CodeFST_ERR_CTP_EMPTY_JSON_BODY DescriptionThe Content-Type: application/json header is sent with an empty body. Remove the header
HTTP401 CodeMISSING_API_KEY DescriptionThe X-Api-Key header is missing
HTTP401 CodeINVALID_API_KEY DescriptionThe key is not found
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no Bitrix24 tokens
HTTP403 CodeSCOPE_DENIED DescriptionThe key has neither the task nor the tasks scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key is in read-only mode. error.details.switchUrl holds the address of the section where the mode is changed
HTTP422 CodeBITRIX_ERROR DescriptionNo flow with this flowId exists: Flow with this ID does not exist.
HTTP429 CodeRATE_LIMITED DescriptionThe request rate to Bitrix24 or to the platform is exceeded. Retry after the delay in the Retry-After header
HTTP502 CodeBITRIX_UNAVAILABLE DescriptionBitrix24 is unreachable or returned a server error
HTTP503 CodeBITRIX_TIMEOUT DescriptionBitrix24 did not respond in time

Full list of common API errors — Errors.

Known specifics

The toggle is not retried automatically. The 503 BITRIX_TIMEOUT and 502 BITRIX_UNAVAILABLE responses do not tell whether the flow was toggled, and the platform does not retry such a call on its own: a retry would return the flow to its previous state. Before calling the method again, read the active field in GET /v1/tasks/flows/:flowId.

See also