# POST /api/v1/ai-reporting/decks

> Generate a new AI deck

- **Tag:** ai-reporting
- **Operation ID:** `generate_deck_api_v1_ai_reporting_decks_post`

## Description

Build a new deck from live data + AI commentary and persist it. Returns the full DeckSpec ready to render.

## Authentication

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

## Request body

Schema: `GenerateDeckRequest`

- `prompt` (string · required)
- `period_start` (string · date)
- `period_end` (string · date)
- `slide_types` (array · string) — Optional subset of slide types to include. When omitted the service picks a sensible default for board / investor decks.
- `title` (string)

## Responses

### 201 — Successful Response

Schema: `GenerateDeckResponse`

- `deck` (DeckSpec · required) → `DeckSpec`
  - `id` (string · required)
  - `business_id` (string · required)
  - `title` (string · required)
  - `period_start` (string · date)
  - `period_end` (string · date)
  - `slides` (array · CoverSlide | ExecSummarySlide | PnlSummarySlide | ArAgingSlide | CashPositionSlide | InventoryCogsSlide | CustomerConcentrationSlide | AsksSlide | CustomSlideSpec)
  - `created_at` (string · date-time · required)
  - `theme` (DeckTheme)

### 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 POST 'https://api.ondayzero.com/api/v1/ai-reporting/decks' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "prompt": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/ai-reporting/decks', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "prompt": "string"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "prompt": "string"
}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/ai-reporting/generate-deck
- OpenAPI slice: https://www.ondayzero.com/docs/reference/ai-reporting/generate-deck/openapi.json
- Other endpoints in **ai-reporting**: https://www.ondayzero.com/docs/reference/ai-reporting
