For AI agents: markdown of this page — /docs-content-en/entities/activities/bindings/move.md documentation index — /llms.txt

Move a binding

POST /v1/activities/:activityId/bindings/move

Moves the activity's binding from one CRM entity to another of the same type: the old binding is removed and the new one is created in a single call.

Parameters

Parameter Type Required Description
ParameteractivityId (path) Typenumber Requiredyes DescriptionActivity ID. List: GET /v1/activities

Request fields (body)

Field Type Required Description
FieldsourceEntityTypeId Typenumber Requiredyes DescriptionNumeric type code of the source entity:
1 — lead
2 — deal
3 — contact
4 — company
7 — quote
31 — invoice
≥128 — smart-process, its code — in GET /v1/smart-processes
FieldsourceEntityId Typenumber Requiredyes DescriptionID of the source entity
FieldtargetEntityTypeId Typenumber Requiredyes DescriptionNumeric type code of the target entity. Must equal sourceEntityTypeId
FieldtargetEntityId Typenumber Requiredyes DescriptionID of the target entity

Examples

curl — personal key

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/activities/3631/bindings/move \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "sourceEntityTypeId": 3, "sourceEntityId": 9, "targetEntityTypeId": 3, "targetEntityId": 17 }'

curl — OAuth application

Terminal
curl -X POST https://vibecode.bitrix24.com/v1/activities/3631/bindings/move \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "sourceEntityTypeId": 3, "sourceEntityId": 9, "targetEntityTypeId": 3, "targetEntityId": 17 }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/activities/3631/bindings/move', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    sourceEntityTypeId: 3,
    sourceEntityId: 9,
    targetEntityTypeId: 3,
    targetEntityId: 17,
  }),
})

const { data } = await res.json()

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/activities/3631/bindings/move', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    sourceEntityTypeId: 3,
    sourceEntityId: 9,
    targetEntityTypeId: 3,
    targetEntityId: 17,
  }),
})

const { data } = await res.json()

Response fields

Field Type Description
Fieldsuccess Typeboolean DescriptionAlways true on success
Fielddata.activityId Typenumber DescriptionActivity ID
Fielddata.sourceEntityTypeId Typenumber DescriptionNumeric type code of the source entity
Fielddata.sourceEntityId Typenumber DescriptionID of the source entity
Fielddata.targetEntityTypeId Typenumber DescriptionNumeric type code of the target entity
Fielddata.targetEntityId Typenumber DescriptionID of the target entity
Fielddata.moved Typeboolean Descriptiontrue only if Bitrix24 returned the boolean value true. Otherwise false

Response example

JSON
{
  "success": true,
  "data": {
    "activityId": 3631,
    "sourceEntityTypeId": 3,
    "sourceEntityId": 9,
    "targetEntityTypeId": 3,
    "targetEntityId": 17,
    "moved": true
  }
}

Error response example

422 — source and target entities are of different types:

JSON
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Source and target entity types are not equal"
  }
}

Errors

HTTP Code Description
HTTP400 CodeINVALID_PARAMS DescriptionactivityId or any of the source* / target* fields is not a positive integer
HTTP404 CodeENTITY_NOT_FOUND DescriptionNo activity exists for the given activityId
HTTP422 CodeBITRIX_ERROR DescriptionThe source entity type does not match the target entity type
HTTP403 CodeSCOPE_DENIED DescriptionThe key lacks the crm scope
HTTP403 CodeWRITE_BLOCKED_READONLY_KEY DescriptionThe key's access mode blocks binding changes
HTTP401 CodeTOKEN_MISSING DescriptionThe key has no configured tokens

Full list of common API errors — Errors.

Known specifics

Move works only within one type. To move an activity to an entity of a different type, move does not apply — do it in two steps:

  1. Bind the activity to the second entity — POST /v1/activities/:activityId/bindings.
  2. Remove the binding from the first — DELETE /v1/activities/:activityId/bindings.

This order does not break the ban on removing the last binding — the activity stays bound to at least one entity the whole time.

See also