> For the complete documentation index, see [llms.txt](https://docs.flowretail.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowretail.com/docs/developers/api-documentation/purchase.md).

# Purchase

Purchase

## List purchase orders

> Lists all purchase orders.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"parameters":{"purchaseOrderStatusQuery":{"description":"Reference to an PurchaseOrderStatus.","explode":false,"in":"query","name":"purchaseOrderStatus","schema":{"items":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"type":"array"},"style":"form"},"purchaseOrderExternalIdQuery":{"description":"External reference to a purchaseOrderUid.","in":"query","name":"purchaseOrderExternalId","required":false,"schema":{"type":"string"}},"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}},"schemas":{"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"},"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"}},"responses":{"PurchaseOrderListResponse":{"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"]}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders":{"get":{"description":"Lists all purchase orders.","operationId":"get-tenants-stores-purchase-orders","parameters":[{"$ref":"#/components/parameters/purchaseOrderStatusQuery"},{"$ref":"#/components/parameters/purchaseOrderExternalIdQuery"},{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}],"responses":{"200":{"$ref":"#/components/responses/PurchaseOrderListResponse"}},"summary":"List purchase orders","tags":["Purchase"]}}}}
```

## Create a new purchase order

> Specify a \`currency\` when the order is not in local currency. \
> The currency must exist in your foreign currencies. \
> If you leave \`exchangeRate\` empty, the exchange rate that is on the foreign currency will be used.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"PurchaseOrderCreateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderCreateSchema"}}}}},"schemas":{"PurchaseOrderCreateSchema":{"title":"PurchaseOrderCreateSchema","type":"object","required":["supplierUid"],"properties":{"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"note":{"type":"string"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"supplierUid":{"$ref":"#/components/schemas/UID"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"type":"string","description":"ISO 4217 code"},"exchangeRate":{"type":"integer"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemCreateSchema"}},"autoOrderProposal":{"type":"object","description":"Generate a purchase order proposal based on min/max","required":["warehouseUid"],"properties":{"warehouseUid":{"$ref":"#/components/schemas/UID"},"countReservedItems":{"type":"boolean","default":true,"description":"Wether or not reserved items will be counted as part of existing stock. Defaults to true."},"honorTradeUnits":{"type":"boolean","description":"Quantities are rounded up to trade units for products where defined."}}},"supplierReferenceNumber":{"type":"string"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddressCreateSchema"},"reserveAfter":{"type":"string","format":"date-time","description":"If set, items in this purchase \norder cannot be reserved before this date."}}},"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"PurchaseOrderItemCreateSchema":{"allOf":[{"$ref":"#/components/schemas/PurchaseOrderItemUpdateSchema"},{"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"productUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"}},"required":["productUid","quantityOrdered"]}],"title":"PurchaseOrderItemCreateSchema","type":"object"},"PurchaseOrderItemUpdateSchema":{"title":"PurchaseOrderItemUpdateSchema","type":"object","properties":{"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"description":"External reference to purchase order line","type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"supplierSku":{"type":"string"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase order currency"},"note":{"type":"string"},"sortOrder":{"type":"integer"}}},"PurchaseOrderInvoiceAddressCreateSchema":{"title":"PurchaseOrderInvoiceAddressCreateSchema","type":"object","required":["companyName","address","postalCode","city","countryCode"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}},"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}}},"responses":{"PurchaseOrderResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders":{"post":{"description":"Specify a `currency` when the order is not in local currency. \nThe currency must exist in your foreign currencies. \nIf you leave `exchangeRate` empty, the exchange rate that is on the foreign currency will be used.\n\nRequired permissions: PURCHASE_ORDER","operationId":"post-tenants-stores-purchase-orders","requestBody":{"$ref":"#/components/requestBodies/PurchaseOrderCreateRequest"},"responses":{"200":{"$ref":"#/components/responses/PurchaseOrderResponse"}},"summary":"Create a new purchase order","tags":["Purchase"]}}}}
```

## Get purchase order details

> Get details for a purchase order.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"PurchaseOrderResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}}},"description":"Example response"}},"schemas":{"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}":{"get":{"description":"Get details for a purchase order.","operationId":"get-tenants-stores-purchase-orders-details","responses":{"200":{"$ref":"#/components/responses/PurchaseOrderResponse"}},"summary":"Get purchase order details","tags":["Purchase"]}}}}
```

## Update purchase order details

> Specify a \`currency\` when the order is not in local currency. \
> The currency must exist in your foreign currencies. \
> If you leave \`exchangeRate\` empty, the exchange rate that is on the foreign currency will be used.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"PurchaseOrderUpdateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderUpdateSchema"}}}}},"schemas":{"PurchaseOrderUpdateSchema":{"title":"PurchaseOrderUpdateSchema","type":"object","properties":{"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"note":{"type":"string"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"supplierUid":{"$ref":"#/components/schemas/UID"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"type":"string","description":"ISO 4217 code"},"exchangeRate":{"type":"integer"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemUpdateQtyDeliveredSchema"}},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddressUpdateSchema"},"reserveAfter":{"type":"string","description":"If set, items in this purchase \norder cannot be reserved before this date.","format":"date-time","nullable":true}}},"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"PurchaseOrderItemUpdateQtyDeliveredSchema":{"title":"PurchaseOrderItemUpdateQtyDeliveredSchema","type":"object","description":"Partial line updates on PUT purchase order: received quantity, expected delivery,\nunit price, and/or ordered quantity. Does not adjust stock except via receivement when quantityReceived is set.","required":["purchaseOrderItemUid"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityReceived":{"type":"integer"},"expectedDeliveryDate":{"type":"string","format":"date"},"unitPrice":{"type":"integer"},"quantityOrdered":{"type":"integer","description":"New ordered quantity for this line (same unit as on create)."}}},"PurchaseOrderInvoiceAddressUpdateSchema":{"title":"PurchaseOrderInvoiceAddressUpdateSchema","type":"object","properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}},"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}}},"responses":{"PurchaseOrderResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}":{"put":{"description":"Specify a `currency` when the order is not in local currency. \nThe currency must exist in your foreign currencies. \nIf you leave `exchangeRate` empty, the exchange rate that is on the foreign currency will be used.\n\nRequired permissions: PURCHASE_ORDER","operationId":"put-tenants-stores-purchase-orders-details","requestBody":{"$ref":"#/components/requestBodies/PurchaseOrderUpdateRequest"},"responses":{"200":{"$ref":"#/components/responses/PurchaseOrderResponse"}},"summary":"Update purchase order details","tags":["Purchase"]}}}}
```

