# POST /api/v1/businesses

> Create business

- **Tag:** businesses
- **Operation ID:** `create_business`

## Description

Create a new business entity with optional integrations.

## Authentication

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

## Request body

Schema: `BusinessCreateRequest`

- `accounting_basis` (string) — Default accounting basis financial reports open on: 'accrual' or 'cash'. Omit for accrual.
- `name` (string · required) — Business display name.
- `default_currency` (string) — Default currency for the business (USD, CAD, AUD, EUR, or GBP).
- `tax_year_end_month` (integer) — Month when the tax/fiscal year ends (1-12). Default 12 = calendar year.
- `mailbox` (string) — Unique email prefix for bill forwarding. Auto-generated from the business name when omitted.
- `user_id` (string) — UUID of the user who will own this business. Optional for admin-created businesses.
- `coa_template_id` (string) — Pre-built chart of accounts template ID. Mutually exclusive with custom_coa_template.
- `custom_coa_template` (CustomCoaTemplate) — Custom chart of accounts definition. Mutually exclusive with coa_template_id.
- `entries_start` (string) — Date from which to start importing transactions (YYYY-MM-DD).
- `firm_id` (string) — Advisory firm UUID to link this business to.
- `stripe_account_id` (string) — Stripe Connect account ID.
- `stripe_subscription_id` (string) — Stripe subscription ID for billing.
- `stripe_customer_id` (string) — Stripe customer ID (e.g., cus_xxx).
- `subscription_items` (object) — Stripe subscription items/products linked to this business.
- `accounting_engine_type` (string) — Accounting engine: 'local' (DayZero, default), or null (inherit from firm).
- `entity_kind` (string) (one of: business, personal) — Workspace mode: 'business' (default) or 'personal'.
- `trial_ends_at` (string · date-time) — UTC expiry of the free trial. Omit for the standard 30-day trial.
- `billing_status` (string) — Initial billing state (trialing, active, ...). Omit for trialing.
- `plan_tier` (string) — Plan tier (free, self_directed, managed, firm_client, grandfathered).
- `active_addons` (array · string) — Paid add-on slugs to enable from day one.

## Example request

```json
{
  "coa_template_id": "standard_accrual",
  "entries_start": "2024-01-01",
  "mailbox": "acme",
  "name": "Acme Corporation",
  "user_id": "019ab37c-05e7-7000-8000-000000000001"
}
```

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_BusinessResponse_`

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

### 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.

### 409 — Conflict - Resource already exists or is in an incompatible state

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' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "coa_template_id": "standard_accrual",
  "entries_start": "2024-01-01",
  "mailbox": "acme",
  "name": "Acme Corporation",
  "user_id": "019ab37c-05e7-7000-8000-000000000001"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/businesses', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "coa_template_id": "standard_accrual",
  "entries_start": "2024-01-01",
  "mailbox": "acme",
  "name": "Acme Corporation",
  "user_id": "019ab37c-05e7-7000-8000-000000000001"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {'coa_template_id': 'standard_accrual',
 'entries_start': '2024-01-01',
 'mailbox': 'acme',
 'name': 'Acme Corporation',
 'user_id': '019ab37c-05e7-7000-8000-000000000001'}

response = httpx.post("https://api.ondayzero.com/api/v1/businesses", headers=headers, json=payload)
data = response.json()
```

## See also

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