[{"data":1,"prerenderedAt":7},["ShallowReactive",2],{"docs-entities\u002Fcompanies\u002Fupdate":3,"docs-tabs-entities\u002Fcompanies\u002Fupdate":6},{"content":4,"lastmod":5},"\n## Update company\n\n`PATCH \u002Fv1\u002Fcompanies\u002F:id`\n\nUpdates company fields. Pass only the fields you want to change. For the full list, see the [field reference](\u002Fdocs\u002Fentities\u002Fcompanies\u002Ffields).\n\n> **Important note on `email` \u002F `phone` \u002F `web` (multifield):** on update, `phone`, `email` and `web` **only add** rows. A PATCH with `{\"email\": \"new@y.com\"}` to a company that already has an email will **not replace** the old one — the company 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](#change-or-delete-a-single-multifield-row-fm-keyed-by-row-id). An object with an `id` field inside `phone`, `email`, `web` or `fm[]` is still refused: `400 MULTIFIELD_ID_NOT_SUPPORTED`, and nothing is written.\n\n## Frequently updated fields\n\n| Parameter | Type | Description |\n|----------|-----|---------|\n| `title` | string | Name |\n| `phone` | string \\| string[] \\| object[] | Phone. 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\" }]` |\n| `email` | string \\| string[] \\| object[] | Email. 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\" }]` |\n| `web` | string \\| string[] \\| object[] | Website. Accepts three forms: a string `\"https:\u002F\u002Facme.com\"`, an array of strings, or an array of objects `[{ \"value\": \"https:\u002F\u002F...\", \"typeId\": \"WORK\" }]`. `typeId`: `WORK \\| HOME \\| 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\" }]` |\n| `assignedById` | number | Responsible person. List: `GET \u002Fv1\u002Fusers` |\n| `industry` | string | Industry. List: `GET \u002Fv1\u002Fstatuses?filter[entityId]=INDUSTRY` |\n| `ufCrm*` | per field schema | A user field of the Bitrix24 account, for example `ufCrmProjectCode`. The actual name and type are in the schema [`GET \u002Fv1\u002Fcompanies\u002Ffields`](\u002Fdocs\u002Fentities\u002Fcompanies\u002Ffields), and the value format for each type is in [User fields (UF)](\u002Fdocs\u002Fentity-api#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 `ID`s. 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` |\n\n## Examples\n\n### curl — personal key\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcompanies\u002F1\" \\\n  -H \"X-Api-Key: YOUR_API_KEY\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"title\": \"Acme Inc. (updated)\", \"industry\": \"MANUFACTURING\" }'\n```\n\n### curl — OAuth application\n\n```bash\ncurl -X PATCH \"https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcompanies\u002F1\" \\\n  -H \"X-Api-Key: YOUR_APP_KEY\" \\\n  -H \"Authorization: Bearer USER_SESSION_TOKEN\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{ \"title\": \"Acme Inc. (updated)\", \"industry\": \"MANUFACTURING\" }'\n```\n\n### JavaScript — personal key\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcompanies\u002F1', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_API_KEY',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ title: 'Acme Inc. (updated)', industry: 'MANUFACTURING' }),\n})\n\nconst { success, data } = await res.json()\n```\n\n### JavaScript — OAuth application\n\n```javascript\nconst res = await fetch('https:\u002F\u002Fvibecode.bitrix24.com\u002Fv1\u002Fcompanies\u002F1', {\n  method: 'PATCH',\n  headers: {\n    'X-Api-Key': 'YOUR_APP_KEY',\n    'Authorization': 'Bearer USER_SESSION_TOKEN',\n    'Content-Type': 'application\u002Fjson',\n  },\n  body: JSON.stringify({ title: 'Acme Inc. (updated)', industry: 'MANUFACTURING' }),\n})\n\nconst { success, data } = await res.json()\n```\n\n### Alternative form — array of objects with explicit `typeId`\n\nIf you need to specify several values or an explicit type (`HOME`, `OTHER`):\n\n```json\n{\n  \"phone\": [\n    { \"value\": \"+12025550123\", \"typeId\": \"WORK\" },\n    { \"value\": \"+12025550124\", \"typeId\": \"OTHER\" }\n  ],\n  \"email\": [\n    { \"value\": \"info@example.com\", \"typeId\": \"WORK\" },\n    { \"value\": \"sales@example.com\", \"typeId\": \"MAILING\" }\n  ],\n  \"web\": [\n    { \"value\": \"https:\u002F\u002Fexample.com\", \"typeId\": \"WORK\" },\n    { \"value\": \"https:\u002F\u002Fexample.com\", \"typeId\": \"OTHER\" }\n  ]\n}\n```\n\n### Change or delete a single multifield row — `fm` keyed by row `id`\n\nSend `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.\n\n```json\n{\n  \"fm\": {\n    \"11\": { \"typeId\": \"PHONE\", \"valueType\": \"MOBILE\", \"value\": \"+14155550100\" },\n    \"10\": { \"typeId\": \"EMAIL\", \"value\": \"\" },\n    \"n0\": { \"typeId\": \"WEB\", \"valueType\": \"WORK\", \"value\": \"https:\u002F\u002Fexample.com\" }\n  }\n}\n```\n\n- A row accepts only `typeId`, `valueType` and `value`. `typeId` is the channel: `PHONE`, `EMAIL` or `WEB`. `valueType` is required when a row changes: send the current one to keep it. A new row defaults to `WORK`, a deletion needs none.\n- Before writing, Vibecode reads the company and checks that every `id` is a row of this company with the same `typeId`. Otherwise — `409 MULTIFIELD_ROW_NOT_FOUND`, and nothing is written.\n- After writing, the company is read again: every changed row is compared with the requested value (a phone by its digits, an email case-insensitively, a website case-insensitively only in its scheme and host), 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`.\n- 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`.\n- 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.\n- An `fm` object cannot be combined with `phone`, `email` and `web` in one request. An array in `phone`, `email`, `web` and `fm[]` still only add rows.\n- This form is available only in this `PATCH`. Batch updates, import and create accept `fm` only as an array.\n\n## Response fields\n\n| Field | Type | Description |\n|------|-----|---------|\n| `data` | object | The updated company object with all fields — see [Fields](\u002Fdocs\u002Fentities\u002Fcompanies\u002Ffields) |\n\nThe updated company object — see [Company fields](\u002Fdocs\u002Fentities\u002Fcompanies\u002Ffields).\n\n\n## Response example\n\n```json\n{\n  \"success\": true,\n  \"data\": {\n    \"id\": 1,\n    \"title\": \"Acme Inc. (updated)\",\n    \"industry\": \"MANUFACTURING\",\n    \"assignedById\": 1,\n    \"createdTime\": \"2020-05-08T10:48:20+00:00\",\n    \"updatedTime\": \"2026-04-15T12:00:00+00:00\"\n  }\n}\n```\n\n## Error response example\n\n404 — company not found:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"ENTITY_NOT_FOUND\",\n    \"message\": \"Item not found\"\n  }\n}\n```\n\n## Errors\n\n| HTTP | Code | Description |\n|------|-----|---------|\n| 404 | `ENTITY_NOT_FOUND` | Company not found |\n| 403 | `ACCESS_DENIED` | No access |\n| 400 | `INVALID_REQUEST` | Invalid fields |\n| 400 | `INVALID_MULTIFIELD_SHAPE` | Wrong shape for `phone`, `email` or `web`: the form with upper-case `VALUE` \u002F `VALUE_TYPE` keys is not accepted; the expected shape is `[{ \"value\", \"typeId\" }]`. The same code is returned when `phone`, `email` or `web` holds an object without `value` — for example empty or with keys such as `n0`, `0` or `011` — or a number or `true`\u002F`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`\u002F`EMAIL`\u002F`WEB`, `value` is not a string, a new row has an empty `value`, a changed row has no `valueType`, or `phone`\u002F`email`\u002F`web` 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 |\n| 400 | `MULTIFIELD_ID_NOT_SUPPORTED` | `phone`, `email`, `web` 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`, `email` or `web` 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` |\n| 409 | `MULTIFIELD_ROW_NOT_FOUND` | An `fm` key is the `id` of a row this company 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` |\n| 404, 429, 502 | `MULTIFIELD_PRECHECK_FAILED` | The current `fm` rows could not be read before writing: the company 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 |\n| 422 | `MULTIFIELD_NOT_APPLIED` | Bitrix24 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 |\n| 403 | `SCOPE_DENIED` | The API key does not have the `crm` scope |\n| 401 | `TOKEN_MISSING` | The API key has no configured tokens |\n\nFull list of common API errors — [Errors](\u002Fdocs\u002Ferrors).\n\n## See also\n\n- [Working with files in CRM fields](\u002Fdocs\u002Frecipes\u002Fcrm-files)\n- [Get company](\u002Fdocs\u002Fentities\u002Fcompanies\u002Fget)\n- [Company fields](\u002Fdocs\u002Fentities\u002Fcompanies\u002Ffields)\n- [Batch](\u002Fdocs\u002Fbatch)\n- [Limits and optimization](\u002Fdocs\u002Foptimization)\n","2026-11-12",{},1794739345207]