## Currency search

`POST /v1/currencies/search`

Returns the Bitrix24 account currencies with field selection, sorting, and pagination passed in the POST request body.

Server-side filtering is not supported for currencies: any key in `filter` returns `400 UNSUPPORTED_FILTER`. To pick the currencies you need, retrieve the whole directory and filter the records client-side. A Bitrix24 account has only a handful of currencies, so the request returns the same directory as the [currency list](/docs/entities/currencies/list) — the only difference is that parameters are passed in the request body instead of the query string.

## Request fields (body)

| Parameter | Type | Default | Description |
|----------|-----|-----------|---------|
| `select` | string[] | — | Field selection: `["id", "fullName", "amount"]` |
| `order` | object | — | Sorting: `{ "sort": "asc" }` |
| `limit` | number | `50` | Number of records |
| `offset` | number | `0` | Skip N records from the start of the selection |
| `filter` | object | — | Not supported for currencies. Any key returns `400 UNSUPPORTED_FILTER`. Retrieve the whole directory and filter the records client-side |

## Examples

### curl — personal key

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/currencies/search" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "select": ["id", "fullName", "amount", "base"],
    "order": { "sort": "asc" },
    "limit": 3
  }'
```

### curl — OAuth application

```bash
curl -X POST "https://vibecode.bitrix24.com/v1/currencies/search" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "select": ["id", "fullName", "amount", "base"],
    "order": { "sort": "asc" },
    "limit": 3
  }'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/currencies/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    select: ['id', 'fullName', 'amount', 'base'],
    order: { sort: 'asc' },
    limit: 3,
  }),
})

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

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/currencies/search', {
  method: 'POST',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    select: ['id', 'fullName', 'amount', 'base'],
    order: { sort: 'asc' },
    limit: 3,
  }),
})

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

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `data` | array | Array of currencies (fields — see [Fields](/docs/entities/currencies/fields)) |
| `meta.total` | number | How many currencies are in the directory |
| `meta.hasMore` | boolean | Whether there is a next page |
| `meta.durationMs` | number | Request duration in milliseconds |

The `meta` fields sit next to `data`, not inside it. Iterate over pages using `meta.hasMore`: a `data` length equal to `limit` does not rule out the last page.

## Response example

```json
{
  "success": true,
  "data": [
    { "id": "USD", "fullName": "US Dollar", "amount": 1, "base": true },
    { "id": "THB", "fullName": "Baht", "amount": 5, "base": false },
    { "id": "EUR", "fullName": "Euro", "amount": 1, "base": false }
  ],
  "meta": { "total": 7, "hasMore": true, "durationMs": 148 }
}
```

## Error response example

400 — filtering is not supported:

```json
{
  "success": false,
  "error": {
    "code": "UNSUPPORTED_FILTER",
    "message": "UNSUPPORTED_FILTER: 'currencies' does not support server-side filtering. Its Bitrix24 method (crm.currency.list) silently ignores every filter key and returns the full list — retrieve all records and filter client-side."
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 400 | `UNSUPPORTED_FILTER` | Any key passed in `filter`. Currencies are not filtered server-side — retrieve the whole directory and filter the records client-side |
| 403 | `SCOPE_DENIED` | The API key does not have the `crm` scope |
| 401 | `TOKEN_MISSING` | No API key passed |

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

## See also

- [Currencies](/docs/entities/currencies)
- [Currency list](/docs/entities/currencies/list)
- [Currency aggregation](/docs/entities/currencies/aggregate)
- [Batch](/docs/batch)
