# POST /api/v1/sales-receipts

> Create sales receipt

- **Tag:** sales-receipts
- **Operation ID:** `create_sales_receipt_api_v1_sales_receipts_post`

## Description

Create and post a sales receipt (or refund receipt).

## Authentication

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

## Request body

Schema: `SalesReceiptCreateRequest`

- `receipt_type` (string) — One of: sale, refund.
- `customer_id` (string) — Optional customer (anonymous cash sales allowed).
- `receipt_date` (string · date) — Receipt date. Defaults to today when omitted.
- `deposit_to_ledger_id` (string · required) — Bank/cash ledger that receives (sale) or pays out (refund).
- `income_ledger_id` (string) — Revenue ledger override. Defaults to the Invoice Sales system account.
- `line_items` (array · SalesReceiptLineItem · required) → `SalesReceiptLineItem` — At least one line item is required.
  - `catalog_item_id` (string) — Optional catalog item this line is based on.
  - `description` (string) — Line description.
  - `quantity` (number) — Quantity sold/refunded.
  - `unit_price` (integer · required) — Price per unit in cents (e.g. 15000 = $150.00).
  - `amount` (integer) — Line total in cents. Computed from quantity * unit_price when omitted.
- `tax_total` (integer) — Total sales tax in cents (posted to Sales Tax Payable).
- `number` (string) — Optional document number; auto-generated.
- `memo` (string) — Optional memo / note.
- `currency` (string)

## Responses

### 201 — Successful Response

Schema: `SalesReceiptResponse`

- `id` (string · required)
- `business_id` (string · required)
- `number` (string)
- `receipt_type` (string · required)
- `status` (string · required)
- `customer_id` (string)
- `customer_name` (string)
- `receipt_date` (string · date · required)
- `deposit_to_ledger_id` (string · required)
- `deposit_to_ledger_name` (string)
- `income_ledger_id` (string)
- `income_ledger_name` (string)
- `line_items` (array · object)
- `subtotal` (integer · required)
- `tax_total` (integer · required)
- `total` (integer · required)
- `memo` (string)
- `currency` (string · required)
- `journal_entry_id` (string)
- `void_journal_entry_id` (string)
- `created_at` (string · date-time · required)
- `updated_at` (string · date-time · required)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 404 — Not Found - Resource does not exist

### 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/sales-receipts' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "deposit_to_ledger_id": "string",
  "line_items": []
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {
  "deposit_to_ledger_id": "string",
  "line_items": []
}

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

## See also

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