# PUT /api/v1/businesses/{business_id}/cfo-portal/recipe-book/managerial-mappings

> Upsert managerial bucket assignments for GL accounts

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

## Description

Save bucket assignments edited on the Recipe Book page.

The response is the refreshed Recipe Book section so the frontend
can swap state in one round-trip without a follow-up GET.

## Authentication

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

## Parameters

- `business_id` (path, string, required)

## Request body

Schema: `ManagerialMappingUpsertRequest`

- `mappings` (array · ManagerialMappingItem) → `ManagerialMappingItem`
  - `ledger_id` (string · required)
  - `bucket` (string)

## Responses

### 200 — Successful Response

Schema: `CfoPortalSectionResponse`

- `business_id` (string · required)
- `section` (string · required)
- `generated_at` (string · date-time · required)
- `start_date` (string · date)
- `end_date` (string · date)
- `sources` (array · CfoPortalSource) → `CfoPortalSource`
  - `key` (string · required)
  - `label` (string · required)
  - `status` (string) — available, empty, partial, or unavailable
  - `message` (string)
- `data` (object)

### 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 PUT 'https://api.ondayzero.com/api/v1/businesses/{business_id}/cfo-portal/recipe-book/managerial-mappings' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "mappings": []
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {
  "mappings": []
}

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

## See also

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