> ## Documentation Index
> Fetch the complete documentation index at: https://developer.jtl-software.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GetPurchaseOrderById

> Retrieves the full detail of a purchase order by its ID.



**query** `GetPurchaseOrderById(purchaseOrderId: ID!): PurchaseOrder!`

## Arguments

**`purchaseOrderId`**: `ID!` (required)

## Returns

`PurchaseOrder!`

**`purchaseOrderId`**: `ID!`

Unique ID of the purchase order.

---

**`supplierId`**: `ID!`

ID of the supplier the order was placed with.

---

**`supplierName`**: `String`

The supplier's current display name, resolved at read time. NULL if the supplier could not be resolved.

---

**`orderNumber`**: `String`

The order's own number.

---

**`externalOrderNumber`**: `String`

The buyer's own order number.

---

**`referenceOrderNumber`**: `String`

A reference order number.

---

**`status`**: `PurchaseOrderStatus!`

The order's current status.

---

**`currencyIso`**: `String!`

ISO code of the order's currency.

---

**`currencyFactor`**: `Decimal!`

Conversion factor of the order's currency.

---

**`requestedDeliveryDate`**: `DateTime`

The delivery date requested from the supplier.

---

**`createdAt`**: `DateTime`

Date the order was created.

---

**`isConfirmed`**: `Boolean!`

Whether the order has been confirmed by the supplier.

---

**`warehouseId`**: `ID`

Target warehouse of the incoming goods.

---

**`companyId`**: `ID`

The company the order was placed for.

---

**`internalComment`**: `String`

Internal comment on the order, not communicated to the supplier.

---

**`lineItems`**: `[PurchaseOrderLineItem!]!`

The order's line items — article positions and free positions. Summing this list yields the goods value only; freight charges, discounts and minimum quantity charges are not included here and are returned under allowancesAndCharges instead.

---

**`allowancesAndCharges`**: `[PurchaseOrderAllowanceAndCharge!]!`

Document-level allowances and charges. The document total is the goods value from lineItems plus the entries in this list — there is no header total field, so the client computes it. Rows are grouped by (type, vatRatePercentage); amounts are summed within the group; the note of the row with the lowest sort order in the group wins, ties broken by the lowest line item id. The tiebreaker is mandatory: sort order has no uniqueness guarantee within a group — an import that never sets it leaves every row at the same default. These values are the stored rows, grouped and summed — not a figure this API derives or validates. The Wawi may overwrite them the next time the order is opened and saved in the desktop client: discounts unconditionally, freight charge and minimum quantity surcharge depending on a shipping-position auto-detection setting. An order without charge rows returns an empty list, never null.

---

**`deliveryAddress`**: `PurchaseOrderAddress`

Delivery address of the order.

---

**`billingAddress`**: `PurchaseOrderAddress`

Billing address of the order.

---

**`supplier`**: `PurchaseOrderSupplierSnapshot`

Snapshot of the supplier's master data at the time the order was created.

