# GET /api/v1/accounting-periods

> List accounting periods

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

## Description

List all accounting periods for the business.

## Authentication

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

## Parameters

- `status` (query, string, optional) — Filter by status: open, closed, locked
- `search` (query, string, optional) — Search status, dates, or lock/reopen reasons (case-insensitive)
- `cursor` (query, string, optional) — Cursor for pagination
- `limit` (query, integer, optional) — Pagination limit
- `direction` (query, string, optional) — Pagination direction: 'next' or 'prev'
- `include_total_count` (query, boolean, optional) — Whether to include total count (expensive - avoid if possible)
- `sort_by` (query, string, optional) — Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None.
- `descending` (query, boolean, optional) — Sort direction: true for descending (newest/largest first), false for ascending

## Responses

### 200 — Successful Response

Schema: `SuccessEnvelope_AccountingPeriodsListResponse_`

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

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 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 GET 'https://api.ondayzero.com/api/v1/accounting-periods' \
  -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', {
  method: 'GET',
  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.get("https://api.ondayzero.com/api/v1/accounting-periods", headers=headers)
data = response.json()
```

## See also

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