## Delete a purchase order

> Deletes a purchase order.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}":{"delete":{"description":"Deletes a purchase order.\n\nRequired permissions: PURCHASE_ORDER","operationId":"delete-tenants-stores-purchase-orders-details","responses":{"204":{"description":"No Content"}},"summary":"Delete a purchase order","tags":["Purchase"]}}}}
```

## List purchase order items

> Lists all items on a purchase order.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}},"schemas":{"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"}},"responses":{"PurchaseOrderItemListResponse":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"},"type":"array"},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"],"type":"object"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/purchase-order-items":{"get":{"description":"Lists all items on a purchase order.\n\nRequired permissions: PURCHASE_ORDER","operationId":"get-tenants-stores-purchase-orders-items","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}],"responses":{"200":{"$ref":"#/components/responses/PurchaseOrderItemListResponse"}},"summary":"List purchase order items","tags":["Purchase"]}}}}
```

## Add a purchase order item

> Adds an item to a purchase order.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"PurchaseOrderItemCreateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderItemCreateSchema"}}}}},"schemas":{"PurchaseOrderItemCreateSchema":{"allOf":[{"$ref":"#/components/schemas/PurchaseOrderItemUpdateSchema"},{"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"productUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"}},"required":["productUid","quantityOrdered"]}],"title":"PurchaseOrderItemCreateSchema","type":"object"},"PurchaseOrderItemUpdateSchema":{"title":"PurchaseOrderItemUpdateSchema","type":"object","properties":{"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"description":"External reference to purchase order line","type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"supplierSku":{"type":"string"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase order currency"},"note":{"type":"string"},"sortOrder":{"type":"integer"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}}},"responses":{"PurchaseOrderResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/purchase-order-items":{"post":{"description":"Adds an item to a purchase order.\n\nRequired permissions: PURCHASE_ORDER","operationId":"post-tenants-stores-purchase-orders-items","requestBody":{"$ref":"#/components/requestBodies/PurchaseOrderItemCreateRequest"},"responses":{"200":{"$ref":"#/components/responses/PurchaseOrderResponse"}},"summary":"Add a purchase order item","tags":["Purchase"]}}}}
```

## Get purchase order item details

> Get details for an item on a purchase order.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"PurchaseOrderItemResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}}},"description":"Example response"}},"schemas":{"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/purchase-order-items/{purchaseOrderItemUid}":{"get":{"description":"Get details for an item on a purchase order.\n\nRequired permissions: PURCHASE_ORDER","operationId":"get-tenants-stores-purchase-orders-purchase-order-items-details","responses":{"200":{"$ref":"#/components/responses/PurchaseOrderItemResponse"}},"summary":"Get purchase order item details","tags":["Purchase"]}}}}
```

## Update purchase order item details

