
## Preset field schema

`GET /v1/requisite-presets/:presetId/fields/schema`

Returns the structure of a requisite preset field row: types, required flags, access flags. Use it to learn the allowed types and rules before `POST /v1/requisite-presets/:presetId/fields` or `PATCH /v1/requisite-presets/:presetId/fields/:id`.

## Parameters

| Parameter | Type | Required | Description |
|----------|-----|:-----:|---------|
| `presetId` (path) | number | yes | Requisite preset ID. Get the list of presets: `GET /v1/requisite-presets` |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/requisite-presets/1/fields/schema" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth app

```bash
curl "https://vibecode.bitrix24.com/v1/requisite-presets/1/fields/schema" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/requisite-presets/1/fields/schema', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

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

### JavaScript — OAuth app

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/requisite-presets/1/fields/schema', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Object describing the schema |
| `data.fields` | object | Dictionary of preset row fields. The keys are in camelCase: `id`, `fieldName`, and others |
| `data.fields.id` | object | Field row identifier. Read-only |
| `data.fields.fieldName` | object | Requisite field name, for example `RQ_INN`. Required on create. On update it does not need to be passed — the current value is substituted automatically |
| `data.fields.fieldTitle` | object | Field title in the printed form. Not required |
| `data.fields.sort` | object | Sort order of the field within the preset |
| `data.fields.inShortList` | object | Whether the field is shown in the short list. Represented in the API as `true`/`false` |

Each field in `data.fields` is described by an object with the following keys:

| Key | Type | Description |
|------|-----|---------|
| `type` | string | Value type: `integer`, `string`, `char` |
| `isRequired` | boolean | Whether the field is required on create |
| `isReadOnly` | boolean | Read-only — cannot be set on write |
| `isImmutable` | boolean | Cannot be changed after creation |
| `isMultiple` | boolean | Allows multiple values |
| `isDynamic` | boolean | Dynamic (custom) field |
| `title` | string | Human-readable field name in the Bitrix24 account language |

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": {
        "type": "integer",
        "isRequired": false,
        "isReadOnly": true,
        "isImmutable": false,
        "isMultiple": false,
        "isDynamic": false,
        "title": "ID"
      },
      "fieldName": {
        "type": "string",
        "isRequired": true,
        "isReadOnly": false,
        "isImmutable": false,
        "isMultiple": false,
        "isDynamic": false,
        "title": "Name"
      },
      "fieldTitle": {
        "type": "string",
        "isRequired": false,
        "isReadOnly": false,
        "isImmutable": false,
        "isMultiple": false,
        "isDynamic": false,
        "title": "Title in the preset"
      },
      "sort": {
        "type": "integer",
        "isRequired": false,
        "isReadOnly": false,
        "isImmutable": false,
        "isMultiple": false,
        "isDynamic": false,
        "title": "Sort"
      },
      "inShortList": {
        "type": "char",
        "isRequired": false,
        "isReadOnly": false,
        "isImmutable": false,
        "isMultiple": false,
        "isDynamic": false,
        "title": "Show in short list"
      }
    }
  }
}
```

## Error response example

```json
{
  "success": false,
  "error": {
    "code": "SCOPE_DENIED",
    "message": "This endpoint requires 'crm' scope"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `INVALID_PRESET_ID` | The provided `presetId` is not a positive integer |
| 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

**The `inShortList` field is described in the schema with the `char` type, but the API works with a boolean.** When writing via `POST` or `PATCH`, pass `true`/`false`. In read responses the field arrives as `true`/`false`.

**The schema declares `fieldName` as required (`isRequired: true`), but it does not need to be passed on update.** On a `PATCH` without `fieldName`, Vibecode fetches the current value from Bitrix24 and substitutes it automatically. `fieldName` remains required when creating via `POST`.

## See also

- [Fields available to add](/docs/entities/requisite-presets/preset-fields/available)
- [Add a field to a preset](/docs/entities/requisite-presets/preset-fields/create)
- [Update a preset field](/docs/entities/requisite-presets/preset-fields/update)
- [Requisite presets](/docs/entities/requisite-presets)
