
## Update a requisite link

`PATCH /v1/requisite-links/:entityTypeId/:entityId`

Partially updates an existing link: only the fields you pass change, the rest are preserved. The owner pair `(entityTypeId, entityId)` is taken from the path — it cannot be changed (it is the link's key). If no link exists for the given pair, a `404` is returned.

> Bitrix24 has no dedicated update method for a requisite link — registration (`POST`) is itself an upsert that fully overwrites the link. `PATCH` was added for consistency with the rest of the Entity API: it first reads the current link, applies the passed fields on top of it, and re-registers — so omitted fields are not reset. Full overwrite is still available via [`POST /v1/requisite-links`](./register.md).

## Path parameters

| Parameter | Type | Description |
|----------|-----|---------|
| `entityTypeId` | number | Link owner type: `2` — deal, `31` — invoice |
| `entityId` | number | Owner entity ID |

## Request fields (body)

Pass only the fields you want to change. Omitted fields keep their current value. Pass `0` to clear a slot.

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `requisiteId` | number | no | Client requisite ID. Source: `GET /v1/requisites`. `0` — clear the link |
| `bankDetailId` | number | no | Client bank requisite ID. Source: `GET /v1/bank-details`. `0` — clear the link |
| `mcRequisiteId` | number | no | Your company's requisite ID. Source: `GET /v1/requisites`. `0` — clear the link |
| `mcBankDetailId` | number | no | Your company's bank requisite ID. Source: `GET /v1/bank-details`. `0` — clear the link |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/requisite-links/2/3773" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "requisiteId": 46
  }'
```

### curl — OAuth app

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/requisite-links/2/3773" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "requisiteId": 46
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/requisite-links/2/3773', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    requisiteId: 46,
  }),
})

const { success, data } = await res.json()
console.log('Updated link for entityId:', data.entityId)
```

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/requisite-links/2/3773', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    requisiteId: 46,
  }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Link state after the update |
| `data.entityTypeId` | number | Owner type from the path |
| `data.entityId` | number | Owner ID from the path |
| `data.requisiteId` | number | Resulting client requisite ID |
| `data.bankDetailId` | number | Resulting client bank requisite ID |
| `data.mcRequisiteId` | number | Resulting requisite ID of your company |
| `data.mcBankDetailId` | number | Resulting bank requisite ID of your company |
| `data.updated` | boolean | Always `true` on success |

## Response example

HTTP status: `200 OK`

```json
{
  "success": true,
  "data": {
    "entityTypeId": 2,
    "entityId": 3773,
    "requisiteId": 46,
    "bankDetailId": 12,
    "mcRequisiteId": 3,
    "mcBankDetailId": 7,
    "updated": true
  }
}
```

## Error response example

404 — no link exists for the given pair:

```json
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "No requisite link for entityTypeId=2, entityId=3773"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_ANCHOR` | `entityTypeId` or `entityId` in the path is not a positive integer |
| 400 | `INVALID_REQUEST` | Request body is not an object with link fields |
| 404 | `NOT_FOUND` | No link for the `(entityTypeId, entityId)` pair — create it via `POST /v1/requisite-links` |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the operation — for example, the requisite does not belong to the deal's client |
| 403 | `SCOPE_DENIED` | API key lacks the `crm` scope. Expected message: `This endpoint requires 'crm' scope` |
| 401 | `TOKEN_MISSING` | API key has no tokens configured |

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

## Notes

**Update is unavailable for a non-existent link.** `PATCH` does not create a link — it answers `404` for a missing pair. To create or fully overwrite a link, use [`POST /v1/requisite-links`](./register.md).

**The link key does not change.** `entityTypeId` and `entityId` come from the path and are not updated. To re-link a requisite to a different owner, delete the old link and register a new one.

**Pass `0` to clear a link.** An omitted field keeps its current value; an explicit `0` clears that slot.

## See also

- [Register a link](/docs/entities/requisite-links/register)
- [Get a link](/docs/entities/requisite-links/get)
- [Delete a link](/docs/entities/requisite-links/unregister)
- [Link fields](/docs/entities/requisite-links/fields)
- [Batch](/docs/batch)
