# POST /api/v1/revenue-schedules/preorders

> Book a pre-order

- **Tag:** revenue-schedules
- **Operation ID:** `book_preorder_api_v1_revenue_schedules_preorders_post`

## Description

Collect pre-order cash to deferred revenue (releases on fulfillment).

## Authentication

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

## Request body

Schema: `PreorderBookRequest`

- `order_reference` (string · required) — Stable pre-order identifier (idempotency key)
- `amount_cents` (integer · required) — Merchandise amount in cents
- `order_date` (string · date) — Cash-collection date (defaults to today)
- `receive_via` (string) — Debit account for the booking: 'cash', 'ar', or 'clearing'
- `revenue_ledger_name` (string) — Revenue ledger credited on fulfillment
- `currency` (string)
- `reference_id` (string) — Originating object id

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_RevenueScheduleResponse_`

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

### 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/revenue-schedules/preorders' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "order_reference": "string",
  "amount_cents": 0
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {
  "order_reference": "string",
  "amount_cents": 0
}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/revenue-schedules/book-preorder
- OpenAPI slice: https://www.ondayzero.com/docs/reference/revenue-schedules/book-preorder/openapi.json
- Other endpoints in **revenue-schedules**: https://www.ondayzero.com/docs/reference/revenue-schedules
