# POST /api/v1/reconciliations

> Create reconciliation

- **Tag:** reconciliations
- **Operation ID:** `create_reconciliation_api_v1_reconciliations_post`

## Description

Create a new bank reconciliation (with S3 key).

Use this endpoint if you've already uploaded the statement to S3.
For direct file upload, use POST /reconciliations/upload instead.

**Request Body:**
- `ledger_id`: UUID of ledger to reconcile against (required)
- `statement_s3_key`: S3 key of uploaded bank statement (required)
- `start_date`: Statement period start date in ISO 8601 format (required)
- `end_date`: Statement period end date in ISO 8601 format (required)
- `statement_filename`: Original filename (optional)
- `opening_balance`: Opening balance in cents (optional)
- `closing_balance`: Closing balance in cents (optional)
- `auto_start`: Auto-start processing workflow (optional, defaults to true)

## Authentication

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

## Request body

Schema: `ReconciliationCreateRequest`

- `ledger_id` (string · required) — ID of ledger to reconcile against
- `statement_s3_key` (string · required) — S3 key of uploaded bank statement
- `start_date` (string · date-time · required) — Statement period start date
- `end_date` (string · date-time · required) — Statement period end date
- `statement_filename` (string) — Original filename
- `opening_balance` (integer) — Opening balance in cents
- `closing_balance` (integer) — Closing balance in cents
- `auto_start` (boolean) — Auto-start processing workflow

## Responses

### 201 — Successful Response

### 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/reconciliations' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "ledger_id": "string",
  "statement_s3_key": "string",
  "start_date": "2026-01-01T00:00:00Z",
  "end_date": "2026-01-01T00:00:00Z"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/reconciliations', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "ledger_id": "string",
  "statement_s3_key": "string",
  "start_date": "2026-01-01T00:00:00Z",
  "end_date": "2026-01-01T00:00:00Z"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "ledger_id": "string",
  "statement_s3_key": "string",
  "start_date": "2026-01-01T00:00:00Z",
  "end_date": "2026-01-01T00:00:00Z"
}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/reconciliations/create-reconciliation
- OpenAPI slice: https://www.ondayzero.com/docs/reference/reconciliations/create-reconciliation/openapi.json
- Other endpoints in **reconciliations**: https://www.ondayzero.com/docs/reference/reconciliations
