
## Search values

`POST /v1/catalog-product-property-enums/search`

Searches the options of a list property by conditions passed in the request body.

Unlike [`GET /v1/catalog-product-property-enums`](./list.md), the `filter`, `select`, `sort`, `limit`, and `offset` parameters are passed in the JSON body rather than in the query string — which is more convenient for conditions across several fields. The filter requirement is the same: the `propertyId` key is required. The response format matches the list.

## Request fields (body)

| Parameter | Type | Req. | Default | Description |
|----------|-----|:-----:|-----------|---------|
| `filter.propertyId` | number | **yes** | — | Identifier of the owning property from [`GET /v1/catalog-product-properties`](/docs/entities/catalog-product-properties/list). Without it the request is rejected with `400 MISSING_REQUIRED_FILTER` before Bitrix24 is called |
| `filter` | object | no | — | Other filtering conditions.<br>[Filtering syntax](/docs/filtering). Example: `{ "propertyId": 166, "def": true }` |
| `select` | string[] | no | — | Field selection: `["id", "value"]`. Without `select`, all element fields are returned |
| `sort` | string | no | — | Sort field. The `-` prefix means descending: `"-sort"` |
| `limit` | number | no | `50` | Number of records (up to 5000) |
| `offset` | number | no | `0` | Offset from the start of the selection |

As in the list, the end of the selection is signalled by `meta.hasMore` — Bitrix24 reports the total, so `meta.total` and `meta.hasMore` are trustworthy.

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-product-property-enums/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "propertyId": 166 },
    "sort": "sort",
    "limit": 1000
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/catalog-product-property-enums/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "filter": { "propertyId": 166 },
    "sort": "sort",
    "limit": 1000
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-product-property-enums/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { propertyId: 166 },
    sort: 'sort',
    limit: 1000,
  }),
})

const { success, data, meta } = await res.json()
console.log(`Options: ${meta.total}`)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/catalog-product-property-enums/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    filter: { propertyId: 166 },
    sort: 'sort',
    limit: 1000,
  }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | array | Array of options. The element field set — see [Value fields](./fields.md) |
| `meta.total` | number | How many records matched the filter. When Bitrix24 does not report it, the window length is returned |
| `meta.hasMore` | boolean | Whether more records exist beyond `limit`. Unreliable at the window edge — see the warning above |
| `meta.durationMs` | number | Request duration in milliseconds |

The `meta` fields sit next to `data`, not inside it.

A property that is not of the list type (`propertyType` other than `L`) has no enumeration: the request returns `200` with an empty `data`, not an error. Access is restricted by the employee's permissions in Bitrix24.

## Response example

```json
{
  "success": true,
  "data": [
    { "id": 110, "propertyId": 166, "value": "XS", "def": false, "sort": 100, "xmlId": null },
    { "id": 112, "propertyId": 166, "value": "S",  "def": false, "sort": 200, "xmlId": null },
    { "id": 114, "propertyId": 166, "value": "M",  "def": false, "sort": 300, "xmlId": null },
    { "id": 116, "propertyId": 166, "value": "L",  "def": false, "sort": 400, "xmlId": null },
    { "id": 118, "propertyId": 166, "value": "XL", "def": false, "sort": 500, "xmlId": null }
  ],
  "meta": {
    "total": 5,
    "hasMore": false,
    "durationMs": 148
  }
}
```

## Error response example

400 — the required filter is missing:

```json
{
  "success": false,
  "error": {
    "code": "MISSING_REQUIRED_FILTER",
    "message": "POST /v1/catalog-product-property-enums/search requires filter fields: propertyId. Example body: { \"filter\": {\"propertyId\":\"...\"} }"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `MISSING_REQUIRED_FILTER` | The body carries no `filter.propertyId` key. Bitrix24 is not called |
| 400 | `UNKNOWN_FILTER_FIELD` | Filtering by a field the enumeration element does not have. The message lists the available fields |
| 400 | `UNKNOWN_SORT_FIELD` | Sorting by a field the enumeration element does not have. The message lists the available fields |
| 403 | `SCOPE_DENIED` | The API key does not carry the `catalog` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header was not sent |

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

## See also

- [List values](/docs/entities/catalog-product-property-enums/list)
- [Get a value](/docs/entities/catalog-product-property-enums/get)
- [Value fields](/docs/entities/catalog-product-property-enums/fields)
- [Catalog product properties](/docs/entities/catalog-product-properties)
- [Catalog products](/docs/entities/catalog-products)
- [Filtering syntax](/docs/filtering)
- [Entity reference](/docs/entities-index)
