
## Update lead

`PATCH /v1/leads/:id`

Updates the fields of an existing lead. Pass only the fields to change. Full list in the [field reference](/docs/entities/leads/fields), including user fields (`ufCrm_*`).

> ⚠ **Important about `email` / `phone` (multifield):** On update, Bitrix24 **only adds** new multifield records. PATCH `{"email": "new@y.com"}` on a lead that already has an email **will not replace** the old one — the lead will end up with two emails. This is Bitrix24-specific behavior, not Vibecode. To replace or remove email/phone — edit the lead through the Bitrix24 UI.

## Frequently updated fields

| Parameter | Type | Description |
|----------|-----|---------|
| `stageId` | string | Lead 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 |
| `opportunity` | number | Amount — canonical name, the `amount` alias is also accepted. ⚠ For the value to persist, pass `isManualOpportunity: true` in the same request |
| `assignedById` | number | Assignee. List: `GET /v1/users` |
| `title` | string | Lead title |
| `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`). ⚠ The UPPER form `[{ "VALUE": "...", "VALUE_TYPE": "WORK" }]` is **not accepted** — it returns `400 INVALID_MULTIFIELD_SHAPE`. Use camelCase: `[{ "value": "...", "typeId": "WORK" }]` |
| `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`). ⚠ The UPPER form `[{ "VALUE": "...", "VALUE_TYPE": "WORK" }]` is **not accepted** — it returns `400 INVALID_MULTIFIELD_SHAPE`. Use camelCase: `[{ "value": "...", "typeId": "WORK" }]` |

## Examples

### curl — personal key

```bash
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": 250000,
    "isManualOpportunity": true,
    "assignedById": 3,
    "title": "Website request — hot client"
  }'
```

### curl — OAuth application

```bash
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": 250000,
    "isManualOpportunity": true,
    "assignedById": 3,
    "title": "Website request — hot client"
  }'
```

### 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: 250000,
    isManualOpportunity: true,
    assignedById: 3,
    title: 'Website request — hot client',
  }),
})

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: 250000,
    isManualOpportunity: true,
    assignedById: 3,
    title: 'Website request — hot client',
  }),
})

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" }
  ]
}
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `data` | object | The updated lead object with all fields — see [Fields](/docs/entities/leads/fields) |

The updated lead object — see [Lead fields](/docs/entities/leads/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 |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | Lead not found |
| 403 | `ACCESS_DENIED` | No access |
| 400 | `INVALID_MULTIFIELD_SHAPE` | Wrong shape for `phone` or `email` — expects `[{ "value", "typeId" }]` |
| 400 | `READONLY_FIELD` | Attempt to write a read-only field |
| 403 | `SCOPE_DENIED` | The API key does not have the `crm` scope |
| 401 | `TOKEN_MISSING` | The API key has no configured tokens |

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

## See also

- [Working with files in CRM fields](/docs/recipes/crm-files)
- [Get lead](/docs/entities/leads/get)
- [Lead fields](/docs/entities/leads/fields)
- [Statuses](/docs/entities/statuses)
- [Batch](/docs/batch)
- [Limits and optimization](/docs/optimization)
