# POST /api/v1/accounting-periods/{period_id}/close-readiness

> AI close readiness check

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

## Description

Check period close readiness with AI-enhanced analysis.

## Authentication

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

## Parameters

- `period_id` (path, string, required)

## Responses

### 201 — Successful Response

Schema: `CloseReadinessResponse`

- `score` (number · required) — Overall readiness score 0-100
- `items` (array · CloseReadinessItem) → `CloseReadinessItem`
  - `check` (string · required) — Name of the readiness check
  - `status` (string · required) — pass, warning, or fail
  - `detail` (string · required) — Explanation
  - `count` (integer) — Number of items flagged
- `summary` (CloseReadinessSummary) → `CloseReadinessSummary` — Period-scoped transaction counts to power dashboards without extra fetches
  - `transaction_count` (integer) — Total non-deleted transactions in the period
  - `unreviewed_count` (integer) — Transactions in the period that are still unreviewed
  - `uncategorized_count` (integer) — Transactions in the period that are still uncategorized

### 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/{period_id}/close-readiness' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/accounting-periods/{period_id}/close-readiness', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
  },
});
const data = await response.json();
```

### Python

```python
import httpx

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

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

## See also

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