# GET /api/v1/contracts/reports/{report_type}

> Download an Order-to-Cash report (CSV/XLSX)

- **Tag:** contracts
- **Operation ID:** `download_o2c_report_api_v1_contracts_reports__report_type__get`

## Description

Generate and download an O2C report as a CSV or XLSX file.

**Path Parameters:**
- `report_type`: one of `contract_register`, `ar_aging`, `deferred_revenue_waterfall`, `hours_ledger`, `billing_schedule`.

**Query Parameters:**
- `format`: `csv` (default) or `xlsx`.

**Returns:** A streamed file download.

## Authentication

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

## Parameters

- `report_type` (path, string, required)
- `format` (query, string, optional) — Output format: 'csv' or 'xlsx'.

## Responses

### 200 — Successful Response

### 400 — Bad Request - Invalid input

### 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/contracts/reports/{report_type}' \
  -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/contracts/reports/{report_type}', {
  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/contracts/reports/{report_type}", headers=headers)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/contracts/download-o2c-report
- OpenAPI slice: https://www.ondayzero.com/docs/reference/contracts/download-o2c-report/openapi.json
- Other endpoints in **contracts**: https://www.ondayzero.com/docs/reference/contracts
