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

> Save the current cash forecast configuration as a named version

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

## Description

Snapshot the current cash forecast configuration + output.

The version captures the chosen budget, excluded ledgers, embedded
one-time items, cell overrides and forecast switches, along with the
full computed forecast JSON. The snapshot is what stays stable as
live data drifts; the config is what's replayed on load.

**Request Body:** ``config.overrides`` omitted or null saves the
working override set (the Reorder Cash Planner); ``[]`` saves none
(the live Cash Flow Forecast tab, which ignores overrides). Duplicate
cells or ``weeks`` outside 1-52 are refused with 400.

## Authentication

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

## Parameters

- `business_id` (path, string, required)

## Request body

Schema: `CashForecastVersionCreate`

- `name` (string · required)
- `description` (string)
- `config` (CashForecastVersionConfig) → `CashForecastVersionConfig`
  - `budget_id` (string)
  - `excluded_budget_ledger_ids` (array · string)
  - `weeks` (integer)
  - `one_time_items_snapshot` (array · CashForecastOneTimeItemBase) → `CashForecastOneTimeItemBase` — Snapshot of the one-time items as they existed when the version was saved. Replays against live data don't re-load from the live ``cash_forecast_one_time_items`` table.
  - `overrides` (array · CashForecastOverrideInput) — Cell overrides saved with the version. On save, omit (null) to capture the working override set, pass [] to save none (the live Cash Flow Forecast tab, which ignores overrides). On read, null means the version predates override capture.
  - `include_projected_replenishment` (boolean) — Projected replenishment POs were in the forecast.
  - `include_unapproved_ap` (boolean) — Bills awaiting approval were in the forecast.
  - `net_bills_against_budget` (boolean) — Open bills were netted against their budget line.

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_CashForecastVersionDetail_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (CashForecastVersionDetail)

### 400 — Bad Request - Invalid input

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 401 — Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 403 — Forbidden - Insufficient permissions

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

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

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation Error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/versions' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/versions', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "name": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {'name': 'string'}

response = httpx.post("https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/versions", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/cfo-portal/cfo-portal-create-version
- OpenAPI slice: https://www.ondayzero.com/docs/reference/cfo-portal/cfo-portal-create-version/openapi.json
- Other endpoints in **cfo-portal**: https://www.ondayzero.com/docs/reference/cfo-portal (markdown bundle: https://www.ondayzero.com/docs/reference/cfo-portal.md, OpenAPI: https://www.ondayzero.com/docs/reference/cfo-portal/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
