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

Update lead

PATCH /v1/leads/:id

Updates the fields of an existing lead. Pass only the fields you want to change. See the full list in the field reference.

Important note on email / phone (multifield): on update, phone and email only add rows. A PATCH with {"email": "new@y.com"} to a lead that already has an email will not replace the old one — the lead will end up with two emails. To change or delete a single row, send fm as an object keyed by the row id — see the section below. An object with an id field inside phone, email or fm[] is still refused: 400 MULTIFIELD_ID_NOT_SUPPORTED, and nothing is written.

Parameters

Parameter Type Required Description
Parameterid (path) Typenumber Requiredyes DescriptionLead ID. List: GET /v1/leads

Request fields (body)

Field Type Description
FieldstageId Typestring DescriptionLead status — canonical name, the statusId alias is also accepted. List: GET /v1/statuses?filter[entityId]=STATUS. In the response the value is returned in the stageId field
Fieldopportunity Typenumber DescriptionAmount — canonical name, the amount alias is also accepted. Important: for the value to persist, pass isManualOpportunity: true in the same request
FieldassignedById Typenumber DescriptionAssignee. List: GET /v1/users
Fieldtitle Typestring DescriptionLead title
Fieldphone Typestring | string[] | object[] DescriptionPhone. Accepts three forms: a string "+1...", an array of strings ["+1...", "+1..."], or an array of objects [{ "value": "+1...", "typeId": "WORK" }, …]. typeId: WORK | HOME | MOBILE | OTHER (default WORK). Important: the UPPER form [{ "VALUE": "...", "VALUE_TYPE": "WORK" }] is not accepted — it returns 400 INVALID_MULTIFIELD_SHAPE. Use camelCase: [{ "value": "...", "typeId": "WORK" }]
Fieldemail Typestring | string[] | object[] DescriptionEmail. Accepts three forms: a string "a@b.com", an array of strings ["a@b.com", "b@c.com"], or an array of objects [{ "value": "a@b.com", "typeId": "WORK" }, …]. typeId: WORK | HOME | MAILING | OTHER (default WORK). Important: the UPPER form [{ "VALUE": "...", "VALUE_TYPE": "WORK" }] is not accepted — it returns 400 INVALID_MULTIFIELD_SHAPE. Use camelCase: [{ "value": "...", "typeId": "WORK" }]
FieldufCrm* Typeper field schema DescriptionA user field of the Bitrix24 account, for example ufCrmProjectCode. The actual name and type are in the schema GET /v1/leads/fields, and the value format for each type is in User fields (UF). An enumeration field takes the option ID from the field's items array in the schema, and a multiple field takes an array of such IDs. If you send the option label VALUE instead of the ID, the value is lost: a single-value field gets 0. A number that is not among the options is stored as is. Neither the label nor a non-existent ID raises an error, and the request returns 200, so map the label to its ID on your side and check the stored value of this field in the response data

Examples

curl — personal key

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/leads/42" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "stageId": "IN_PROCESS",
    "opportunity": 2500,
    "isManualOpportunity": true,
    "assignedById": 3,
    "title": "Website request — hot lead"
  }'

curl — OAuth application

Terminal
curl -X PATCH "https://vibecode.bitrix24.com/v1/leads/42" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "stageId": "IN_PROCESS",
    "opportunity": 2500,
    "isManualOpportunity": true,
    "assignedById": 3,
    "title": "Website request — hot lead"
  }'

JavaScript — personal key

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/leads/42', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    stageId: 'IN_PROCESS',
    opportunity: 2500,
    isManualOpportunity: true,
    assignedById: 3,
    title: 'Website request — hot lead',
  }),
})

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

JavaScript — OAuth application

javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/leads/42', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    stageId: 'IN_PROCESS',
    opportunity: 2500,
    isManualOpportunity: true,
    assignedById: 3,
    title: 'Website request — hot lead',
  }),
})

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

Alternative form — array of objects with explicit `typeId`

If you need to specify multiple values or an explicit type (HOME, MOBILE):

JSON
{
  "phone": [
    { "value": "+12025550123", "typeId": "WORK" },
    { "value": "+12025550124", "typeId": "MOBILE" }
  ],
  "email": [
    { "value": "work@example.com", "typeId": "WORK" },
    { "value": "personal@example.com", "typeId": "HOME" }
  ]
}

Change or delete a single multifield row — `fm` keyed by row `id`

Send fm as an object. A key is a row id from fm in the GET response: a non-empty value changes that row, an empty value deletes it. A key n0, n1, … adds a new row. All three actions can be combined in one request.

