# POST /api/v1/bills/received

> Create bill in received status

- **Tag:** bills
- **Operation ID:** `create_bill_received`

## Description

Create a new bill directly in 'received' status, ready for payment. Creates both the bill AND journal entry when ledger_id is provided.

## Authentication

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

## Request body

Schema: `BillReceivedCreateRequest`

- `vendor_id` (string · required) — UUID of the vendor this bill is from (required).
- `amount` (integer · required) — Bill amount in cents (required).
- `description` (string) — Description of what the bill is for.
- `bill_number` (string) — Bill/invoice number from the vendor. Auto-generated if not provided.
- `payment_term_id` (string) — Optional UUID of the payment term the vendor billed under. Recorded for reference; `due_on` is the date the bill is actually due.
- `currency` (string) — Currency for the bill (USD, CAD, AUD, EUR, or GBP). Defaults to business default.
- `type` (string) — Bill type: 'recurring' or 'one_time'. Defaults to 'one_time'.
- `received_on` (string · date-time | string) — Date the bill was received (ISO 8601). Defaults to now.
- `due_on` (string · date-time | string) — Payment due date (ISO 8601).
- `s3_key` (string) — S3 key of uploaded bill document (PDF/image).
- `ledger_id` (string) — UUID of the expense ledger for journal entry creation. If provided, creates journal entry automatically. Ignored when line_items is provided.
- `line_items` (array · JournalEntryLineItem) — Split journal entry lines. Each line specifies a debit account and amount. The credit side is always Accounts Payable. When provided, ledger_id is ignored.
- `journal_entry_date` (string · date-time | string · date | string) — Date for the accounting journal entry (ISO 8601 or YYYY-MM-DD). Defaults to received_on if not provided.

## Example request

```json
{
  "amount": 56135,
  "bill_number": "P054",
  "currency": "USD",
  "description": "Purchase Order (P054) issued by Artisan AI LLC",
  "due_on": "2025-03-29T12:00:00Z",
  "journal_entry_date": "2025-02-27T12:00:00Z",
  "ledger_id": "019ab37c-1ed1-7000-8000-000000000001",
  "received_on": "2025-02-27T12:00:00Z",
  "s3_key": "attachments/019c30bb-dc4c-7e7e-8f9a-123456789abc",
  "type": "one_time",
  "vendor_id": "019ab37c-ae0d-7000-8000-000000000001"
}
```

## Responses

### 201 — Successful Response

Schema: `SuccessEnvelope_BillResponse_`

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

### 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.

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

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/bills/received' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "amount": 56135,
  "bill_number": "P054",
  "currency": "USD",
  "description": "Purchase Order (P054) issued by Artisan AI LLC",
  "due_on": "2025-03-29T12:00:00Z",
  "journal_entry_date": "2025-02-27T12:00:00Z",
  "ledger_id": "019ab37c-1ed1-7000-8000-000000000001",
  "received_on": "2025-02-27T12:00:00Z",
  "s3_key": "attachments/019c30bb-dc4c-7e7e-8f9a-123456789abc",
  "type": "one_time",
  "vendor_id": "019ab37c-ae0d-7000-8000-000000000001"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/bills/received', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "amount": 56135,
  "bill_number": "P054",
  "currency": "USD",
  "description": "Purchase Order (P054) issued by Artisan AI LLC",
  "due_on": "2025-03-29T12:00:00Z",
  "journal_entry_date": "2025-02-27T12:00:00Z",
  "ledger_id": "019ab37c-1ed1-7000-8000-000000000001",
  "received_on": "2025-02-27T12:00:00Z",
  "s3_key": "attachments/019c30bb-dc4c-7e7e-8f9a-123456789abc",
  "type": "one_time",
  "vendor_id": "019ab37c-ae0d-7000-8000-000000000001"
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {'amount': 56135,
 'bill_number': 'P054',
 'currency': 'USD',
 'description': 'Purchase Order (P054) issued by Artisan AI LLC',
 'due_on': '2025-03-29T12:00:00Z',
 'journal_entry_date': '2025-02-27T12:00:00Z',
 'ledger_id': '019ab37c-1ed1-7000-8000-000000000001',
 'received_on': '2025-02-27T12:00:00Z',
 's3_key': 'attachments/019c30bb-dc4c-7e7e-8f9a-123456789abc',
 'type': 'one_time',
 'vendor_id': '019ab37c-ae0d-7000-8000-000000000001'}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/bills/create-bill-received
- OpenAPI slice: https://www.ondayzero.com/docs/reference/bills/create-bill-received/openapi.json
- Other endpoints in **bills**: https://www.ondayzero.com/docs/reference/bills (markdown bundle: https://www.ondayzero.com/docs/reference/bills.md, OpenAPI: https://www.ondayzero.com/docs/reference/bills/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
