# POST /api/v1/fx/revalue

> Post FX revaluation

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

## Description

Revalue open foreign AR/AP and post the adjusting JE.

## Authentication

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

## Request body

Schema: `FxRevaluationRequest`

- `as_of_date` (string · date · required)
- `post` (boolean) — Post the adjusting JE (false = preview only).

## Responses

### 201 — 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

### 404 — Not Found - Resource does not exist

### 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 POST 'https://api.ondayzero.com/api/v1/fx/revalue' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "as_of_date": "2026-01-01"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/fx/revalue', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "as_of_date": "2026-01-01"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "as_of_date": "2026-01-01"
}

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

## See also

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