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

# Edit a purchase-order line's quantity or unit price

> Change one purchase-order line's `quantity` and/or `unit_price` in place. Send either field or
both. The line keeps its `id`, so its bill and receipt links stay attached, and the other lines
on the purchase order are left alone. By contrast, the full-replace `PUT /purchase-orders/{id}`
prunes any line it is not sent.

The edit goes through the same single-line save as the purchase-order grid. Incoming stock, the
line total, the purchase-order totals and any unbilled receiving reports are updated, and the
purchase-order-updated automations run. On a purchase order already sent to the supplier, the
change is recorded as an API revision.

- `quantity` is in the line's ordered unit of measure. It cannot be lower than what has already
  been received on the line (compared in the SKU's base unit); that returns `422`. Editing the
  quantity of a closed line also returns `422`.
- `unit_price` is in the base currency. On a purchase order with a `currency_code`, the line's
  supplier-currency price (`presentment_unit_price`) is restated from it at the purchase order's
  exchange rate.

The purchase order's payment schedule is recalculated in the same step and returned as
`data.payment_schedule`. Milestones with nothing paid against them are re-derived from the new
purchase-order total. A milestone that is paid or partly paid keeps its amount, and the unpaid
percentage milestones absorb the difference so the schedule still adds up to the new total. If
the schedule cannot be recalculated, the request fails with `500` and the line is left unchanged.




## OpenAPI

````yaml /api-reference/build.yaml patch /purchase-orders/{purchaseOrderId}/items/{lineItemId}
openapi: 3.0.0
info:
  title: Luminous API
  version: 1.0.0
  description: API documentation for Luminous
servers:
  - url: https://{companyName}.api.joinluminous.com/external/api/v1
    variables:
      companyName:
        default: companyName
        description: Your company-specific subdomain
security: []
tags:
  - name: Products
    description: Get and manage products
  - name: Pricing
    description: Manage price schedules, levels, and customizations
  - name: BOMs
    description: Manage Bills of Materials (BOMs)
  - name: Labels
    description: Label rendering via Labelary ZPL service
  - name: Companies
    description: Manage business accounts and their associated data
  - name: Contacts
    description: Manage contact information for individuals
  - name: Suppliers
    description: Manage suppliers (factories) — vendors used on purchase orders
  - name: Supplier SKUs
    description: Manage per-supplier SKU and unit-cost overrides for products
  - name: Locations
    description: Manage warehouses and locations
  - name: Inventory
    description: Get and adjust product stock levels
  - name: Lots
    description: Create, update, and delete product lots (batches)
  - name: Transfer Orders
    description: Manage transfer orders
  - name: Fulfillment Orders
    description: Manage fulfillment orders and picklists
  - name: Freight
    description: >-
      Freightview LTL freight — quotes, booking and documents for fulfillment
      orders
  - name: Fulfillment Priority Lists
    description: Configure fulfillment routing priority lists
  - name: Purchase Orders
    description: Get and modify purchase orders
  - name: Supplier Portal
    description: >-
      Read a supplier's response to a purchase order and control the one-click
      portal link
  - name: Receiving Reports
    description: Manage receiving reports
  - name: Defective Reports
    description: >-
      Record and list defective units received on purchase orders (Inventory >
      Defectives)
  - name: Payment Obligations
    description: Manage payment obligations for purchase orders
  - name: Sales Orders
    description: Manage sales orders and sales order shipments
  - name: Purgatory
    description: >-
      Inspect and resolve non-posted sales orders in the purgatory staging
      workflow
  - name: PickFlow Warehouse
    description: >-
      Warehouse-floor lookups for PickFlow — barcode resolution, bin and product
      stock, bin search, and receivables
  - name: PickFlow Shipping
    description: >-
      Provider-agnostic shipping rates, services, packages, and label purchase
      for PickFlow
  - name: Cycle Counts
    description: >-
      Create, drive, and post PickFlow cycle counts — batches, per-warehouse
      sessions, and CSV import/export
  - name: Print Stations
    description: List paired print stations and enqueue print jobs to them
  - name: Invoices
    description: Get and manage invoices
  - name: Work Orders
    description: >-
      Manage work orders — production lifecycle, steps, materials, links,
      shipments, and comments
  - name: Production Batches
    description: Group and manage work orders as production batches
  - name: Bills
    description: >-
      Accounts payable bill management, payments, attachments, allocations, and
      variance
  - name: Prepayments
    description: Manage vendor prepayments and applications
  - name: Vendor Credits
    description: Manage vendor credits and applications
  - name: Vendor Returns
    description: Manage vendor returns and credit generation
  - name: Customer Returns
    description: Manage customer returns (sales returns), receiving, and restock behavior
  - name: Stock Snapshot
    description: Point-in-time stock snapshots with export support
  - name: Consumption
    description: Consumption reports and exports
  - name: Inventory Aging
    description: Cost-layer-based inventory aging reports
  - name: Bills Reports
    description: Accounts payable bills aging reports
  - name: Forecast
    description: Materialized forecast data
  - name: Reports
    description: Close the books, inventory discrepancy, transaction COGS, and EDI reports
  - name: Tags
    description: Add/remove tags across various resources
  - name: Custom Fields
    description: Get and set custom fields across various resources
  - name: Approvals
    description: >-
      Approval rules that hold sales orders and supplier POs for sign-off, and
      their approver templates
  - name: Currency
    description: Currency configuration, exchange rates, and conversion
  - name: Drive
    description: >
      Browse, upload, tag and manage files in your Luminous Drive. An API token
      sees the shared

      drive only, never My Files or restricted folders and files. Every write
      and download made

      through the API is recorded in the file's activity log (`GET
      /file-cabinet/files/{id}/activity`)

      with `actor_kind: api_token`.
  - name: Integration Mappings
    description: Manage integration mappings for external systems
  - name: Integration Field Mappings
    description: Manage field-level mappings between Luminous and external systems
  - name: Automations
    description: Create, test, and inspect automation rules and their runs
paths:
  /purchase-orders/{purchaseOrderId}/items/{lineItemId}:
    patch:
      tags:
        - Purchase Orders
      summary: Edit a purchase-order line's quantity or unit price
      description: >
        Change one purchase-order line's `quantity` and/or `unit_price` in
        place. Send either field or

        both. The line keeps its `id`, so its bill and receipt links stay
        attached, and the other lines

        on the purchase order are left alone. By contrast, the full-replace `PUT
        /purchase-orders/{id}`

        prunes any line it is not sent.


        The edit goes through the same single-line save as the purchase-order
        grid. Incoming stock, the

        line total, the purchase-order totals and any unbilled receiving reports
        are updated, and the

        purchase-order-updated automations run. On a purchase order already sent
        to the supplier, the

        change is recorded as an API revision.


        - `quantity` is in the line's ordered unit of measure. It cannot be
        lower than what has already
          been received on the line (compared in the SKU's base unit); that returns `422`. Editing the
          quantity of a closed line also returns `422`.
        - `unit_price` is in the base currency. On a purchase order with a
        `currency_code`, the line's
          supplier-currency price (`presentment_unit_price`) is restated from it at the purchase order's
          exchange rate.

        The purchase order's payment schedule is recalculated in the same step
        and returned as

        `data.payment_schedule`. Milestones with nothing paid against them are
        re-derived from the new

        purchase-order total. A milestone that is paid or partly paid keeps its
        amount, and the unpaid

        percentage milestones absorb the difference so the schedule still adds
        up to the new total. If

        the schedule cannot be recalculated, the request fails with `500` and
        the line is left unchanged.
      operationId: updatePurchaseOrderItem
      parameters:
        - in: path
          name: purchaseOrderId
          required: true
          schema:
            type: integer
          description: ID of the purchase order the line item belongs to
        - in: path
          name: lineItemId
          required: true
          schema:
            type: integer
          description: ID of the purchase-order line item to edit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: At least one of `quantity` or `unit_price` is required.
              properties:
                quantity:
                  type: number
                  format: float
                  exclusiveMinimum: true
                  minimum: 0
                  description: >
                    New ordered quantity in the line's ordered unit of measure.
                    Must be greater than `0`

                    and not less than the quantity already received. Required
                    when `unit_price` is omitted.
                  example: 120
                unit_price:
                  type: number
                  format: float
                  minimum: 0
                  description: >-
                    New unit price in the base currency. Required when
                    `quantity` is omitted.
                  example: 4.25
            examples:
              quantity_and_price:
                summary: Change quantity and price
                value:
                  quantity: 120
                  unit_price: 4.25
              price_only:
                summary: Change only the price
                value:
                  unit_price: 12.5
      responses:
        '200':
          description: >
            Line updated. `data` is the edited line; `purchase_order` is the
            whole purchase order after

            the edit (same shape as `GET /purchase-orders/{id}`), so its new
            totals can be read without

            a second request.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: >-
                          ID of the purchase-order line item (unchanged by the
                          edit)
                        example: 78001
                      purchase_order_id:
                        type: integer
                        description: ID of the purchase order the line belongs to
                        example: 9001
                      product_id:
                        type: integer
                        description: ID of the product on the line
                        example: 5521
                      quantity:
                        type: number
                        format: float
                        description: Ordered quantity (ordered unit of measure)
                        example: 120
                      ordered_qty:
                        type: number
                        format: float
                        description: Ordered quantity in the SKU's base unit
                        example: 120
                      quantity_received:
                        type: number
                        format: float
                        description: Quantity received so far (base unit)
                        example: 40
                      unit_price:
                        type: number
                        format: float
                        description: Unit price in the base currency
                        example: 4.25
                      presentment_unit_price:
                        type: number
                        format: float
                        nullable: true
                        description: >-
                          Unit price in the supplier's currency, or `null` when
                          the purchase order has none
                        example: null
                      line_total:
                        type: number
                        format: float
                        description: Line total in the base currency
                        example: 510
                      payment_schedule:
                        type: array
                        description: >
                          The purchase order's payment milestones after the
                          edit, in sequence order.

                          Empty when the purchase order has no payment schedule.
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                              description: >-
                                Payment obligation ID (see `GET
                                /payment-obligations/{id}`)
                              example: 3301
                            milestone_label:
                              type: string
                              nullable: true
                              example: Deposit
                            milestone_type:
                              type: string
                              enum:
                                - deposit
                                - before_shipment
                                - on_shipment
                                - on_receipt
                                - on_delivery
                                - net_days
                                - final
                                - manual
                              example: deposit
                            sequence:
                              type: integer
                              example: 1
                            status:
                              type: string
                              enum:
                                - pending
                                - due
                                - partially_fulfilled
                                - fulfilled
                                - cancelled
                                - waived
                              example: fulfilled
                            percentage:
                              type: number
                              format: float
                              nullable: true
                              description: >-
                                The milestone's share of the purchase-order
                                total, or `null` for a fixed-amount milestone
                              example: 30
                            amount:
                              type: number
                              format: float
                              description: Amount of the milestone
                              example: 150
                            paid_amount:
                              type: number
                              format: float
                              description: Amount paid against the milestone so far
                              example: 150
                            due_amount:
                              type: number
                              format: float
                              description: '`amount` minus `paid_amount`, never below `0`'
                              example: 0
                            expected_amount:
                              type: number
                              format: float
                              nullable: true
                              description: >
                                `percentage` of the current purchase-order
                                total. `null` when the

                                milestone has no percentage.
                              example: 153
                            over_under:
                              type: number
                              format: float
                              nullable: true
                              description: >
                                On a paid or partly paid percentage milestone,
                                how far its fixed

                                `amount` sits above (positive) or below
                                (negative) `expected_amount`.

                                `null` on unpaid milestones, which follow the
                                total.
                              example: -3
                  purchase_order:
                    description: >
                      The updated purchase order, in the same shape as `GET
                      /purchase-orders/{id}`,

                      with its totals recomputed after the line change.
                    type: object
                    properties:
                      id:
                        type: integer
                        description: Unique identifier for the purchase order
                      order_numbers:
                        type: array
                        description: List of purchase order numbers
                        items:
                          type: string
                      created_by:
                        type: integer
                        nullable: true
                        description: >-
                          ID of the Luminous user who created the purchase order
                          (the app's **Created By**), or `null` when none was
                          recorded. `POST /purchase-orders` records the user the
                          API token belongs to (for an OAuth token, the user it
                          was issued for); it is not accepted in the request
                          body and `PUT` never changes it. Purchase orders
                          created through the API before this field existed
                          return `null`.
                        example: 12
                      created_by_name:
                        type: string
                        nullable: true
                        description: >-
                          First and last name of the `created_by` user, or
                          `null` when there is no such user or no name. A
                          PII-restricted token always gets `null` (the
                          `created_by` ID is still returned). Returned by `GET
                          /purchase-orders`, `GET /purchase-orders/{id}` and the
                          purchase order payment endpoints; the create, update
                          and append-items responses, and purchase orders
                          embedded in other responses (receiving reports,
                          inbound shipments), have no `created_by_name` key.
                        example: Pat Buyer
                      created_at:
                        type: string
                        format: date-time
                        description: Timestamp when the purchase order was created
                      updated_at:
                        type: string
                        format: date-time
                        description: Timestamp when the purchase order was last updated
                      order_status:
                        type: string
                        enum:
                          - active
                          - inactive
                          - deleted
                        description: Status of the purchase order
                      order_date:
                        type: string
                        format: date
                        description: Date when the purchase order was created
                      invoice_date:
                        type: string
                        format: date
                        description: Date when the purchase order was invoiced
                      arrival_due_date:
                        type: string
                        format: date
                        nullable: true
                        description: Expected arrival date for the order
                      requested_ship_date:
                        type: string
                        format: date
                        nullable: true
                        description: Requested shipping date
                      original_arrival_due_date:
                        type: string
                        format: date
                        nullable: true
                        description: >-
                          Frozen Original ETA — the arrival date as first
                          planned, distinct from the current `arrival_due_date`.
                          Null when unset.
                      shipment_type:
                        type: string
                        nullable: true
                        enum:
                          - Air
                          - Sea
                          - Road
                          - Rail
                          - Express
                          - null
                        description: >-
                          Freight mode used by the Transit Time Matrix. Null
                          when unset.
                      override_transit_days:
                        type: integer
                        nullable: true
                        description: >-
                          Manual override of the transit-matrix calendar days
                          used to derive the arrival date. Null when unset.
                      order_type:
                        type: integer
                        description: Type of the order
                      incoterm:
                        type: string
                        description: International Commercial Terms for the order
                      tracking_info:
                        type: string
                        nullable: true
                        description: Tracking information for the order
                      payment_terms:
                        type: string
                        description: Payment terms for the order
                      supplier_id:
                        type: integer
                        description: ID of the supplier
                      item_count:
                        type: integer
                        description: Number of unique items in the order
                      total_qty_ordered:
                        type: number
                        format: float
                        description: Total quantity of line items ordered
                      total_qty_received:
                        type: number
                        format: float
                        description: Total quantity of line items received
                      total_qty_remaining:
                        type: number
                        format: float
                        description: >-
                          Total quantity of line items remaining to be received
                          (ordered - received)
                      receipt_status:
                        type: string
                        nullable: true
                        enum:
                          - awaiting_shipment
                          - partially_received
                          - fully_received
                        description: >-
                          PO-level receipt status rolled up from its lines (same
                          value as the app's Receipt Status column).
                          `awaiting_shipment` — nothing received yet ("Pending
                          Receipt" in the app); `fully_received` — every line
                          not closed short has received at least its ordered
                          quantity (over-receipt counts); `partially_received` —
                          anything else. Voided receipts don't count.
                      currency_code:
                        type: string
                        nullable: true
                        description: >-
                          The purchase order's supplier currency. `null` for a
                          purchase order in the account's base currency, unless
                          the base currency code was sent explicitly through the
                          API, in which case it is returned. Costs and totals
                          are always in base currency.
                        example: EUR
                      exchange_rate:
                        type: number
                        format: float
                        nullable: true
                        description: >-
                          Base-currency units per 1 unit of `currency_code`.
                          `null` for a base-currency purchase order.
                        example: 1.085
                      order_cost:
                        type: number
                        format: float
                        description: >-
                          Cost of the order before tax and shipping — line items
                          plus additional fees (including automatic cost-rule
                          fees)
                      total_tax:
                        type: number
                        format: float
                        description: Total tax amount
                      total_shipping_cost:
                        type: number
                        format: float
                        description: Total shipping cost
                      total_cost:
                        type: number
                        format: float
                        description: Total cost including tax and shipping
                      total_paid:
                        type: number
                        format: float
                        description: Total amount paid
                      total_due:
                        type: number
                        format: float
                        description: Total amount due
                      total_volume_cbm:
                        type: number
                        format: float
                        description: >
                          Container-fill summary: total shipping volume in cubic
                          metres, rolled up from each line item's

                          box/carton dimensions × ordered quantity. `0` when no
                          line item's SKU has usable dimensions.
                      total_weight_kg:
                        type: number
                        format: float
                        description: >
                          Container-fill summary: total shipping weight in
                          kilograms, rolled up from each line item's

                          per-unit weight × ordered quantity. `0` when no line
                          item's SKU has a weight set.
                      lines_missing_dimensions:
                        type: integer
                        description: >
                          Number of line items whose SKU lacks usable box/carton
                          dimensions and therefore contribute

                          nothing to `total_volume_cbm`. Useful for flagging an
                          incomplete container-fill estimate.
                      volume_target_cbm:
                        type: number
                        format: float
                        nullable: true
                        description: >
                          Target container volume in cubic metres (the fill
                          gauge's denominator), or `null` when no

                          target has been set for this purchase order.
                      volume_remaining_cbm:
                        type: number
                        format: float
                        nullable: true
                        description: >
                          Remaining container volume in cubic metres, computed
                          as `max(0, volume_target_cbm - total_volume_cbm)`.

                          `null` when `volume_target_cbm` is not set.
                      volume_fill_percent:
                        type: number
                        format: float
                        nullable: true
                        description: >
                          How full the container is, as a percentage
                          (`total_volume_cbm / volume_target_cbm × 100`).

                          `null` when `volume_target_cbm` is not set or zero.
                      down_payment:
                        type: number
                        format: float
                        description: Down payment amount
                      public_note:
                        type: string
                        nullable: true
                        description: Public notes
                      private_note:
                        type: string
                        nullable: true
                        description: Private notes
                      starred:
                        type: boolean
                        description: Whether the order is starred
                      items:
                        type: array
                        description: >-
                          Line items in the purchase order. Each is the same
                          `PurchaseOrderItem` object served by `GET
                          /purchase-orders/items`; on this detail endpoint the
                          per-line `allocations` array is populated.
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                              description: Line item ID
                            purchase_order_id:
                              type: integer
                              description: ID of the parent purchase order
                            created_at:
                              type: string
                              format: date-time
                              description: Creation timestamp
                            updated_at:
                              type: string
                              format: date-time
                              description: Last update timestamp
                            quantity:
                              type: number
                              format: float
                              description: >-
                                How much was ordered, counted in the line's
                                **ordered** unit of measure (the unit
                                `ordered_unit_of_measure` names). A line ordered
                                as 10 cases of 12 reads `10` here and `120` in
                                `quantity_ordered`.
                            presentment_unit_price:
                              type: number
                              format: float
                              nullable: true
                              description: >-
                                The line price in the purchase order's supplier
                                currency, per ordered unit. `null` on a
                                base-currency purchase order.
                            unit_price:
                              type: number
                              format: float
                              description: >-
                                Price per unit, always in base currency. For a
                                line written through this API whose ordered unit
                                converts, this is per base unit; a line saved on
                                the PO screen keeps it per ordered unit.
                            unit:
                              type: string
                              nullable: true
                              description: Unit of measure
                            tax:
                              type: number
                              format: float
                              description: Tax amount
                            discount_amount:
                              type: number
                              format: float
                              description: Discount amount
                            line_total:
                              type: number
                              format: float
                              description: Total for this line item
                            expected_ship_date:
                              type: string
                              format: date
                              nullable: true
                              description: >-
                                Per-line expected ship date override. When null,
                                this line inherits the purchase order's header
                                `requested_ship_date`.
                            expected_arrival_date:
                              type: string
                              format: date
                              nullable: true
                              description: >-
                                Per-line expected arrival date override. When
                                null, this line inherits the purchase order's
                                header `arrival_due_date`.
                            requested_ship_date:
                              type: string
                              format: date
                              nullable: true
                              description: >-
                                Purchase order header requested ship date,
                                copied onto every line. It is the same for every
                                line of a PO and differs from the per-line
                                `expected_ship_date` override.
                            arrival_due_date:
                              type: string
                              format: date
                              nullable: true
                              description: >-
                                Purchase order header current ETA, copied onto
                                every line. It is the same for every line of a
                                PO and differs from the per-line
                                `expected_arrival_date` override.
                            shipment_type:
                              type: string
                              nullable: true
                              enum:
                                - Air
                                - Sea
                                - Road
                                - Rail
                                - Express
                                - null
                              description: >-
                                Purchase order header freight mode, copied onto
                                every line. It is the same for every line of a
                                PO and is not a per-line value.
                            original_arrival_due_date:
                              type: string
                              format: date
                              nullable: true
                              description: >-
                                Purchase order header frozen Original ETA (the
                                arrival date as first planned), copied onto
                                every line.
                            override_transit_days:
                              type: integer
                              nullable: true
                              description: >-
                                Purchase order header manual override of the
                                transit-matrix calendar days, copied onto every
                                line.
                            quantity_received:
                              type: number
                              format: float
                              description: >-
                                How much has been received against this line,
                                summed across receipts, in the **base** unit of
                                measure. Each receipt line records the unit it
                                was received in and stores its quantity already
                                converted to base, so this total is reliably in
                                one unit (DV-4147). It previously read a roll-up
                                column that some receiving paths populated
                                without converting, so this figure is no longer
                                approximate on a line whose ordered and base
                                units differ.
                            received_quantity:
                              type: number
                              format: float
                              deprecated: true
                              description: >-
                                **Deprecated (2026-08-13).** Identical value to
                                `quantity_received`; use that field instead.
                                Both keys are emitted from one computed value
                                and can never diverge. No sunset date — the
                                alias is retained indefinitely for backward
                                compatibility.
                            quantity_ordered:
                              type: number
                              format: float
                              description: >-
                                The same order as `quantity`, converted to the
                                line's **base** unit of measure — not a second
                                order. A line ordered as 10 cases of 12 reads
                                `120` here and `10` in `quantity`.
                            quantity_shipped:
                              type: number
                              format: float
                              description: >-
                                How much has shipped against this line, in the
                                **ordered** unit of measure. Summed across every
                                shipment line, each converted from the unit it
                                was recorded in. Gross: no shipment-status
                                filter.
                            quantity_billed:
                              type: number
                              format: float
                              description: >-
                                How much has been billed against this line, in
                                the **ordered** unit of measure. Summed across
                                every linked bill line, each converted from its
                                own unit. Gross and status-agnostic — drafts
                                count, credits and returns are not netted off —
                                and excluding lines whose bill was deleted.
                            quantity_allocated:
                              type: number
                              format: float
                              description: >-
                                How much of this incoming line is already
                                committed to a sales order, in the **base** unit
                                of measure. The open purchase-to-order
                                reservation; `0` on an unpegged line.
                            quantity_released:
                              type: number
                              format: float
                              description: >-
                                Gross quantity released from pegs on this line —
                                the received/fulfilled portion of the
                                purchase-to-order reservation, in the **base**
                                unit of measure. Additive to
                                `quantity_allocated` (which stays open-only, so
                                releasing a peg does not shrink it); `0` on an
                                unpegged line.
                            under_covered_quantity:
                              type: number
                              format: float
                              description: >-
                                How much of the open reservation on this line
                                can no longer be covered by the effective
                                remaining quantity — for example when the parent
                                PO is **Completed** short, leaving effective
                                remaining at `0`. Additive; `0` on an unpegged
                                line or one whose open reservation is still
                                fully coverable.
                            remaining_to_ship:
                              type: number
                              format: float
                              description: >-
                                `quantity − quantity_shipped`, in the
                                **ordered** unit of measure. **Signed** —
                                over-shipping off a PO is a supported flow
                                reconciled on the bill, so an over-shipped line
                                reports the overage as a negative rather than
                                `0`.
                            remaining_to_receive:
                              type: number
                              format: float
                              description: >-
                                `quantity − quantity_received`. **Signed**, for
                                the same reason as `remaining_to_ship`. The one
                                figure here that spans two bases — `quantity` is
                                the ordered unit and the received quantity is
                                nominally the base unit (DV-4119) — so treat it
                                as approximate on a line whose two units differ.
                                Closing a line short does **not** change this
                                figure — read `open_quantity` for what is still
                                expected.
                            open_quantity:
                              type: number
                              format: float
                              description: >-
                                Still-expected quantity in the **ordered** unit
                                of measure. `0` when the line is closed short;
                                otherwise `remaining_to_receive` floored at 0.
                                Integrators that treat "remaining" as "still
                                coming" should read this field. See `PATCH
                                /purchase-orders/{purchaseOrderId}/items/{lineItemId}/closed`.
                              example: 40
                            closed_at:
                              type: string
                              format: date-time
                              nullable: true
                              description: >-
                                When the line was closed short (ISO-8601), or
                                `null` if the line is open.
                              example: null
                            close_reason:
                              type: string
                              nullable: true
                              description: >-
                                Reason recorded when the line was closed short,
                                or `null` if the line is open.
                              example: null
                            available_to_allocate:
                              type: number
                              format: float
                              description: >-
                                How much of this incoming line is still free to
                                commit to a sales order, in the **base** unit of
                                measure: `max(0, open quantity −
                                quantity_allocated)`, where the open quantity is
                                ordered minus received. **Floored at 0** (unlike
                                the two signed figures above) because you cannot
                                commit a negative quantity. A closed line
                                reports `0`. Answers what is left to promise,
                                not how far off the PO the delivery landed.
                                Renamed from `quantity_remaining` (DV-4144).
                            volume_cbm:
                              type: number
                              format: float
                              description: >
                                Per-unit shipping volume in cubic metres,
                                derived from the SKU's box dimensions

                                (falling back to carton dimensions). `0` when
                                the SKU has no usable dimensions. Part of the

                                container-fill summary.
                            line_volume_cbm:
                              type: number
                              format: float
                              description: >
                                This line's total shipping volume in cubic
                                metres (`volume_cbm` × `quantity_ordered`).
                            weight_kg:
                              type: number
                              format: float
                              description: >
                                Per-unit shipping weight in kilograms. `0` when
                                the SKU has no weight set. Part of the

                                container-fill summary.
                            line_weight_kg:
                              type: number
                              format: float
                              description: >
                                This line's total shipping weight in kilograms
                                (`weight_kg` × `quantity_ordered`).
                            allocations:
                              type: array
                              description: >
                                Which sales orders currently hold the allocation
                                on this line. Only populated on the

                                single purchase-order detail endpoint (`GET
                                /purchase-orders/{id}`); always an empty

                                array on the list endpoint and for non-allocated
                                lines.
                              items:
                                type: object
                                properties:
                                  sales_order_id:
                                    type: integer
                                    description: >-
                                      ID of the sales order holding the
                                      allocation
                                  sales_order_number:
                                    type: string
                                    nullable: true
                                    description: Human-readable sales order number
                                  quantity_allocated:
                                    type: number
                                    format: float
                                    description: >-
                                      Open quantity this sales order has pegged
                                      to the line
                                  quantity_released:
                                    type: number
                                    format: float
                                    description: >-
                                      Quantity already released from this sales
                                      order's pegs on the line (the
                                      received/fulfilled portion). Rows are
                                      retained while either `quantity_allocated`
                                      or `quantity_released` is greater than
                                      `0`, so a fully-received allocation still
                                      appears with its release history.
                                  peg_ids:
                                    type: array
                                    items:
                                      type: integer
                                    description: >
                                      IDs of the pegs backing this allocation.
                                      Pass these to

                                      `POST /purchase-orders/reverse-allocation`
                                      (which is peg-scoped) to reverse an

                                      allocation made through the API. Allocate,
                                      read the peg ids back from

                                      `GET /purchase-orders/{id}`, then reverse
                                      them.
                            source_sku:
                              type: string
                              nullable: true
                              description: Source SKU from the supplier
                            product:
                              type: object
                              nullable: true
                              description: Associated product information
                              properties:
                                id:
                                  type: integer
                                  description: Product ID
                                name:
                                  type: string
                                  description: Product name
                                description:
                                  type: string
                                  nullable: true
                                  description: Product description
                                retail_price:
                                  type: number
                                  format: float
                                  description: Product retail price
                                wholesale_price:
                                  type: number
                                  format: float
                                  description: Product wholesale price
                                unit_cost:
                                  type: number
                                  format: float
                                  description: Product unit cost
                                product_weight:
                                  type: number
                                  format: float
                                  description: Product weight
                                product_length:
                                  type: number
                                  format: float
                                  description: Product length (in inches)
                                product_width:
                                  type: number
                                  format: float
                                  description: Product width (in inches)
                                product_height:
                                  type: number
                                  format: float
                                  description: Product height (in inches)
                                sellable:
                                  type: boolean
                                  description: Whether the product is sellable
                                discontinued:
                                  type: boolean
                                  description: Whether the product is discontinued
                                image_url:
                                  type: string
                                  nullable: true
                                  description: Product image URL
                                variant_attributes:
                                  type: object
                                  nullable: true
                                  description: Product variant attributes
                                sku:
                                  type: string
                                  description: Product internal SKU
                                upc:
                                  type: string
                                  description: Product UPC/Barcode
                                created_at:
                                  type: string
                                  format: date-time
                                  description: Product creation timestamp
                                updated_at:
                                  type: string
                                  format: date-time
                                  description: Product last update timestamp
                            base_unit_of_measure:
                              type: object
                              nullable: true
                              description: Base unit of measure
                              properties:
                                id:
                                  type: integer
                                name:
                                  type: string
                                abbreviation:
                                  type: string
                            ordered_unit_of_measure:
                              type: object
                              nullable: true
                              description: Ordered unit of measure
                              properties:
                                id:
                                  type: integer
                                name:
                                  type: string
                                abbreviation:
                                  type: string
                            lot:
                              type: object
                              nullable: true
                              description: Product lot information
                              properties:
                                id:
                                  type: integer
                                lot_number:
                                  type: string
                                expiration_date:
                                  type: string
                                  format: date
                                  nullable: true
                      supplier:
                        type: object
                        properties:
                          id:
                            type: integer
                          status:
                            type: integer
                          name:
                            type: string
                          description:
                            type: string
                          street_address:
                            type: string
                          city:
                            type: string
                          state:
                            type: string
                          zip:
                            type: string
                          country:
                            type: string
                          contact_name:
                            type: string
                          contact_email:
                            type: string
                          contact_phone:
                            type: string
                          created_at:
                            type: string
                            format: date-time
                          updated_at:
                            type: string
                            format: date-time
                          custom_fields:
                            type: object
                            description: >-
                              Read-only map of the supplier's custom field
                              values as label => value pairs. Always a JSON
                              object; empty when no custom fields are set.
                            example:
                              Region: Southwest
                              Preferred Carrier: UPS
                      payments:
                        type: array
                        description: Array of payments for this purchase order
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                              description: Unique identifier for the payment
                            payment_date:
                              type: string
                              format: date
                              description: Date of the payment
                            payment_type:
                              type: string
                              enum:
                                - cash
                                - credit_card
                                - debit_card
                                - check
                                - bank_transfer
                              description: Type of payment
                            paid_amount:
                              type: number
                              format: float
                              description: Amount paid
                            remarks:
                              type: string
                              nullable: true
                              description: Payment remarks or notes
                            external_id:
                              type: string
                              nullable: true
                              description: External payment reference ID
                            created_by:
                              type: object
                              description: User who created the payment
                              properties:
                                id:
                                  type: integer
                                  description: User ID
                                name:
                                  type: string
                                  nullable: true
                                  description: User full name
                            created_at:
                              type: string
                              format: date-time
                              description: Timestamp when the payment was created
                            updated_at:
                              type: string
                              format: date-time
                              description: Timestamp when the payment was last updated
                      ship_to:
                        type: object
                        nullable: true
                        description: Shipping address information
                        properties:
                          address_1:
                            type: string
                            nullable: true
                            description: Primary street address
                          address_2:
                            type: string
                            nullable: true
                            description: Secondary address line
                          city:
                            type: string
                            nullable: true
                            description: City name
                          state:
                            type: string
                            nullable: true
                            description: State or province
                          zip:
                            type: string
                            nullable: true
                            description: ZIP or postal code
                          country:
                            type: string
                            nullable: true
                            description: Country name
                          default_ship_to_address:
                            type: string
                            enum:
                              - ship_to_address
                              - warehouse
                            nullable: true
                            description: Default shipping address preference
                      warehouse_id:
                        type: integer
                        nullable: true
                        description: >-
                          ID of the destination warehouse. Always present (null
                          when the PO has no warehouse set).
                      location_id:
                        type: integer
                        nullable: true
                        description: >-
                          ID of the destination location within the warehouse.
                          Always present (null when the PO has no location set).
                      warehouse:
                        type: object
                        nullable: true
                        description: >-
                          Expanded warehouse object. Present when the warehouse
                          relation is loaded (list and detail responses);
                          omitted when the PO has no warehouse.
                        properties:
                          id:
                            type: integer
                          name:
                            type: string
                      location:
                        type: object
                        nullable: true
                        description: >-
                          Expanded location object. Present when the location
                          relation is loaded (list and detail responses);
                          omitted when the PO has no location.
                        properties:
                          id:
                            type: integer
                          name:
                            type: string
                      tags:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                            name:
                              type: string
                            description:
                              type: string
                              nullable: true
                            icon:
                              type: string
                              nullable: true
                            color:
                              type: string
                              nullable: true
                      fulfillment_orders:
                        type: array
                        description: >-
                          Linked fulfillment orders. Present when the relation
                          is loaded; deduplicated by ID.
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                            order_number:
                              type: string
                              nullable: true
                            order_status:
                              type: string
                              nullable: true
                      custom_fields:
                        type: object
                        description: >-
                          Custom field values on the purchase order as label =>
                          value pairs. Field definitions are available via `GET
                          /custom-fields?object_type=purchase-orders`; values
                          can also be read and written via
                          `/purchase-orders/{id}/custom-fields`. Number-type
                          custom fields come back as numbers (the stored numeric
                          value, or stored numeric text converted to a number);
                          a number field holding non-numeric text returns
                          `null`.
                        additionalProperties: true
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '404':
          description: >
            Purchase order line item not found, or it does not belong to this
            purchase order

            (`Purchase order line item not found.`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '422':
          description: >
            Validation error: neither `quantity` nor `unit_price` sent,
            `quantity` not greater than `0`,

            `unit_price` negative, or `quantity` below what was received

            (`Quantity cannot be less than the {received} already received on
            this line.`, with the

            received quantity shown without trailing zeros, e.g. `60`), or a
            `quantity` change on a closed line

            (`This line is closed. Reopen it before changing quantity.`). Also
            returned

            with the service message when the line save fails.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '500':
          description: >
            The payment schedule could not be recalculated for the new total, so
            the edit was rolled

            back and the line is unchanged

            (`The payment schedule could not be recalculated, so the line edit
            was not saved.`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authenticate using a bearer token. To create a token, navigate to
        /settings/api-tokens and click Create API Token.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.