# PUT /api/v1/businesses/{business_id}/cfo-portal/cash-forecast/overrides

> Replace all cash forecast overrides in a scope

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

## Description

Atomically replace every override row in the matching scope.

**Request Body:**
- ``version_id``: Optional. If null, replaces the working override
  set; otherwise replaces overrides pinned to that saved version.
- ``overrides``: List of cells to override (week_number / column /
  amount_cents).

- ``merge``: Optional, default false. True sets only the cells sent
  and keeps the scope's other overrides; the response lists the
  scope's full set.

**Effect:** Without ``merge``, all existing overrides in the scope
are deleted, then the provided rows are inserted. Use the empty list
to clear the scope without deleting the URL.

## Authentication

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

## Parameters

- `business_id` (path, string, required)

## Request body

Schema: `CashForecastOverridesUpsert`

- `version_id` (string)
- `overrides` (array · CashForecastOverrideInput) → `CashForecastOverrideInput`
  - `week_number` (integer · required)
  - `column` (string · required) (one of: ar_in, ap_out, inventory, debt, debt_in, budget_rev, budget_exp, one_time)
  - `amount_cents` (integer)
  - `source` (string) (one of: user, ai)
  - `ai_scenario_label` (string)
  - `note` (string)
- `merge` (boolean) — False (default) replaces every override in the scope. True sets only the cells sent and keeps the scope's other overrides (applying a Scenario Lab result to the plan).

## Responses

### 200 — Successful Response

Schema: `SuccessEnvelope_CashForecastOverrideList_`

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

### 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 PUT 'https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/cash-forecast/overrides' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "version_id": "string",
  "overrides": [],
  "merge": false
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {'version_id': 'string', 'overrides': [], 'merge': False}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/cfo-portal/cfo-portal-upsert-overrides
- OpenAPI slice: https://www.ondayzero.com/docs/reference/cfo-portal/cfo-portal-upsert-overrides/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
