
## 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` and `entityId` is taken from the path and does not change. A full overwrite of all four links is available via [`POST /v1/requisite-links`](/docs/entities/requisite-links/register).

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `entityTypeId` (path) | number | yes | Link owner type. Values — [Link fields](/docs/entities/requisite-links/fields) |
| `entityId` (path) | number | yes | 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 link.

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `requisiteId` | number | no | Client requisite ID. Source: [`GET /v1/requisites`](/docs/entities/requisites/list). `0` — clear the link |
| `bankDetailId` | number | no | Client bank detail ID. Source: [`GET /v1/bank-details`](/docs/entities/bank-details/list). `0` — clear the link |
| `mcRequisiteId` | number | no | Your company's requisite ID. Source: [`GET /v1/requisites`](/docs/entities/requisites/list). `0` — clear the link |
| `mcBankDetailId` | number | no | Your company's bank detail ID. Source: [`GET /v1/bank-details`](/docs/entities/bank-details/list). `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 application

```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 application

```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, `0` — not linked |
| `data.bankDetailId` | number | Resulting client bank detail ID, `0` — not linked |
| `data.mcRequisiteId` | number | Your company's resulting requisite ID, `0` — not linked |
| `data.mcBankDetailId` | number | Your company's resulting bank detail ID, `0` — not linked |
| `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": "ENTITY_NOT_FOUND",
    "message": "Not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | No link for the `entityTypeId` and `entityId` pair — create it via `POST /v1/requisite-links` |
| 400 | `INVALID_ANCHOR` | `entityTypeId` or `entityId` in the path is not a positive integer |
| 400 | `INVALID_REQUEST` | The request body is not an object |
| 422 | `BITRIX_ERROR` | The link was rejected — for example, a requisite cannot be linked to a deal that has no client selected |
| 403 | `SCOPE_DENIED` | API key lacks the `crm` scope |
| 401 | `TOKEN_MISSING` | API key has no configured tokens |

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

## Known specifics

**An update does not create a link.** For a missing pair, `PATCH` returns `404`. To create a link or fully overwrite all four links, use [`POST /v1/requisite-links`](/docs/entities/requisite-links/register).

**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.

**An omitted field and `0` are different things.** An omitted field keeps its current value, while an explicit `0` clears the link.

## 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)
