# GET /api/v1/fx/exposure

> FX exposure preview

- **Tag:** fx-rates
- **Operation ID:** `fx_exposure_api_v1_fx_exposure_get`

## Description

Per-currency open AR/AP exposure and unrealized gain/loss.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Parameters

- `as_of_date` (query, string · date, required) — Revaluation date.

## Responses

### 200 — Successful Response

Schema: `FxRevaluationResponse`

- `as_of_date` (string · date · required)
- `base_currency` (string · required)
- `exposures` (array · FxCurrencyExposure · required) → `FxCurrencyExposure`
  - `currency` (string · required)
  - `receivable_foreign` (integer) — Open AR balance in the foreign currency (cents).
  - `payable_foreign` (integer) — Open AP balance in the foreign currency (cents).
  - `booked_rate` (string)
  - `current_rate` (string)
  - `receivable_gain_loss` (integer) — AR revaluation gain(+)/loss(-) in base cents.
  - `payable_gain_loss` (integer) — AP revaluation gain(+)/loss(-) in base cents.
  - `net_gain_loss` (integer) — Net gain(+)/loss(-) in base cents.
- `total_gain_loss` (integer) — Net unrealized FX gain(+)/loss(-) in base cents.
- `journal_entry_id` (string) — Posted adjusting JE id (null for a preview).
- `posted` (boolean)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 422 — Validation Error

Schema: `HTTPValidationError`

- `detail` (array · ValidationError) → `ValidationError`
  - `loc` (array · string | integer · required)
  - `msg` (string · required)
  - `type` (string · required)
  - `input` (object)
  - `ctx` (object)

## Code samples

### cURL

```bash
curl -X GET 'https://api.ondayzero.com/api/v1/fx/exposure' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/fx/exposure', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
  },
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

response = httpx.get("https://api.ondayzero.com/api/v1/fx/exposure", headers=headers)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/fx-rates/fx-exposure
- OpenAPI slice: https://www.ondayzero.com/docs/reference/fx-rates/fx-exposure/openapi.json
- Other endpoints in **fx-rates**: https://www.ondayzero.com/docs/reference/fx-rates
