> ## Documentation Index
> Fetch the complete documentation index at: https://api.csboard.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GET /v1/currency — курсы валют для конвертации USD

> Получите таблицу курсов валют с базой USD, которую использует CSBoard в платежных потоках. Умножайте любой price_usd на курс целевой валюты, чтобы получить цену в локальной валюте.

Все цены в API CSBoard выражены в USD. Эндпоинт currency возвращает ту же таблицу курсов, что используется во внутренних потоках сайта для платежей и отображения цен, обеспечивая единый слой конвертации для показа пользователям цен в локальной валюте. Курсы получаются из OpenExchangeRates для основных валют и из Центрального банка России для RUB; кэшируются примерно на один час.

**Требуется аутентификация.** Отправьте ключ как `Authorization: Bearer csb_pub_...`.

## Параметры

Этот эндпоинт не принимает query-параметров.

## Поля ответа

<ResponseField name="base" type="string" required>
  Всегда `"USD"`. Все курсы выражены относительно одного доллара США.
</ResponseField>

<ResponseField name="rates" type="object" required>
  Соответствие кодов валют ISO 4217 их курсам к USD (единиц этой валюты за 1 USD). Пример: `{ "USD": 1, "EUR": 0.92, "RUB": 78.4, "GBP": 0.79 }`.
</ResponseField>

<ResponseField name="updated_at" type="datetime" required>
  Временная метка ISO 8601, когда таблица курсов была последний раз обновлена.
</ResponseField>

<ResponseField name="rub_source" type="string">
  Идентификатор источника курса RUB, например `"cbr"` (Центральный банк России).
</ResponseField>

<ResponseField name="base_source" type="string">
  Идентификатор источника для курсов, отличных от RUB, например `"openexchangerates"`.
</ResponseField>

## Конвертация цен

Чтобы отобразить значение `price_usd` в локальной валюте, умножьте его на соответствующий курс:

```
local_price = price_usd × rates["EUR"]
# например, 14.37 USD × 0.92 = 13.22 EUR
```

Поскольку таблица курсов кэшируется примерно на 1 час, запрашивайте её один раз при старте приложения и периодически обновляйте, а не вызывайте этот эндпоинт для каждого товара.

## Пример запроса

```bash theme={null}
curl https://csboard.com/v1/currency \
  -H "Authorization: Bearer csb_pub_..."
```

## Пример ответа

```json theme={null}
{
  "base": "USD",
  "rates": {
    "USD": 1,
    "EUR": 0.92,
    "RUB": 78.4,
    "GBP": 0.79
  },
  "updated_at": "2026-06-29T17:00:00Z",
  "rub_source": "cbr",
  "base_source": "openexchangerates"
}
```

## Коды ошибок

| HTTP-статус | Код                   | Значение                                                                    |
| ----------- | --------------------- | --------------------------------------------------------------------------- |
| 401         | `unauthorized`        | Отсутствует или некорректный API-ключ.                                      |
| 429         | `rate_limit_exceeded` | Более 30 запросов/мин. Перед повтором сверьтесь с заголовком `Retry-After`. |

<Tip>
  Кэшируйте ответ rates на стороне клиента и обновляйте не чаще одного раза в час. Курсы обновляются на том же \~1-часовом цикле, поэтому более частые опросы не дадут более свежих данных и впустую расходуют лимит запросов.
</Tip>


## OpenAPI

````yaml GET /currency
openapi: 3.1.0
info:
  title: CSBoard API
  version: 1.0.0
  description: >-
    Market data over the CSBoard marketplace — live listings, floats, stickers,
    minAsk prices, FX rates — plus opt-in buying straight from your balance.
    Free to read, key-gated, built for automation.
  contact:
    name: CSBoard
    url: https://csboard.com/docs
servers:
  - url: https://csboard.com/v1
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Status
    description: Liveness and freshness probes.
  - name: Market data
    description: Read the live catalog, prices, and FX rates.
  - name: Trading
    description: Buy listings from your CSBoard balance. Opt-in, key-gated.
  - name: Account
    description: Your balance, settled funds, and trading status.
paths:
  /currency:
    get:
      tags:
        - Market data
      summary: FX rates (USD base)
      description: >-
        FX rates with USD as the base. Every price in this API is USD — use this
        to convert to a local currency. Same rate table the site and payment
        flows use (cached ~1h).
      operationId: getCurrency
      responses:
        '200':
          description: Current FX rates.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Currency'
              example:
                base: USD
                rates:
                  USD: 1
                  EUR: 0.92
                  RUB: 78.4
                  GBP: 0.79
                updated_at: '2026-06-29T17:00:00Z'
                rub_source: cbr
                base_source: openexchangerates
        '401':
          $ref: '#/components/responses/Unauthorized'
        '429':
          $ref: '#/components/responses/RateLimited'
components:
  schemas:
    Currency:
      type: object
      properties:
        base:
          type: string
          example: USD
        rates:
          type: object
          additionalProperties:
            type: number
          description: Currency code → units per 1 USD.
        updated_at:
          type: string
          format: date-time
        rub_source:
          type: string
        base_source:
          type: string
      required:
        - base
        - rates
        - updated_at
    Error:
      type: object
      description: >-
        All errors return { code, detail }. Some carry extra fields (e.g.
        price_moved adds current_total_usd, insufficient_balance adds
        required_usd/current_usd).
      properties:
        code:
          type: string
          description: >-
            Machine-readable error code, e.g. rate_limit_exceeded,
            trading_not_enabled, price_moved.
        detail:
          type: string
          description: Human-readable explanation.
      required:
        - code
  responses:
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: unauthorized
            message: Missing or invalid API key.
    RateLimited:
      description: Rate limit exceeded. Includes a Retry-After header.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: rate_limit_exceeded
            message: Too many requests.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Send your key as a Bearer token on every request: `Authorization: Bearer
        csb_pub_...`. Generate keys in your CSBoard profile.

````