# Create Purchase Orders

Create new purchase orders to track inventory replenishment from your suppliers. Use the POST method with `/v2/purchase_orders` to create orders in `draft` status and include product details, delivery dates, and payment terms.

## Create a Purchase Order

### Request Body Properties

| Property | Type | Required | Description |
|  --- | --- | --- | --- |
| `supplier_id` | *string* | **Required** | Identifier for the supplier providing the products |
| `warehouse_id` | *string* | **Required** | Identifier for the warehouse where products will be received |
| `products` | *array* | **Required** | Array of products to order (must contain at least one product) |
| `order_date` | *string* (date-time) | Optional | Date when the order was placed with the supplier. Format: ISO 8601 |
| `expected_delivery_date` | *string* (date-time) | Optional | Expected delivery date for the shipment. Format: ISO 8601 |
| `payment_terms` | *enumerated string* | Optional | Payment terms: `none`, `cash_on_delivery`, `payment_on_receipt`, `payment_in_advance`, `net_7`, `net_15`, `net_30`, `net_45`, `net_60` |
| `payment_status` | *enumerated string* | Optional | Payment status: `none`, `unpaid`, `partially_paid`, `paid`, `refunded`, `credit_issued`, `other` |
| `currency_code` | *string* | Optional | ISO 4217 currency code (default: "USD") |
| `shipping_carrier` | *string* | Optional | Shipping carrier name for tracking the shipment |
| `tracking_number` | *string* | Optional | Tracking number for the shipment from supplier |
| `reference_number` | *string* | Optional | Your custom reference number for internal tracking |
| `note_to_supplier` | *string* | Optional | Special instructions or notes for the supplier |


### Product Properties

Each product in the `products` array must include:

| Property | Type | Required | Description |
|  --- | --- | --- | --- |
| `sku` | *string* | **Required** | Stock Keeping Unit identifier |
| `quantity` | *integer* | **Required** | Quantity to order (minimum: 1) |
| `supplier_sku` | *string* | Optional | Supplier's SKU for this product |
| `cost` | *number* | Optional | Unit cost of the product (minimum: 0) |


### Response Properties

On successful creation, the response includes:

- The complete purchase order details (all properties from GET operation)
- Auto-generated `purchase_order_id`
- Auto-generated `order_number`
- `create_date` and `modify_date` timestamps
- Full product details for each product


### Example Request & Response

**POST /v2/purchase_orders**

## Error Handling

Common errors when creating purchase orders:

- **400 Bad Request**: Missing required fields (`supplier_id` or `products`)


Validation rules:

- `products` array must contain at least one product
- `quantity` must be greater than 0
- `cost` must be 0 or positive
- Date formats must follow ISO 8601 standard
- Supplier with the given ID was not found