## Set currency localizations

`PUT /v1/currencies/:id/localizations`

Creates or changes the currency display settings for the specified languages. Only the languages and fields you pass are updated.

Scope: `crm`.

## Parameters

| Parameter | Type | Required | Default | Description |
|----------|-----|:-----:|-----------|----------|
| `id` (path) | string | yes | — | Currency code from the [currency list](/docs/entities/currencies/list). Leading and trailing spaces are stripped, and letters are uppercased |

## Request fields (body)

| Field | Type | Required | Description |
|------|-----|:-----:|----------|
| `localizations` | object | yes | A non-empty map of languages. Other top-level fields are not accepted |
| `localizations.{lang}` | object | yes | A non-empty settings object for the `{lang}` language, for example `en` or `ru`. Pass at least one of the fields below in each object |
| `localizations.{lang}.fullName` | string | no | Full currency name |
| `localizations.{lang}.formatString` | string | no | Amount display template, `#` is the placeholder for the number |
| `localizations.{lang}.decPoint` | string | no | Decimal separator |
| `localizations.{lang}.thousandsVariant` | string | no | Thousands separator variant |
| `localizations.{lang}.thousandsSep` | string \| null | no | Thousands separator character. The stored value depends on `thousandsVariant` |
| `localizations.{lang}.decimals` | number | no | Number of digits after the decimal separator |
| `localizations.{lang}.hideZero` | boolean | no | Hide trailing zeros in the fractional part |

## Examples

### curl — personal key

```bash
curl -X PUT "https://vibecode.bitrix24.com/v1/currencies/QVC/localizations" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"localizations":{"en":{"fullName":"Example currency","formatString":"# QVC","decimals":2,"hideZero":false},"ru":{"fullName":"Example currency","formatString":"# QVC","decimals":2,"hideZero":false}}}'
```

### curl — OAuth application

```bash
curl -X PUT "https://vibecode.bitrix24.com/v1/currencies/QVC/localizations" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"localizations":{"en":{"fullName":"Example currency","formatString":"# QVC","decimals":2,"hideZero":false},"ru":{"fullName":"Example currency","formatString":"# QVC","decimals":2,"hideZero":false}}}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/currencies/QVC/localizations', {
  method: 'PUT',
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"localizations":{"en":{"fullName":"Example currency","formatString":"# QVC","decimals":2,"hideZero":false},"ru":{"fullName":"Example currency","formatString":"# QVC","decimals":2,"hideZero":false}}}),
})
const { success, data } = await res.json()
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/currencies/QVC/localizations', {
  method: 'PUT',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"localizations":{"en":{"fullName":"Example currency","formatString":"# QVC","decimals":2,"hideZero":false},"ru":{"fullName":"Example currency","formatString":"# QVC","decimals":2,"hideZero":false}}}),
})
const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|----------|
| `success` | boolean | Always `true` on success |
| `data` | boolean | Always `true`. The result is confirmed by a second read of the localizations |

## Response example

HTTP `200 OK`:

```json
{
  "success": true,
  "data": true
}
```

## Error response example

422 — the saved values did not match the ones passed. For example, `thousandsVariant` equals `B` while a space was passed in `thousandsSep`:

```json
{
  "success": false,
  "error": {
    "code": "BITRIX_ERROR",
    "message": "Bitrix24 did not apply the requested currency localizations"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|----------|
| 400 | `MISSING_REQUIRED_FIELDS` | `localizations` is missing or empty, other top-level fields were passed, a language code is empty, or its settings object is empty |
| 400 | `UNKNOWN_FIELD` | An unknown localization field was passed |
| 400 | `INVALID_FIELD_VALUE` | An object or an array was passed instead of a scalar value |
| 400 | `INVALID_ID` | The currency code is empty after spaces are stripped |
| 404 | `ENTITY_NOT_FOUND` | No currency with the specified code was found |
| 422 | `BITRIX_ERROR` | Bitrix24 rejected the write, reported a failure, or the second read did not confirm the passed values |
| 403 | `WRITE_BLOCKED_READONLY_KEY` | The key is in `READONLY` mode |
| 403 | `BITRIX_ACCESS_DENIED` | The user has no permission for the operation in Bitrix24 |
| 403 | `SCOPE_DENIED` | The API key does not have the `crm` scope |
| 401 | `MISSING_API_KEY` | The `X-Api-Key` header is missing |
| 401 | `TOKEN_MISSING` | The API key has no configured Bitrix24 tokens |
| 502 | `BITRIX_RESPONSE_INVALID` | A response with an unexpected structure was received |
| 502 | `BITRIX_UNAVAILABLE` | Bitrix24 is unavailable |

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

## Known specifics

The write is not transactional: an error does not roll back the values already saved. Before retrying, call [Get currency localizations](/docs/entities/currencies/localizations/get) and compare the current settings with the settings you need.

## See also

- [Get currency localizations](/docs/entities/currencies/localizations/get)
- [Currency localization fields](/docs/entities/currencies/localizations/fields)
- [Delete currency localizations](/docs/entities/currencies/localizations/delete)
