{"openapi":"3.1.0","info":{"title":"GET /api/v1/purchase-orders","version":"1.0.0","description":"List inventory orders"},"servers":[{"url":"https://api.ondayzero.com","description":"Production"}],"paths":{"/api/v1/purchase-orders":{"get":{"tags":["purchase-orders"],"summary":"List inventory orders","description":"Retrieve all purchase orders with their status and totals.","operationId":"get_orders_api_v1_purchase_orders_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by order status","title":"Status"},"description":"Filter by order status"},{"name":"vendor_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by vendor ID","title":"Vendor Id"},"description":"Filter by vendor ID"},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Cursor for pagination","title":"Cursor"},"description":"Cursor for pagination"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1000,"minimum":1},{"type":"null"}],"description":"Pagination limit","title":"Limit"},"description":"Pagination limit"},{"name":"direction","in":"query","required":false,"schema":{"type":"string","description":"Pagination direction: 'next' or 'prev'","default":"next","title":"Direction"},"description":"Pagination direction: 'next' or 'prev'"},{"name":"include_total_count","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to include total count (expensive - avoid if possible)","default":false,"title":"Include Total Count"},"description":"Whether to include total count (expensive - avoid if possible)"},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None.","title":"Sort By"},"description":"Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None."},{"name":"descending","in":"query","required":false,"schema":{"type":"boolean","description":"Sort direction: true for descending (newest/largest first), false for ascending","default":true,"title":"Descending"},"description":"Sort direction: true for descending (newest/largest first), false for ascending"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}},{"name":"x-business-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Business-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderListResponse"}}}},"401":{"description":"Unauthorized - Authentication required","content":{"application/json":{"example":{"detail":"Not authenticated"}}}},"403":{"description":"Forbidden - Insufficient permissions","content":{"application/json":{"example":{"detail":"Not enough permissions"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"Fee":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Fee name (e.g., 'Shipping', 'Handling')."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Fee description (alternative to name)."},"amount":{"type":"integer","title":"Amount","description":"Fee amount in cents."}},"type":"object","required":["amount"],"title":"Fee","description":"Additional fee on an inventory order.\n\nUsed for shipping, handling, customs, or other charges.\nAmount is in cents.","example":{"amount":5000,"name":"Shipping"}},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"OrderListItemResponse":{"properties":{"id":{"type":"string","title":"Id","description":"Order UUID."},"vendor_id":{"type":"string","title":"Vendor Id","description":"Vendor UUID."},"vendor_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Name","description":"Vendor name."},"vendor_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Email","description":"Vendor email."},"status":{"type":"string","title":"Status","description":"Order status."},"name":{"type":"string","title":"Name","description":"Order name."},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id","description":"Business UUID."},"po_number":{"type":"string","title":"Po Number","description":"PO number."},"line_items":{"items":{},"type":"array","title":"Line Items","description":"Line items."},"fees":{"items":{"$ref":"#/components/schemas/Fee"},"type":"array","title":"Fees","description":"Fees."},"payments":{"items":{"$ref":"#/components/schemas/Payment-Output"},"type":"array","title":"Payments","description":"Payments."},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Notes."},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Total in cents."},"balance":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Balance","description":"Balance in cents."},"created_at":{"type":"string","format":"date-time","title":"Created At","description":"Created timestamp."},"updated_at":{"type":"string","format":"date-time","title":"Updated At","description":"Updated timestamp."},"version":{"type":"integer","title":"Version","default":1},"bill_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bill Id","description":"UUID of the Bill linked to this PO, if any."},"bill_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bill Status","description":"Status of the linked bill (forecasted, received, paid, ...)."},"bill_amount":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Bill Amount","description":"Linked bill amount in cents."},"bill_received_on":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Bill Received On","description":"Timestamp the linked bill was marked received from the vendor."},"bill_paid_on":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Bill Paid On","description":"Timestamp the linked bill was marked fully paid."}},"additionalProperties":true,"type":"object","required":["id","vendor_id","status","name","po_number","line_items","fees","payments","created_at","updated_at"],"title":"OrderListItemResponse","description":"Abbreviated order data for list views."},"OrderListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/OrderListItemResponse"},"type":"array","title":"Items","description":"List of items"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total","description":"Total number of items (null when not calculated for performance)"},"limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Limit","description":"Pagination limit"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor","description":"Cursor for next page"},"prev_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prev Cursor","description":"Cursor for previous page"},"has_next":{"type":"boolean","title":"Has Next","description":"Whether there are more items"},"has_prev":{"type":"boolean","title":"Has Prev","description":"Whether there are previous items"}},"type":"object","required":["items","has_next","has_prev"],"title":"OrderListResponse","description":"Paginated list of inventory orders."},"Payment-Output":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Payment UUID."},"paid_on":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Paid On","description":"Payment date."},"date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Date","description":"Payment date (alias for paid_on)."},"amount":{"type":"integer","title":"Amount","description":"Payment amount in cents."},"inventory_order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inventory Order Id","description":"Parent order UUID."},"method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Method","description":"Payment method (e.g., 'check', 'wire', 'credit_card')."}},"type":"object","required":["amount"],"title":"Payment","description":"Payment record for an inventory order.\n\nTracks payments made to vendors for purchase orders.\nAmount is in cents.","example":{"amount":50000,"method":"wire","paid_on":"2024-01-15T00:00:00Z"}},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Token","description":"API token authentication. Format: `Bearer dz_...`"}}},"security":[{"BearerAuth":[]}]}