# POST /api/v1/businesses/{business_id}/cfo-portal/cash-forecast/versions/{version_id}/apply

> Re-apply a saved version's config to the live forecast

- **Tag:** cfo-portal
- **Operation ID:** `cfo_portal_apply_version_api_v1_businesses__business_id__cfo_portal_cash_forecast_versions__version_id__apply_post`

## Description

Load a saved version into the user's working scope.

Pushes the version's budget exclusion list to business settings
and replays its overrides into the working scope so the live
forecast recomputes against the saved configuration. The caller
should invalidate the cash-forecast query and use ``budget_id``
from the response to sync any local budget-selector state.

## Authentication

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

## Parameters

- `business_id` (path, string, required)
- `version_id` (path, string, required)

## Responses

### 201 — Successful Response

Schema: `CashForecastVersionApplyResponse`

- `version_id` (string · required)
- `budget_id` (string)
- `excluded_budget_ledger_ids` (array · string)
- `applied_override_count` (integer · required)

### 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/businesses/{business_id}/cfo-portal/cash-forecast/versions/{version_id}/apply' \
  -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/businesses/{business_id}/cfo-portal/cash-forecast/versions/{version_id}/apply', {
  method: 'POST',
  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.post("https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/versions/{version_id}/apply", headers=headers)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/cfo-portal/cfo-portal-apply-version
- OpenAPI slice: https://www.ondayzero.com/docs/reference/cfo-portal/cfo-portal-apply-version/openapi.json
- Other endpoints in **cfo-portal**: https://www.ondayzero.com/docs/reference/cfo-portal
