## Basket item property fields

`GET /v1/basket-item-properties/fields`

Describes basket item property fields for creation, updates, selection, and filtering, and lists grouping fields.

## Parameters

| Parameter | Type | Default | Description |
|---|---|---|---|
| `refresh` (query) | string | `false` | Pass `true` to retrieve metadata without the cache |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/basket-item-properties/fields" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/basket-item-properties/fields" \
  -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/basket-item-properties/fields', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/basket-item-properties/fields', {
  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 | Basket item property metadata |
| `data.fields` | object | Field definitions. Each key is a field name and each value describes the field |
| `data.fields.<field>.type` | string | Value type: `number` or `string` |
| `data.fields.<field>.readonly` | boolean | `true` marks a read-only field |
| `data.fields.<field>.createOnly` | boolean | Present as `true` for `basketId`, which can only be set at creation |
| `data.fields.<field>.required` | boolean | Present as `true` for fields required at creation: `basketId`, `name`, `value`, `code` |
| `data.fields.<field>.nullable` | boolean | Present as `true` for `value`, `code`, `xmlId`, which accept `null` |
| `data.fields.<field>.label` | string | Field label |
| `data.fields.<field>.description` | string | Field description |
| `data.aggregatable` | array | Fields for `groupBy` in [aggregation](/docs/entities/basket-item-properties/aggregate): `basketId`, `code` |
| `data.batch` | array | Batch write operations: `create`, `update`, `delete` |

### Basket item property fields

The complete set of schema fields. RO marks a read-only field.

| Field | Type | RO | Description |
|---|---|---|---|
| `id` | number | yes | Property ID. Source: [`GET /v1/basket-item-properties`](/docs/entities/basket-item-properties/list) |
| `basketId` | number | no | Basket item ID. Source: [`GET /v1/basket-items`](/docs/entities/basket-items/list). Required at creation and cannot be updated |
| `name` | string | no | Property name. Required at creation |
| `value` | string \| null | no | Property value. Required at creation |
| `code` | string \| null | no | Property symbolic code. Required at creation |
| `sort` | number | no | Sort order of the property within the item |
| `xmlId` | string \| null | no | External ID |

## Response example

```json
{
  "success": true,
  "data": {
    "fields": {
      "id": {
        "type": "number",
        "readonly": true,
        "label": "ID",
        "description": "ID."
      },
      "basketId": {
        "type": "number",
        "readonly": false,
        "createOnly": true,
        "required": true,
        "label": "Basket item ID",
        "description": "Basket item ID."
      },
      "name": {
        "type": "string",
        "readonly": false,
        "required": true,
        "label": "Name",
        "description": "Name."
      },
      "value": {
        "type": "string",
        "readonly": false,
        "required": true,
        "nullable": true,
        "label": "Value",
        "description": "Value."
      },
      "code": {
        "type": "string",
        "readonly": false,
        "required": true,
        "nullable": true,
        "label": "Code",
        "description": "Code."
      },
      "sort": {
        "type": "number",
        "readonly": false,
        "label": "Sort order",
        "description": "Sort order."
      },
      "xmlId": {
        "type": "string",
        "readonly": false,
        "nullable": true,
        "label": "External ID",
        "description": "External ID."
      }
    },
    "aggregatable": [
      "basketId",
      "code"
    ],
    "batch": [
      "create",
      "update",
      "delete"
    ]
  }
}
```

## Error response example

401 — the API key is missing:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_API_KEY",
    "message": "API key required. Pass via X-Api-Key header."
  }
}
```

## Errors

| HTTP | Code | Description |
|---|---|---|
| 403 | `SCOPE_DENIED` | The API key lacks the `sale` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `TOKEN_MISSING` | No Bitrix24 access tokens are configured |
| 429 | `RATE_LIMITED` | The request rate limit was exceeded. Retry after the interval in the `Retry-After` header |

For the full list of common API errors, see [Error codes](/docs/errors).

## See also

- [List basket item properties](/docs/entities/basket-item-properties/list)
- [Get a basket item property](/docs/entities/basket-item-properties/get)
- [Create a basket item property](/docs/entities/basket-item-properties/create)
- [Update a basket item property](/docs/entities/basket-item-properties/update)
- [Aggregate basket item properties](/docs/entities/basket-item-properties/aggregate)
- [Batch calls](/docs/batch)
- [Entity API](/docs/entity-api)
