# Get Mid-Market Rate

Returns the current mid-market exchange rate for a given currency pair.
This is the base rate before any FX fees — FX fees will be charged on top of this rate.
**Notes:**
- This returns the mid-market rate only. FX fees are charged separately on top of this rate during actual conversions.
- The rate is cached and `expires_at` indicates when the cached rate expires.

Endpoint: GET /fx-rate
Version: 1.0.0
Security: JWT

## Security:

  - `JWT` (unknown)
    http bearer JWT

## Query parameters:

  - `source_currency` (string, required)
    The source currency code in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format (e.g. USD).

  - `target_currency` (string, required)
    The target currency code in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) format (e.g. EUR).

## Response 200:

  - `200` (unknown)
    Success

## Response 200 fields (application/json):

  - `source_currency` (string)
    Source currency code.
    Example: USD

  - `target_currency` (string)
    Target currency code.
    Example: EUR

  - `mid_market_rate` (number)
    Mid-market exchange rate. FX fees are charged on top of this rate.
    Example: 0.859401

  - `expires_at` (string)
    ISO 8601 UTC timestamp indicating when this cached rate expires. A fresh rate is fetched from the provider after expiry.
    Example: 2026-05-05T08:39:18Z

## Response 400:

  - `400` (unknown)
    Bad Request

## Response 400 fields (application/json):

  - `error` (string)
    Enum: "Bad Request"

  - `message` (string)
    Error message indicating validation failure.
    Example: is not a valid currency

## Response 401:

  - `401` (unknown)
    Unauthorized

## Response 401 fields (application/json):

  - `error` (string)
    Example: Unauthorized

  - `message` (string)
    Example: Missing token

## Response 400 examples:

  - `Missing currency parameter` (unknown)

  - `Invalid ISO currency code` (unknown)

  - `Non-string currency parameter` (unknown)

