
## Update a preset field

`PATCH /v1/requisite-presets/:presetId/fields/:id`

Updates the field's system name, title, sort order or short-list flag on a preset field row. Send only the fields you want to change.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `presetId` (path) | number | yes | Requisite preset ID |
| `id` (path) | number | yes | Preset field row ID (from [`GET /v1/requisite-presets/:presetId/fields`](/docs/entities/requisite-presets/preset-fields/list) — the `id` field) |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|---------|
| `fieldName` | string | no | New system field name from the [fields available to add](/docs/entities/requisite-presets/preset-fields/available). If omitted, the current name is retained when the row is read successfully. Validation details are described below |
| `fieldTitle` | string | no | Field title in the Bitrix24 interface |
| `inShortList` | boolean | no | Whether to show the field in the short list. Accepts `true`/`false` |
| `sort` | number | no | Sort order of the field within the preset |

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/requisite-presets/1/fields/1" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "fieldTitle": "Company tax ID",
    "inShortList": false,
    "sort": 100
  }'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/requisite-presets/1/fields/1" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "sort": 100
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/requisite-presets/1/fields/1', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    fieldTitle: 'Company tax ID',
    inShortList: false,
    sort: 100,
  }),
})

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

### JavaScript — OAuth application

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

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Operation result |
| `data.id` | number | ID of the updated preset field row |
| `data.updated` | boolean | Always `true` on successful update |

## Response example

```json
{
  "success": true,
  "data": {
    "id": 1,
    "updated": true
  }
}
```

## Error response example

404 — field row not found:

```json
{
  "success": false,
  "error": {
    "code": "NOT_FOUND",
    "message": "Preset field 99999 not found in preset 1"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `NOT_FOUND` | No field row with this `id` found in the given preset |
| 400 | `INVALID_FIELD_NAME` | The current row was read successfully, and the `fieldName` sent differs from its name ignoring case and is absent from the recognised list of the [fields available to add](/docs/entities/requisite-presets/preset-fields/available). The update was not performed |
| 400 | `INVALID_FIELD_NAME` | `fieldName` was not sent as a string (a number, array, object, `null`). Message: `Field name must be a string, got <type>.` |
| 400 | `INVALID_PRESET_ID` | `presetId` is not a positive integer |
| 400 | `INVALID_FIELD_ID` | `id` is not a positive integer |
| 403 | `SCOPE_DENIED` | API key lacks the `crm` scope. Message: `This endpoint requires 'crm' scope` |
| 401 | `TOKEN_MISSING` | API key has no configured tokens |

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

## Known specifics

**A `fieldName` change is checked before writing when validation data is available.** If the current row is read successfully and the new name differs from the stored name ignoring case, it is checked against a recognised [list of fields available to add](/docs/entities/requisite-presets/preset-fields/available). A name absent from that list returns `400 INVALID_FIELD_NAME`. None of the requested changes are written. If reading the row or list fails, or the list shape is not recognised, validation is skipped and the request is forwarded to Bitrix24.

**The name uses Bitrix24's spelling when that spelling is available.** A name matching the current name uses the stored spelling. A validated rename uses the spelling from the available list. If validation is skipped, the request's spelling is forwarded.

**A successful preliminary read with no row returns `404 NOT_FOUND` before writing.** If the preliminary read fails, the update continues and the Bitrix24 call determines the response.

**Re-read the list before updating.** A field row `id` is positional and may change after the preset composition changes. Take the current `id` from a fresh [field list](/docs/entities/requisite-presets/preset-fields/list), finding the row by `fieldName` — otherwise the update may hit a different field.

## See also

- [List preset fields](/docs/entities/requisite-presets/preset-fields/list)
- [Add a field to a preset](/docs/entities/requisite-presets/preset-fields/create)
- [Delete a preset field](/docs/entities/requisite-presets/preset-fields/delete)
- [Requisite presets](/docs/entities/requisite-presets)
