# POST /api/v1/payroll/gusto/reconcile/preview

> Preview the Gusto payroll reconciliation

- **Tag:** payroll
- **Operation ID:** `gusto_reconcile_preview`

## Description

Reads the Gusto exports given (Payroll Journal / Register, Contractor Payments, Bank Transactions; uploaded via s3_key or pasted), matches them to the Gusto bank rows in the range and returns the plan: per row the new description, counterparty, ledger, the per-employee split of each NET lump, and the accrual bill each TAX / reimbursement debit pays; plus everything left outstanding on either side and a plan_hash for apply. Nothing is changed.

## Authentication

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

## Request body

Schema: `GustoReconcileRequest`

- `reports` (array · GustoReportInput) → `GustoReportInput` — Gusto exports: Payroll Journal (or Payroll Register), Contractor Payments and/or Bank Transactions. Without any, only the bank lines' own descriptors are used (contractor payee, fee).
  - `s3_key` (string) — S3 key from POST /uploads (or generate_upload_url) of a CSV/XLSX exported from Gusto > Reports.
  - `content` (string) — The report pasted as CSV / tab-separated text.
  - `filename` (string) — Original file name (format hint).
- `bank_ledger_id` (string) — Bank account Gusto debits. Omit to consider every bank account of the business.
- `start_date` (string · date · required) — First bank date considered
- `end_date` (string · date · required) — Last bank date considered
- `ledger_overrides` (GustoLedgerOverrides)
- `amount_tolerance_cents` (integer) — Largest difference accepted between a payroll lump and the register total; the difference becomes a rounding leg.
- `create_bills` (boolean) — Book tax and reimbursement debits as an accrual bill per pay period (vendor Gusto) paid by the bank row. False categorizes them directly instead.

## Responses

### 200 — Successful Response

Schema: `SuccessEnvelope_GustoReconcilePreviewResponse_`

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

### 400 — Bad Request - Invalid input

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.

### 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 POST 'https://api.ondayzero.com/api/v1/payroll/gusto/reconcile/preview' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "start_date": "2026-01-01",
  "end_date": "2026-01-01"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/payroll/gusto/reconcile/preview', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "start_date": "2026-01-01",
  "end_date": "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 = {'start_date': '2026-01-01', 'end_date': '2026-01-01'}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/payroll/gusto-reconcile-preview
- OpenAPI slice: https://www.ondayzero.com/docs/reference/payroll/gusto-reconcile-preview/openapi.json
- Other endpoints in **payroll**: https://www.ondayzero.com/docs/reference/payroll (markdown bundle: https://www.ondayzero.com/docs/reference/payroll.md, OpenAPI: https://www.ondayzero.com/docs/reference/payroll/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
