# POST /api/v1/accounting-periods/close

> Close accounting period

- **Tag:** accounting-periods
- **Operation ID:** `close_period_api_v1_accounting_periods_close_post`

## Description

Close an accounting period to prevent modifications.

## Authentication

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

## Request body

Schema: `ClosePeriodRequest`

- `period_end` (string · date · required) — End date of the period to close
- `lock_reason` (string) — Reason for closing the period

## Responses

### 201 — Successful Response

Schema: `AccountingPeriodResponse`

- `id` (string · required) — Period UUID
- `business_id` (string · required) — Business UUID
- `period_start` (string · date · required) — Start date of the period
- `period_end` (string · date · required) — End date of the period
- `status` (string · required) — Status: open, closed, or locked
- `closed_at` (string · date-time) — When period was closed
- `closed_by_user_id` (string) — User who closed the period
- `lock_reason` (string) — Reason period was closed
- `reopen_reason` (string) — Reason period was reopened
- `reopened_at` (string · date-time) — When period was reopened
- `reopened_by_user_id` (string) — User who reopened the period
- `created_at` (string · date-time · required) — Creation timestamp
- `updated_at` (string · date-time · required) — Last update timestamp

### 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/accounting-periods/close' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "period_end": "2026-01-01"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/accounting-periods/close', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "period_end": "2026-01-01"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "period_end": "2026-01-01"
}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/accounting-periods/close-period
- OpenAPI slice: https://www.ondayzero.com/docs/reference/accounting-periods/close-period/openapi.json
- Other endpoints in **accounting-periods**: https://www.ondayzero.com/docs/reference/accounting-periods
