# DELETE /api/v1/businesses/{business_id}

> Delete business

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

## Description

Schedule the deletion of a business after the grace period.

**Safety:** requires a JSON body with ``confirm_name`` matching the
business's name (case-insensitive, trimmed) and a recent Clerk
re-verification of the caller (step-up).

**Effect:** nothing is deleted now. The business is scheduled for
permanent deletion ``BUSINESS_DELETION_GRACE_DAYS`` (default 30) days
from now, as the privacy page promises, and the owners are emailed.
Until then the business stays readable, owners and admins can export
everything (``POST /businesses/{business_id}/data-exports``) or cancel
(``POST /businesses/{business_id}/deletion/cancel``), and background
syncs and scheduled jobs stop. Asking again keeps the original date.

**After the grace period** the nightly sweep runs the hard delete:
third-party grants are revoked (Plaid, QuickBooks, Xero, Shopify,
Square...), every business row, S3 object version and AI memory
is deleted. That part is irreversible.

**Returns:** 202 with ``deletion_scheduled_for`` in ``data``.

## Authentication

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

## Parameters

- `business_id` (path, string, required)

## Request body

Schema: `BusinessDeleteRequest`

- `confirm_password` (string · password) — Deprecated and ignored. Retained so clients sending the old body keep working during rollout. Step-up is now proven by Clerk re-verification (an emailed code, or the account's own factor), which works for SSO accounts that have no password.
- `business_id` (string)
- `confirm_name` (string · required) — Exact business name as a typed confirmation. Must match the persisted business name (case-insensitive, trimmed). Required.
- `preserve_dz_users` (boolean)

## Responses

### 202 — Successful Response

Schema: `app__core__success__MessageResponse`

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

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

### 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 DELETE 'https://api.ondayzero.com/api/v1/businesses/{business_id}' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "confirm_name": "string"
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {'confirm_name': 'string'}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/businesses/delete-business
- OpenAPI slice: https://www.ondayzero.com/docs/reference/businesses/delete-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
