# GET /api/v1/purchase-orders

> List inventory orders

- **Tag:** purchase-orders
- **Operation ID:** `get_orders_api_v1_purchase_orders_get`

## Description

Retrieve all purchase orders with their status and totals.

## Authentication

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

## Parameters

- `status` (query, string, optional) — Filter by order status
- `vendor_id` (query, string, optional) — Filter by vendor ID
- `cursor` (query, string, optional) — Cursor for pagination
- `limit` (query, integer, optional) — Pagination limit
- `direction` (query, string, optional) — Pagination direction: 'next' or 'prev'
- `include_total_count` (query, boolean, optional) — Whether to include total count (expensive - avoid if possible)
- `sort_by` (query, string, optional) — Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None.
- `descending` (query, boolean, optional) — Sort direction: true for descending (newest/largest first), false for ascending

## Responses

### 200 — Successful Response

Schema: `OrderListResponse`

- `items` (array · OrderListItemResponse · required) → `OrderListItemResponse` — List of items
  - `id` (string · required) — Order UUID.
  - `vendor_id` (string · required) — Vendor UUID.
  - `vendor_name` (string) — Vendor name.
  - `vendor_email` (string) — Vendor email.
  - `status` (string · required) — Order status.
  - `name` (string · required) — Order name.
  - `business_id` (string) — Business UUID.
  - `po_number` (string · required) — PO number.
  - `line_items` (array · object · required) — Line items.
  - `fees` (array · Fee · required) — Fees.
  - `payments` (array · Payment-Output · required) — Payments.
  - `description` (string) — Notes.
  - `total` (integer) — Total in cents.
  - `balance` (integer) — Balance in cents.
  - `created_at` (string · date-time · required) — Created timestamp.
  - `updated_at` (string · date-time · required) — Updated timestamp.
  - `version` (integer)
  - `bill_id` (string) — UUID of the Bill linked to this PO, if any.
  - `bill_status` (string) — Status of the linked bill (forecasted, received, paid, ...).
  - `bill_amount` (integer) — Linked bill amount in cents.
  - `bill_received_on` (string · date-time) — Timestamp the linked bill was marked received from the vendor.
  - `bill_paid_on` (string · date-time) — Timestamp the linked bill was marked fully paid.
- `total` (integer) — Total number of items (null when not calculated for performance)
- `limit` (integer) — Pagination limit
- `next_cursor` (string) — Cursor for next page
- `prev_cursor` (string) — Cursor for previous page
- `has_next` (boolean · required) — Whether there are more items
- `has_prev` (boolean · required) — Whether there are previous items

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/purchase-orders/get-orders
- OpenAPI slice: https://www.ondayzero.com/docs/reference/purchase-orders/get-orders/openapi.json
- Other endpoints in **purchase-orders**: https://www.ondayzero.com/docs/reference/purchase-orders
