# POST /api/v1/businesses/{business_id}/cfo-portal/buckets

> Create a custom managerial bucket

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

## Description

Create a new custom managerial bucket for categorizing GL accounts.

The bucket key must be unique and cannot conflict with default
bucket keys. Use lowercase letters, numbers, and underscores only.

## Authentication

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

## Parameters

- `business_id` (path, string, required)

## Request body

Schema: `CustomBucketCreateRequest`

- `key` (string · required) — Unique slug for the bucket (lowercase, underscores allowed)
- `label` (string · required) — Display name for the bucket
- `color` (string) — Color theme: green, orange, indigo, accent, gray
- `classification` (string) — Bucket classification: operating_revenue, cogs, operating_expense, other_income, other_expense
- `sort_order` (integer)

## Responses

### 201 — Successful Response

Schema: `CustomBucketResponse`

- `id` (string · required)
- `key` (string · required)
- `label` (string · required)
- `color` (string · required)
- `classification` (string · required)
- `sort_order` (integer · required)
- `is_active` (boolean · required)
- `is_default` (boolean) — True for built-in default buckets
- `can_delete` (boolean) — Whether the bucket can be deleted from Recipe Book. Some built-in buckets are locked.

### 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/buckets' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "key": "string",
  "label": "string"
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {
  "key": "string",
  "label": "string"
}

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

## See also

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