# Purchase Orders

Purchase orders (POs) — parts and supply orders from inventory stock orders, online catalog
orders (PartsTech, TireConnect), and order-level POs tied to repair orders.

**Read-only today:** list and get-by-id. Create/update POs are not yet available.

**Response envelope:** `{ status, data, pagination?, error }` (AUT-1462 standard).

**Backend sources:** PO data lives in three backends. Use the `source` query param on the list
endpoint to filter by backend, or omit/`all` to combine all sources (slower).

**Distinguishing channels:** use `integrationSource` on each PO (`Inventory`, `PartsTech`,
`TireConnect`, `ManualOrder`). The response field `source` (`inventory`, `online`, `orders`)
reflects the backend category — distinct from `integrationSource`.


## List purchase orders

 - [GET /purchaseOrders](https://developers.myautoleap.com/openapi/purchase-orders/listpurchaseorders.md): Returns a paginated list of purchase orders for the specified company.

For large sync jobs (e.g. warehouse ingest), filter by source rather than fetching all
sources in one call — combining three backends is slower.

### Source filter

| source | isPartsTech | Returns |
|---|---|---|
| omit / all | — | All POs combined (3 backends) |
| inventory | n/a | Inventory POs |
| online | true | PartsTech online POs |
| online | false | TireConnect / other online |
| orders | n/a | Order-level POs (manual + PartsTech + TireConnect) |

### Validation errors (HTTP 400)

| Condition | Example error |
|---|---|
| source=online without isPartsTech | Invalid or missing isPartsTech. Use true or false when source=online. |
| isPartsTech when source is not online | isPartsTech is only supported when source=online. |
| repairOrderId when source=inventory | repairOrderId is only supported when source=orders or source=all. |
| itemType with source=orders or online + isPartsTech=false | HTTP 400 |
| Unknown locationId | HTTP 400 |

### Response envelope

json
{ "status": true, "data": [ ... ], "pagination": { ... }, "error": null }


### Notes

- Date fields in responses use ISO 8601 datetime (createdDate, updatedDate, invoiceDate, paymentDueDate).
- Date filters accept date-only YYYY-MM-DD (createdDateStart/End, updatedDateStart/End). Verified prod 2026-06-30.
- brand on each orderItems[] — part brand from inventory; nullable when unset.
- requestedPartNumber and requestedQuantity on line items are reserved for fill-rate (future); currently null.
- Partner must have Purchase Orders permission enabled — otherwise HTTP 403.

## Get purchase order by id

 - [GET /purchaseOrders/{id}](https://developers.myautoleap.com/openapi/purchase-orders/getpurchaseorderbyid.md): Returns a single purchase order when you already have its id (e.g. after a list sync).

No source parameter — the API resolves the record from id and companyId.

### Response envelope

json
{ "status": true, "data": { ... }, "error": null }

