
## Update currency

`PATCH /v1/currencies/:id`

Updates currency fields by code. Use it to update the exchange rate.

## Path parameters

| Parameter | Type | Description |
|----------|-----|---------|
| `id` | string | Currency code (USD, EUR, …) |

## Request body parameters

| Parameter | Type | Description |
|----------|-----|---------|
| `amount` | number | Exchange rate |
| `amountCnt` | number | Number of units for the rate |
| `sort` | number | Sort order |
| `fullName` | string | Currency name |
| `formatString` | string | Display template, e.g. `# $` |
| `decimals` | number | Number of decimal places |
| `decPoint` | string | Decimal separator |
| `thousandsSep` | string | Thousands separator |

> **Localizable fields can be sent flat.** The API packs `fullName`, `formatString`, `decimals`, `decPoint`, `thousandsSep` into **your** language's localization (the API key's language), so a flat update persists and reads back. A raw `LANG` object in the body is **not** accepted — the field is read-only and returns `400 READONLY_FIELD`. Setting different values for several languages at once via the API is not yet supported.

## Examples

### curl — personal key

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/currencies/USD" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount": 94.2}'
```

### curl — OAuth application

```bash
curl -X PATCH "https://vibecode.bitrix24.com/v1/currencies/USD" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"amount": 94.2}'
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/currencies/USD', {
  method: 'PATCH',
  headers: { 'X-Api-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
  body: JSON.stringify({ amount: 94.2 }),
})
const { success, data } = await res.json()
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/currencies/USD', {
  method: 'PATCH',
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ amount: 94.2 }),
})
const { success, data } = await res.json()
```

## Response fields

After the write, the full currency object is returned.

| Field | Type | Description |
|------|-----|---------|
| `id` | string | Currency code (USD, EUR, …) |
| `amountCnt` | number | Number of units for the rate |
| `amount` | number | Exchange rate |
| `sort` | number | Sort order |
| `base` | boolean | Base currency |
| `fullName` | string | Name (US Dollar, $) |
| `lid` | string | ID of the site the currency is bound to |
| `formatString` | string | Display format |
| `decPoint` | string | Decimal separator |
| `thousandsSep` | string | Thousands separator |
| `decimals` | number | Decimal places |
| `dateUpdate` | datetime | Date of the last update |

## Response example

```json
{
  "success": true,
  "data": {
    "id": "USD",
    "fullName": "US Dollar",
    "amount": 94.2,
    "amountCnt": 1,
    "base": false,
    "sort": 200,
    "lid": "en",
    "formatString": "$#",
    "decimals": 2,
    "decPoint": ".",
    "thousandsSep": ",",
    "dateUpdate": "2024-11-12T07:20:08.000Z"
  }
}
```


## Error response example

```json
{
  "success": false,
  "error": { "code": "ENTITY_NOT_FOUND", "message": "Currency is not found" }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | Currency not found |
| 400 | `READONLY_FIELD` | The body contains a read-only field, such as `LANG` or `dateUpdate`. The field name is given in `message` |
| 403 | `SCOPE_DENIED` | API key does not have the `crm` scope |
| 401 | `TOKEN_MISSING` | No API key provided |

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

## See also

- [Get currency](/docs/entities/currencies/get)
- [Field reference](/docs/entities/currencies/fields)
- [Currencies](/docs/entities/currencies)