> Update details for an item on a purchase order.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"PurchaseOrderItemUpdateRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderItemUpdateSchema"}}}}},"schemas":{"PurchaseOrderItemUpdateSchema":{"title":"PurchaseOrderItemUpdateSchema","type":"object","properties":{"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"description":"External reference to purchase order line","type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"supplierSku":{"type":"string"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase order currency"},"note":{"type":"string"},"sortOrder":{"type":"integer"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}}},"responses":{"PurchaseOrderResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/purchase-order-items/{purchaseOrderItemUid}":{"put":{"description":"Update details for an item on a purchase order.\n\nRequired permissions: PURCHASE_ORDER","operationId":"put-tenants-stores-purchase-orders-purchase-order-items-details","requestBody":{"$ref":"#/components/requestBodies/PurchaseOrderItemUpdateRequest"},"responses":{"200":{"$ref":"#/components/responses/PurchaseOrderResponse"}},"summary":"Update purchase order item details","tags":["Purchase"]}}}}
```

## Remove a purchase order item

> Removes an item from a purchase order.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"PurchaseOrderResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}}},"description":"Example response"}},"schemas":{"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/purchase-order-items/{purchaseOrderItemUid}":{"delete":{"description":"Removes an item from a purchase order.\n\nRequired permissions: PURCHASE_ORDER","operationId":"delete-tenants-stores-purchase-orders-purchase-order-items-details","responses":{"200":{"$ref":"#/components/responses/PurchaseOrderResponse"}},"summary":"Remove a purchase order item","tags":["Purchase"]}}}}
```

## Source a purchase order line from another store

> Source an existing purchase-order line from another store's incoming purchase order\
> (inter-store trade). The purchase order must be placed with a supplier that represents\
> the seller store; this couples the line (and its purchase order, if not already\
> coupled) to the seller's auto-created sales order and points that sale at the chosen\
> seller purchase-order line. Returns the updated purchase order.\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"InterStorePurchaseLineReservationRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterStorePurchaseLineReservationSchema"}}}}},"schemas":{"InterStorePurchaseLineReservationSchema":{"title":"InterStorePurchaseLineReservationSchema","type":"object","description":"Source an existing purchase-order line from another store's incoming purchase order\n(inter-store trade). The whole purchase-order line is coupled to the chosen seller\nline; there is no separate quantity.","required":["sellerStoreUid","sellerPurchaseOrderUid","sellerPurchaseOrderItemUid"],"properties":{"sellerStoreUid":{"$ref":"#/components/schemas/UID"},"sellerPurchaseOrderUid":{"$ref":"#/components/schemas/UID"},"sellerPurchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}}},"responses":{"PurchaseOrderResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/purchase-order-items/{purchaseOrderItemUid}/inter-store-reservations":{"post":{"description":"Source an existing purchase-order line from another store's incoming purchase order\n(inter-store trade). The purchase order must be placed with a supplier that represents\nthe seller store; this couples the line (and its purchase order, if not already\ncoupled) to the seller's auto-created sales order and points that sale at the chosen\nseller purchase-order line. Returns the updated purchase order.\n\nRequired permissions: PURCHASE_ORDER","operationId":"post-tenants-stores-purchase-orders-purchase-order-items-inter-store-reservations","requestBody":{"$ref":"#/components/requestBodies/InterStorePurchaseLineReservationRequest"},"responses":{"200":{"$ref":"#/components/responses/PurchaseOrderResponse"}},"summary":"Source a purchase order line from another store","tags":["Purchase"]}}}}
```

## Print or send receipt

> Send receipt as PDF, print on printer or get as PDF\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"PurchaseOrderEmailNotificationRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderEmailNotificationRequestSchema"}}}}},"schemas":{"PurchaseOrderEmailNotificationRequestSchema":{"title":"PurchaseOrderEmailNotificationRequestSchema","type":"object","required":["email"],"properties":{"email":{"$ref":"#/components/schemas/EmailTYPE"},"recepients":{"type":"array","items":{"$ref":"#/components/schemas/EmailTYPE"}},"subject":{"type":"string"},"body":{"type":"string"},"includePDF":{"type":"boolean","default":true},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Base64EncodedFileContentSchema"}}}},"EmailTYPE":{"title":"Email","type":"string"},"Base64EncodedFileContentSchema":{"title":"Base64EncodedFileContentSchema","type":"object","properties":{"content":{"type":"string","description":" base64 encoded"},"contentType":{"description":"mime type","type":"string"},"filename":{"type":"string"}},"required":["content","contentType","filename"]}},"responses":{"FileResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Base64EncodedFileContentSchema"}},"application/pdf":{"schema":{"format":"binary","type":"string"}},"text/html":{"schema":{"type":"string"}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"description":"Based on the Accept header the response will be base64 json encoded or a raw file.\napplication/octet-stream will return a binary file\napplication/json will return a json with the file content base64 encoded."}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/receipt":{"post":{"description":"Send receipt as PDF, print on printer or get as PDF\n\nRequired permissions: PURCHASE_ORDER","operationId":"post-tenants-stores-purchase-orders-receipt","requestBody":{"$ref":"#/components/requestBodies/PurchaseOrderEmailNotificationRequest"},"responses":{"200":{"$ref":"#/components/responses/FileResponse"},"201":{"description":"Created"},"400":{"description":"Bad Request"}},"summary":"Print or send receipt","deprecated":true,"tags":["Purchase"]}}}}
```

## Email PDF of purchase order receipt

> Email PDF of purchase order receipt\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"SendPurchaseOrderEmailRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseOrderSendEmailRequestSchema"}}}}},"schemas":{"PurchaseOrderSendEmailRequestSchema":{"title":"PurchaseOrderSendEmailRequestSchema","type":"object","required":["recipients"],"properties":{"recipients":{"type":"array","items":{"$ref":"#/components/schemas/EmailTYPE"}},"subject":{"type":"string"},"body":{"type":"string"},"includePDF":{"type":"boolean","default":true},"attachments":{"type":"array","items":{"$ref":"#/components/schemas/Base64EncodedFileContentSchema"}}}},"EmailTYPE":{"title":"Email","type":"string"},"Base64EncodedFileContentSchema":{"title":"Base64EncodedFileContentSchema","type":"object","properties":{"content":{"type":"string","description":" base64 encoded"},"contentType":{"description":"mime type","type":"string"},"filename":{"type":"string"}},"required":["content","contentType","filename"]}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/email":{"post":{"description":"Email PDF of purchase order receipt\n\nRequired permissions: PURCHASE_ORDER","operationId":"post-tenants-stores-purchase-orders-email-receipt","requestBody":{"$ref":"#/components/requestBodies/SendPurchaseOrderEmailRequest"},"responses":{"201":{"description":"Created"},"400":{"description":"Bad Request"}},"summary":"Email PDF of purchase order receipt","tags":["Purchase"]}}}}
```

## Download PDF of purchase order receipt

> Download PDF of purchase order receipt\
> \
> Required permissions: PURCHASE\_ORDER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"FileResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Base64EncodedFileContentSchema"}},"application/pdf":{"schema":{"format":"binary","type":"string"}},"text/html":{"schema":{"type":"string"}},"application/octet-stream":{"schema":{"type":"string","format":"binary"}}},"description":"Based on the Accept header the response will be base64 json encoded or a raw file.\napplication/octet-stream will return a binary file\napplication/json will return a json with the file content base64 encoded."}},"schemas":{"Base64EncodedFileContentSchema":{"title":"Base64EncodedFileContentSchema","type":"object","properties":{"content":{"type":"string","description":" base64 encoded"},"contentType":{"description":"mime type","type":"string"},"filename":{"type":"string"}},"required":["content","contentType","filename"]}}},"paths":{"/tenants/{tenantUid}/stores/{storeUid}/purchase-orders/{purchaseOrderUid}/download":{"get":{"description":"Download PDF of purchase order receipt\n\nRequired permissions: PURCHASE_ORDER","operationId":"get-tenants-stores-purchase-orders-download-receipt","responses":{"200":{"$ref":"#/components/responses/FileResponse"},"400":{"description":"Bad Request"}},"summary":"Download PDF of purchase order receipt","tags":["Purchase"]}}}}
```

## List supplier products for product

> Lists all supplier products for a productUid. If the product has been linked to a tenant productUid then additional information will be added.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}},"schemas":{"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"},"SupplierProductResponseSchema":{"title":"SupplierProductResponseSchema","type":"object","properties":{"createdAt":{"format":"date-time","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"supplierUid":{"$ref":"#/components/schemas/UID"},"purchasePrice":{"type":"integer"},"supplierProductUid":{"$ref":"#/components/schemas/UID"},"supplierSku":{"type":"string"}},"required":["createdAt","lastModifiedAt","productUid","supplierUid","purchasePrice","supplierProductUid","supplierSku"]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"}},"responses":{"SupplierProductListResponse":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SupplierProductResponseSchema"},"type":"array"},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"],"type":"object"}}},"description":"Example response"}}},"paths":{"/tenants/{tenantUid}/products/{productUid}/suppliers":{"get":{"description":"Lists all supplier products for a productUid. If the product has been linked to a tenant productUid then additional information will be added.","operationId":"get-tenants-products-suppliers","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}],"responses":{"200":{"$ref":"#/components/responses/SupplierProductListResponse"}},"summary":"List supplier products for product","tags":["Purchase"]}}}}
```

## Search for purchase orders

> Search for purchase orders in all stores on tenant.         \
> Empty values are ignored.  \
> The query field performs a fuzzy search, i.e. looks up words that contain the supplied value. \
> The search is case-insensitive.  \
> Example: If you search for "Ol" you will get "Olsen", "Olstad", "Bolset", "Ormebol", <kolstad@example.com>, etc ..

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"PurchaseOrderListResponse":{"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderResponseSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"]}},"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":{"schema":{"type":"string","format":"binary"}}},"description":"Example response"}},"schemas":{"PurchaseOrderResponseSchema":{"title":"PurchaseOrderResponseSchema","type":"object","required":["createdAt","createdBy","deliveryAddress","deliveryCity","deliveryCountryCode","deliveryName","deliveryPostalCode","externalId","items","lastModifiedAt","lastModifiedBy","note","purchaseNumber","purchaseOrderUid","status","storeUid","storeName","supplierUid","supplierName","discountRate","freight","currency","supplierReferenceNumber","invoiceAddress","reserveAfter","hasConfirmedReceivements"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"deliveryAddress":{"type":"string"},"deliveryCity":{"type":"string"},"deliveryCountryCode":{"type":"string"},"deliveryName":{"type":"string"},"deliveryPostalCode":{"type":"string"},"externalId":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemResponseSchema"}},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"note":{"type":"string"},"purchaseNumber":{"description":"Reference to a customer order","type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"status":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"supplierUid":{"$ref":"#/components/schemas/UID"},"supplierName":{"type":"string"},"discountRate":{"type":"integer"},"freight":{"type":"integer"},"currency":{"$ref":"#/components/schemas/PurchaseOrderCurrencySchema"},"supplierReferenceNumber":{"type":"string","description":"Supplier reference number"},"invoiceAddress":{"$ref":"#/components/schemas/PurchaseOrderInvoiceAddress"},"reserveAfter":{"type":"string","description":"If set, items in this purchase\norder cannot be reserved before this date.","format":"date-time","nullable":true},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},"hasConfirmedReceivements":{"type":"boolean"}}},"PurchaseOrderItemResponseSchema":{"title":"PurchaseOrderItemResponseSchema","type":"object","required":["createdAt","createdBy","expectedDeliveryDate","externalId","lastModifiedAt","lastModifiedBy","productUid","productName","productSerialNoRequired","productSku","purchaseOrderItemUid","quantityOrdered","quantityReceived","quantityReserved","supplierSku","unitPrice","receivementItems","discountAmount","freightAmount","unitCost","totalLinePrice","localCurrency","reservations","note","sortOrder","purchaseOrderItemLinks"],"properties":{"createdAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"expectedDeliveryDate":{"format":"date","type":"string"},"externalId":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"productName":{"type":"string"},"productSerialNoRequired":{"$ref":"#/components/schemas/SerialNoRequiredENUM"},"productSku":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantityOrdered":{"type":"integer"},"quantityReceived":{"type":"integer"},"quantityReserved":{"type":"integer"},"supplierSku":{"type":"string"},"interStoreSalesOrder":{"$ref":"#/components/schemas/InterStoreSalesOrderItemResponseSchema"},"unitPrice":{"type":"integer","description":"unitPrice is in purchase price in order currency before discounts"},"receivementItems":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseReceivementItemResponseSchema"}},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost pr unit."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."},"currency":{"$ref":"#/components/schemas/DeprecatedPurchaseOrderItemCurrencySchema"},"localCurrency":{"$ref":"#/components/schemas/PurchaseOrderItemCurrencySchema"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}},"note":{"type":"string"},"sortOrder":{"type":"integer"},"purchaseOrderItemLinks":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseOrderItemLinkSchema"}}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"SerialNoRequiredENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NO | No Serial number required|\n| ON_SALE | Can register serial number when selling a product (Serial number is optional)|\n| ON_RECEIVE | Must register serial number when receiving and selling product (Serial number is required)|","enum":["NO","ON_SALE","ON_RECEIVE"],"title":"SerialNoRequiredENUM","type":"string"},"InterStoreSalesOrderItemResponseSchema":{"title":"InterStoreSalesOrderItemResponseSchema","description":"The seller store's sales order line auto-created from and coupled 1:1 to this purchase\norder item in inter-store trade. Carries the same sales order fields as\nInterStoreSalesOrderResponseSchema plus the coupled line itself. Absent when the\npurchase order item is not part of inter-store trade.","allOf":[{"$ref":"#/components/schemas/InterStoreSalesOrderResponseSchema"},{"type":"object","required":["orderItemUid","reservationType","reservationDetails"],"properties":{"orderItemUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The coupled sales order line at the seller store."},"reservationType":{"allOf":[{"$ref":"#/components/schemas/SalesReservationTypeENUM"}],"description":"How the seller is covering its line, and the field to read first — it decides whether reservationDetails is worth looking at.\n`WAREHOUSE` — the seller has the goods in stock now. This is the normal state for a proactive inter-store purchase. The line may still name the purchase order the goods arrived on, kept as history — see reservationDetails.\n`PURCHASEORDER` — the goods are still on their way in to the seller, and reservationDetails.purchaseOrder carries the date this purchase order really depends on.\n`PURCHASEORDER_CONFIRMED` — the seller has a confirmed incoming shipment earmarked for the line, named by reservationDetails.receivement.\n`REQUEST_PURCHASEORDER` — the seller line is waiting for a purchase order that has not been placed yet.\n`NONE` — the seller line holds no reservation."},"reservationDetails":{"allOf":[{"$ref":"#/components/schemas/SalesReservationDetailsSchema"}],"description":"What the seller's line is itself waiting on — the same reservationDetails the seller sees on that line.\n**reservationType says what the line is waiting for; this object says what it is tied to.** They are not the same question, and on a `WAREHOUSE` line they have different answers.\nGoods that arrived keep the purchase order they came in on: the link is deliberately left in place so the sale can be traced back to the purchase it was covered by. So a `WAREHOUSE` line can carry a `purchaseOrder` whose `expectedDeliveryDate` is in the past — that date is a record of when the goods were expected, not a promise about a delivery still to come. Read a delivery date as pending only while reservationType says the line is still waiting for one.\n`purchaseOrder` is the seller's own incoming purchase order line, and its `expectedDeliveryDate` is the date this purchase order really depends on. `receivement` names an earmarked incoming shipment.\nA seller line that is itself sourced from a third store carries `interStorePurchaseOrder` here, which is how a chain of stores becomes visible to the store paying for it — the inter-store markup is applied at every hop. **The chain is only followed one step.** That third store's own reservationDetails is not carried, so this field never nests further than the seller immediately behind this purchase order line.\nNote that `warehouse` is never set, here or on a sales order line — a line's warehouse is reported by the sales line's own `warehouseUid` and `warehouseName`, which are not part of this object. Read reservationType for the stock case."}}}]},"InterStoreSalesOrderResponseSchema":{"title":"InterStoreSalesOrderResponseSchema","type":"object","description":"The seller store's sales order auto-created from and coupled 1:1 to this purchase\norder in inter-store trade. Absent when the purchase order is not part of inter-store\ntrade.","required":["orderUid","orderNumber","orderState","storeUid","storeName"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"storeUid":{"allOf":[{"$ref":"#/components/schemas/UID"}],"description":"The seller store the coupled sales order belongs to."},"storeName":{"type":"string"}}},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"SalesReservationTypeENUM":{"title":"SalesReservationTypeENUM","type":"string","enum":["NONE","WAREHOUSE","PURCHASEORDER","REQUEST_PURCHASEORDER","PURCHASEORDER_CONFIRMED"],"description":""},"SalesReservationDetailsSchema":{"title":"SalesReservationDetailsSchema","type":"object","properties":{"warehouse":{"$ref":"#/components/schemas/SalesReservationWarehouseSchema"},"purchaseOrder":{"$ref":"#/components/schemas/SalesReservationPurchaseOrderSchema"},"receivement":{"$ref":"#/components/schemas/SalesReservationReceivementSchema"},"interStorePurchaseOrder":{"$ref":"#/components/schemas/SalesReservationInterStorePurchaseOrderSchema"}}},"SalesReservationWarehouseSchema":{"title":"SalesReservationWarehouseSchema","type":"object","nullable":true,"description":"The warehouse a line covered from stock is held in.\n\nSet only when reservationType is WAREHOUSE. A line waiting on a purchase order can carry\na warehouse of its own, and naming it here would say the goods are in stock when they are\non order — so it stays absent for every other reservation type. That includes NONE, where\nthe line's own warehouseUid and warehouseName may well be set while this object is not.\n\nOn a sales order line it repeats what warehouseUid and warehouseName already say. Where it\nearns its place is a purchase order: there this object describes the coupled seller line,\nand the response carries no sales line to read those fields from, so this is the only\nplace the buying store learns which of the seller's warehouses its goods are held in.","required":["warehouseName"],"properties":{"warehouseName":{"type":"string","description":"The name of the warehouse. The uid is not part of this object: a sales order line\nreports it in its own warehouseUid, and a purchase order's coupled seller line does\nnot carry one at all."}}},"SalesReservationPurchaseOrderSchema":{"title":"SalesReservationPurchaseOrderSchema","type":"object","nullable":true,"required":["purchaseOrderUid","purchaseOrderItemUid","purchaseOrderNumber","quantityOrdered"],"properties":{"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"expectedDeliveryDate":{"type":"string","format":"date-time"},"purchaseOrderNumber":{"type":"string"},"quantityOrdered":{"type":"integer","description":"The quantity ordered on this purchase order line."},"externalId":{"type":"string"}}},"SalesReservationReceivementSchema":{"title":"SalesReservationReceivementSchema","type":"object","required":["receivementUid","receivementItemUid","expectedArrival","quantity","supplierOrderReference","receivedAt"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"expectedArrival":{"type":"string","format":"date-time"},"expectedDispatch":{"type":"string","format":"date-time"},"quantity":{"type":"integer"},"supplierOrderReference":{"type":"string"},"receivedAt":{"type":"string","format":"date-time","nullable":true}}},"SalesReservationInterStorePurchaseOrderSchema":{"title":"SalesReservationInterStorePurchaseOrderSchema","type":"object","nullable":true,"description":"In inter-store trade, the seller store this sales order line's goods are coming from,\nand the seller's own incoming purchase order line they are coming in on.\n\nSet only on a line at the buying store. The seller's own mirrored line does not carry it,\nso the presence of this field is what tells a client which side of the coupling it is\nlooking at — no need to read the order it belongs to. A seller store learns how much of\nits mirrored line is promised to customers from interStoreOrderReservationQuantity on\nthat line instead.\n\nRead it on order and delivery responses. A receipt line does not carry it: both of the\nline-level inter-store fields are live reservation state, counted from the reserving lines\nas they stand when the line is read, and a receipt records a settled sale. So on a receipt\nline their absence says nothing about which side of a coupling it is on.\n\nNote that reservationDetails.purchaseOrder alongside it is unchanged: that is still the\nbuying store's own purchase order, the one this line actually reserves against. This\nfield is one hop further out — where that purchase order gets its goods from.\n\nThe store is always named; the purchase order fields can be absent. They are absent when\nthe seller is fulfilling from its own stock rather than from an incoming purchase order.\nThat is the state a proactive inter-store purchase starts in, where the mirrored seller\nline is reserved from stock, and the normal case for a seller-initiated sale. The fields\nappear once the seller line is re-pointed at a specific incoming purchase order line.","required":["storeUid","storeName"],"properties":{"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"purchaseOrderUid":{"$ref":"#/components/schemas/UID"},"purchaseOrderNumber":{"type":"string"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"}}},"PurchaseReceivementItemResponseSchema":{"title":"PurchaseReceivementItemResponseSchema","description":"PurchaseReceivementItem","allOf":[{"type":"object","required":["receivementUid","receivementStatus","invoiceApproval"],"properties":{"receivementUid":{"$ref":"#/components/schemas/UID"},"receivementStatus":{"$ref":"#/components/schemas/ReceivementStatusENUM"},"invoiceApproval":{"$ref":"#/components/schemas/ReceivementInvoiceApprovalSchema"}}},{"$ref":"#/components/schemas/ReceivementItemResponseSchema"}]},"ReceivementStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| RECEIVED | Received|\n| PENDING | Put aside, not finished|\n| UPDATING | Updating in progress|\n| CONFIRMED | Confirmed |","enum":["RECEIVED","PENDING","UPDATING","CONFIRMED"],"title":"ReceivementStatusENUM","type":"string"},"ReceivementInvoiceApprovalSchema":{"title":"ReceivementInvoiceApprovalSchema","type":"object","nullable":true,"description":"Invoice-approval (fakturagodkjent) state. Null when the receivement is not invoice-approved.","required":["approvedAt","tenantUserUid","tenantUserDisplayName"],"properties":{"approvedAt":{"type":"string","format":"date-time"},"tenantUserUid":{"$ref":"#/components/schemas/UID"},"tenantUserDisplayName":{"type":"string"}}},"ReceivementItemResponseSchema":{"title":"ReceivementItemResponseSchema","type":"object","required":["createdAt","createdBy","externalId","lastModifiedAt","lastModifiedBy","product","purchaseOrderItemUid","quantity","receivementItemUid","status","note","tenantUserUid","tenantUserDisplayName","reservations"],"properties":{"createdAt":{"format":"date-time","type":"string"},"createdBy":{"type":"string"},"externalId":{"description":"External reference to receivement line","type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastModifiedBy":{"type":"string"},"product":{"$ref":"#/components/schemas/ReceivementItemProductResponseSchema"},"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"quantity":{"type":"integer"},"unitPrice":{"type":"integer","deprecated":true,"description":"Deprecated: Use unitcost instead"},"unitCost":{"type":"integer"},"receivementItemUid":{"$ref":"#/components/schemas/UID"},"serialnumber":{"type":"string"},"status":{"type":"string"},"note":{"type":"string"},"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"tenantUserDisplayName":{"type":"string","description":"The display name of the user that made the receivement"},"reservations":{"type":"array","items":{"$ref":"#/components/schemas/OrderItemReservationSchema"}}}},"ReceivementItemProductResponseSchema":{"title":"ReceivementItemProductResponseSchema","type":"object","required":["productUid","name","sku"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"sku":{"type":"string"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"OrderItemReservationSchema":{"title":"OrderItemReservationSchema","type":"object","required":["orderUid","orderItemUid","orderNumber","quantity","reservationType"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderItemUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"quantity":{"type":"integer"},"reservationType":{"$ref":"#/components/schemas/SalesReservationTypeENUM"}}},"DeprecatedPurchaseOrderItemCurrencySchema":{"title":"DeprecatedPurchaseOrderItemCurrencySchema","type":"object","deprecated":true,"required":["unitPrice","discountAmount","freightAmount","totalLinePrice"],"properties":{"unitPrice":{"type":"integer"},"discountAmount":{"type":"integer"},"freightAmount":{"type":"integer"},"totalLinePrice":{"type":"integer"}}},"PurchaseOrderItemCurrencySchema":{"title":"PurchaseOrderItemCurrencySchema","type":"object","description":"All prices is in the local tenant currency","required":["unitPrice","discountAmount","freightAmount","unitCost","totalLinePrice"],"properties":{"unitPrice":{"type":"integer","description":"unitPrice is in local currency before discount"},"discountAmount":{"type":"integer","description":"The discount amount pr unit"},"freightAmount":{"type":"integer","description":"The portion of the shipping cost for this purchase order line."},"unitCost":{"type":"integer","description":"The price pr unit including discount and freight. This is what will be used as cost price during receivement."},"totalLinePrice":{"type":"integer","description":"Total price for all the items including discounts and freight amount."}}},"PurchaseOrderItemLinkSchema":{"description":"Order reference for an order product item","title":"PurchaseOrderItemLinkSchema","type":"object","required":["purchaseOrderItemUid","type"],"properties":{"purchaseOrderItemUid":{"$ref":"#/components/schemas/UID"},"type":{"$ref":"#/components/schemas/PurchaseOrderLinkTypeResponseENUM"}}},"PurchaseOrderLinkTypeResponseENUM":{"description":"Describes the type of link on an order product item\n\n|ENUM | Description |\n| --- | --- |\n| PACKAGE | Reference to orderline with main package product |\n| PACKAGE_COMPONENT | Reference to orderline with package component product |\n","enum":["PACKAGE","PACKAGE_COMPONENT"],"title":"PurchaseOrderLinkTypeResponseENUM","type":"string"},"PurchaseOrderStatusENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NEW | Created, but not sent to supplier yet.|\n| SENT_TO_SUPPLIER | Sent to supplier.|\n| CANCELLED_BY_SUPPLIER | The purchase order have been cancelled by the supplier. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| IN_TRANSIT | The goods are in transit. This status is only applicable for suppliers who are integrated with FlowRetail.|\n| PARTIALLY_RECEIVED | Not all goods have been received yet.|\n| RECEIVED | All goods have been received.|\n| CLOSED | No longer able to process purchase order.|\n| CANCELLED_BY_SUPPLIER | Purchase was cancelled by supplier|","enum":["NEW","PARTIALLY_RECEIVED","RECEIVED","SENT_TO_SUPPLIER","IN_TRANSIT","CLOSED","CANCELLED_BY_SUPPLIER"],"title":"PurchaseOrderStatusENUM","type":"string"},"PurchaseOrderCurrencySchema":{"title":"PurchaseOrderCurrencySchema","type":"object","required":["code","exchangeRate"],"properties":{"code":{"type":"string","description":"ISO 4217"},"exchangeRate":{"type":"integer"}}},"PurchaseOrderInvoiceAddress":{"title":"PurchaseOrderInvoiceAddress","type":"object","required":["companyName","address","postalCode","city","countryCode","vatNumber","email"],"properties":{"companyName":{"type":"string"},"address":{"type":"string"},"postalCode":{"type":"string"},"city":{"type":"string"},"countryCode":{"type":"string"},"vatNumber":{"type":"string"},"email":{"type":"string"}}},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"},"TenantPurchaseOrderSearchSchema":{"title":"TenantPurchaseOrderSearchSchema","type":"object","properties":{"fromDateTime":{"format":"date-time","type":"string","deprecated":true,"description":"Deprecated. Use `createdAt`."},"toDateTime":{"format":"date-time","type":"string","deprecated":true,"description":"Deprecated. Use `createdAt`."},"createdAt":{"$ref":"#/components/schemas/DateTimeRangeSchema"},"orderStatuses":{"type":"array","description":"Reference to a list of orderStatuses.","items":{"$ref":"#/components/schemas/PurchaseOrderStatusENUM"}},"storeUids":{"type":"array","description":"Reference to a list of storeUids","items":{"$ref":"#/components/schemas/UID"}},"organizationUids":{"type":"array","description":"Reference to a list of organizationUids","items":{"$ref":"#/components/schemas/UID"}},"supplierUid":{"$ref":"#/components/schemas/UID"},"query":{"type":"string"},"productUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"hasConfirmedReceivements":{"type":"boolean"}}},"DateTimeRangeSchema":{"title":"DateTimeRangeSchema","type":"object","required":["from","to"],"properties":{"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"}}}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}},"requestBodies":{"TenantPurchaseOrderSearchRequest":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantPurchaseOrderSearchSchema"}}}}}},"paths":{"/tenants/{tenantUid}/purchase-orders/search":{"post":{"summary":"Search for purchase orders","tags":["Purchase"],"responses":{"200":{"$ref":"#/components/responses/PurchaseOrderListResponse"}},"operationId":"get-tenants-purchase-orders-search","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}],"requestBody":{"$ref":"#/components/requestBodies/TenantPurchaseOrderSearchRequest"},"description":"Search for purchase orders in all stores on tenant.         \nEmpty values are ignored.  \nThe query field performs a fuzzy search, i.e. looks up words that contain the supplied value. \nThe search is case-insensitive.  \nExample: If you search for \"Ol\" you will get \"Olsen\", \"Olstad\", \"Bolset\", \"Ormebol\", kolstad@example.com, etc .."}}}}
```

## Search purchase-requests products

> List of products from order items with reservation type \`REQUEST\_PURCHASE\_ORDER\`.  \
> Optionally filter on organisation, store, supplier, and order state.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"PurchaseRequestListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","required":["items","paging"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseRequestProductSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}}}}}}},"schemas":{"PurchaseRequestProductSchema":{"title":"PurchaseRequestProductSchema","type":"object","required":["productUid","sku","productName","totalQuantityOrdered","oldestOrderCreatedAt","suppliers","orders"],"properties":{"productUid":{"$ref":"#/components/schemas/UID"},"sku":{"type":"string"},"productName":{"type":"string"},"totalQuantityOrdered":{"type":"integer","description":"total quantity in order lines"},"oldestOrderCreatedAt":{"type":"string","format":"date-time","description":"the oldest createdAt in order lines"},"suppliers":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseRequestSupplierSchema"}},"orders":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseRequestOrderSchema"}}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"PurchaseRequestSupplierSchema":{"title":"PurchaseRequestSupplierSchema","type":"object","required":["supplierUid","name"],"properties":{"supplierUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"}}},"PurchaseRequestOrderSchema":{"title":"PurchaseRequestOrderSchema","type":"object","required":["orderUid","orderNumber","orderState","settleState","customerDisplayName","storeUid","storeName","items","createdAt"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"settleState":{"$ref":"#/components/schemas/OrderSettleStateENUM"},"customerDisplayName":{"type":"string"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseRequestOrderItemSchema"}},"createdAt":{"type":"string","format":"date-time"}},"description":""},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"OrderSettleStateENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NOT_STARTED | Settlement not started|\n| IN_PROGRESS | Settlement is in progress and the order cannot be changed|\n| COMPLETE | Settlement is complete|","enum":["NOT_STARTED","IN_PROGRESS","COMPLETE"],"title":"OrderSettleStateENUM","type":"string"},"PurchaseRequestOrderItemSchema":{"title":"PurchaseRequestOrderItemSchema","type":"object","required":["orderItemUid","sortOrder","quantityOrdered","note"],"properties":{"orderItemUid":{"$ref":"#/components/schemas/UID"},"sortOrder":{"type":"integer"},"quantityOrdered":{"type":"integer"},"note":{"type":"string"}}},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}}},"requestBodies":{"PurchaseRequestRequest":{"content":{"application/json":{"schema":{"type":"object","properties":{"organizationUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"storeUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"supplierUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"orderStates":{"type":"array","items":{"$ref":"#/components/schemas/OrderOrderStateENUM"}}}}}}}}},"paths":{"/tenants/{tenantUid}/purchase-orders/requests":{"post":{"summary":"Search purchase-requests products","tags":["Purchase"],"responses":{"200":{"$ref":"#/components/responses/PurchaseRequestListResponse"}},"operationId":"post-purchase-orders-requests","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"}],"description":"List of products from order items with reservation type `REQUEST_PURCHASE_ORDER`.  \nOptionally filter on organisation, store, supplier, and order state.","requestBody":{"$ref":"#/components/requestBodies/PurchaseRequestRequest"}}}}}
```

## Search purchase-requests by orders

> List of products from order items with reservation type \`REQUEST\_PURCHASE\_ORDER\`.  \
> Optionally filter on organisation, store, supplier, and order state.\
> \
> The output is grouped by order.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"Purchase","description":"Purchase"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"PurchaseRequestOrdersListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","required":["items","paging"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseRequestOrderGroupSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}}}}}}},"schemas":{"PurchaseRequestOrderGroupSchema":{"title":"PurchaseRequestOrderGroupSchema","type":"object","required":["orderUid","orderNumber","orderState","settleState","customerDisplayName","storeUid","storeName","items","createdAt"],"properties":{"orderUid":{"$ref":"#/components/schemas/UID"},"orderNumber":{"type":"string"},"orderState":{"$ref":"#/components/schemas/OrderOrderStateENUM"},"settleState":{"$ref":"#/components/schemas/OrderSettleStateENUM"},"customerDisplayName":{"type":"string"},"storeUid":{"$ref":"#/components/schemas/UID"},"storeName":{"type":"string"},"items":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseRequestOrderItemGroupByOrderSchema"}},"createdAt":{"type":"string","format":"date-time"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"OrderOrderStateENUM":{"description":"|ENUM | Description |\n| --- | --- |\n| OPEN | Order is open and beeing edited by someone|\n| PARKED | Order is parked|\n| CANCELED | Order is canceled/deleted|\n| COMPLETE | Order is complete|\n| CONFIRMED | Order is confirmed|\n","enum":["OPEN","PARKED","CANCELED","COMPLETE","CONFIRMED"],"title":"OrderOrderStateENUM","type":"string"},"OrderSettleStateENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| NOT_STARTED | Settlement not started|\n| IN_PROGRESS | Settlement is in progress and the order cannot be changed|\n| COMPLETE | Settlement is complete|","enum":["NOT_STARTED","IN_PROGRESS","COMPLETE"],"title":"OrderSettleStateENUM","type":"string"},"PurchaseRequestOrderItemGroupByOrderSchema":{"title":"PurchaseRequestOrderItemGroupByOrderSchema","type":"object","required":["orderItemUid","sortOrder","quantityOrdered","note","sku","productName","productUid","suppliers"],"properties":{"orderItemUid":{"$ref":"#/components/schemas/UID"},"sortOrder":{"type":"integer"},"quantityOrdered":{"type":"integer"},"note":{"type":"string"},"sku":{"type":"string"},"productName":{"type":"string"},"productUid":{"$ref":"#/components/schemas/UID"},"suppliers":{"type":"array","items":{"$ref":"#/components/schemas/PurchaseRequestSupplierSchema"}}}},"PurchaseRequestSupplierSchema":{"title":"PurchaseRequestSupplierSchema","type":"object","required":["supplierUid","name"],"properties":{"supplierUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"}}},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}}},"requestBodies":{"PurchaseRequestRequest":{"content":{"application/json":{"schema":{"type":"object","properties":{"organizationUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"storeUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"supplierUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"orderStates":{"type":"array","items":{"$ref":"#/components/schemas/OrderOrderStateENUM"}}}}}}}}},"paths":{"/tenants/{tenantUid}/purchase-orders/requests-by-orders":{"post":{"summary":"Search purchase-requests by orders","tags":["Purchase"],"responses":{"200":{"$ref":"#/components/responses/PurchaseRequestOrdersListResponse"}},"operationId":"post-purchase-orders-requests-by-orders","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"}],"description":"List of products from order items with reservation type `REQUEST_PURCHASE_ORDER`.  \nOptionally filter on organisation, store, supplier, and order state.\n\nThe output is grouped by order.","requestBody":{"$ref":"#/components/requestBodies/PurchaseRequestRequest"}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flowretail.com/docs/developers/api-documentation/purchase.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