JSON
{
  "fm": {
    "11": { "typeId": "PHONE", "valueType": "MOBILE", "value": "+14155550100" },
    "10": { "typeId": "EMAIL", "value": "" },
    "n0": { "typeId": "EMAIL", "valueType": "WORK", "value": "new@company.com" }
  }
}
  • A row accepts only typeId, valueType and value. typeId is the channel: PHONE or EMAIL. valueType is required when a row changes: send the current one to keep it. A new row defaults to WORK, a deletion needs none.
  • Before writing, Vibecode reads the lead and checks that every id is a row of this lead with the same typeId. Otherwise — 409 MULTIFIELD_ROW_NOT_FOUND, and nothing is written.
  • After writing, the lead is read again: every changed row is compared with the requested value (a phone by its digits, an email case-insensitively), new rows by channel, subtype and value. Rows someone else added meanwhile do not spoil the comparison. If the change is not visible — 422 MULTIFIELD_NOT_APPLIED, with the re-read record in data. If it is visible but a row the request did not name is gone or changed — 200 with the MULTIFIELD_OTHER_ROWS_CHANGED warning in meta.warnings, with that row id in details.lostRows or details.changedRows. This happens when someone else edited the record meanwhile or Bitrix24 applied the write to that row too. If the re-read record carries fm in an unknown shape — 200 with the MULTIFIELD_UNVERIFIED warning in meta.warnings.
  • If the row was deleted between the read and the write (the write waits for the account queue and for rate-limit repeats), Bitrix24 creates it again with the requested value: the answer is 422 MULTIFIELD_NOT_APPLIED, with the row id in error.details.keys.
  • This form has not been checked on a self-hosted Bitrix24 account yet. If the CRM module applies it differently, the answer is 422 MULTIFIELD_NOT_APPLIED or the MULTIFIELD_OTHER_ROWS_CHANGED warning: the write has already happened, so compare the record in data before sending anything again.
  • An fm object cannot be combined with phone and email in one request. An array in phone and email and fm[] still only add rows.
  • This form is available only in this PATCH. Batch updates, import and create accept fm only as an array.

Response fields

Field Type Description
Fieldsuccess Typeboolean Descriptiontrue when the lead is updated
Fielddata Typeobject DescriptionThe updated lead object with all fields — see Fields

Response example

JSON
{
  "success": true,
  "data": {
    "id": 42,
    "title": "Website request",
    "stageId": "IN_PROCESS",
    "assignedById": 1,
    "createdTime": "2026-04-15T12:00:00+00:00",
    "updatedTime": "2026-04-15T13:00:00+00:00"
  }
}

Error response example

404 — lead not found:

JSON
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Item not found"
  }
}

Errors

HTTP Code Description
HTTP404 CodeENTITY_NOT_FOUND DescriptionLead not found
HTTP422 CodeSTAGE_NOT_APPLIED DescriptionThe stageId or statusId you sent was not applied: after the PATCH the status remained unchanged, for example when the value is not in the dictionary. Details are in error.message and error.details, the re-read lead is in data. The record has already been changed and the other fields of the body may have been applied: correct the value and send only what still needs changing, not the whole body again
HTTP403 CodeACCESS_DENIED DescriptionNo access
HTTP400 CodeINVALID_MULTIFIELD_SHAPE DescriptionWrong shape for phone or email — expects [{ "value", "typeId" }]. The same code is returned when phone or email holds an object without value — for example empty or with keys such as n0, 0 or 011 — or a number or true/false, on its own or as an array item. For fm as an object — when a key is neither a row id nor n0, n1, …, the object is empty, a row has fields other than typeId, valueType, value, typeId is not PHONE/EMAIL, value is not a string, a new row has an empty value, a changed row has no valueType, or phone/email is sent next to it. A string, a number or a boolean in fm returns the same code. The request is refused and nothing is written
HTTP400 CodeMULTIFIELD_ID_NOT_SUPPORTED Descriptionphone, email or the raw fm[] contains an object with an id field. In an array Bitrix24 neither updates nor deletes a row by id — it would append a duplicate — so the request is refused and nothing is written. The same refusal applies when phone or email is sent as an object keyed by row ids. To change or delete a row, send fm as an object keyed by the row id
HTTP409 CodeMULTIFIELD_ROW_NOT_FOUND DescriptionAn fm key is the id of a row this lead does not have, or of a row of another channel (typeId). error.details holds key and typeId. Nothing is written: read the record again and take the id from its fm
HTTP404, 429, 502 CodeMULTIFIELD_PRECHECK_FAILED DescriptionThe current fm rows could not be read before writing: the lead does not exist (404), the account or the Vibecode queue refused the read for a rate limit (429 with Retry-After), fm came in an unknown shape or the read failed (502; the same status when Bitrix24 refused with a 4xx). The cause is in error.details.cause. Nothing is written
HTTP422 CodeMULTIFIELD_NOT_APPLIED DescriptionBitrix24 accepted the write, but the re-read record does not show the requested fm change: error.details.keys holds the keys that were not confirmed, lostRows the id of rows the request did not name that are gone, changedRows the id of such rows whose value changed, addedRows and expectedAddedRows how many rows were added and how many were expected, and the re-read record is in data. The write may be partial: compare the record before sending anything again
HTTP400 CodeREADONLY_FIELD DescriptionAttempt to write a read-only field
HTTP403 CodeSCOPE_DENIED DescriptionThe API key does not have the crm scope
HTTP401 CodeTOKEN_MISSING DescriptionThe API key has no configured tokens

Full list of common API errors — Errors.

See also