> ## 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.

# Get purchase-to-order allocation availability

> Read what each fulfillable line of a sales order can be sourced from right now — the read surface
behind the in-app allocation planner, exposed so a caller can see availability **before** calling
`POST /purchase-orders/{purchaseOrderId}/allocate` (rather than allocating blind and guessing the
PO line).

Per line: on-hand by warehouse group and each open incoming purchase-order line — **with its
`purchase_order_item_id`** (the id you peg against), the container's alternate id, its ETA and how
much of it is still free to allocate — plus the routing-suggested channel. A **kit** line is flagged
`is_kit` and carries a `components` array: one entry per component (the same availability shape),
each carrying its own `sales_item_id`, which is the grain a kit allocation targets.

## Allocation workflow

1. **See what a line can be sourced from** — this endpoint.
2. *(optional)* find the container PO by its number / alternate id — `GET /purchase-orders`
   filtered on the alternate id (e.g. a container code like `SYD7967`).
3. **Allocate** — `POST /purchase-orders/{purchaseOrderId}/allocate`.
4. **Read the pegs back** — `GET /purchase-orders/{id}`; each line's `allocations[].peg_ids`
   lists the peg ids.
5. **Reverse (unallocate)** — `POST /purchase-orders/reverse-allocation` with a `peg_id`.

Requires the **purchase-to-order** feature; without it the endpoint returns `422`.




## OpenAPI

````yaml /api-reference/build.yaml get /sales-orders/{salesOrderId}/allocation-availability
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: 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: 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 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: Currency
    description: Currency configuration, exchange rates, and conversion
  - name: Integration Mappings
    description: Manage integration mappings for external systems
  - name: Integration Field Mappings
    description: Manage field-level mappings between Luminous and external systems
paths:
  /sales-orders/{salesOrderId}/allocation-availability:
    get:
      tags:
        - Sales Orders
      summary: Get purchase-to-order allocation availability
      description: >
        Read what each fulfillable line of a sales order can be sourced from
        right now — the read surface

        behind the in-app allocation planner, exposed so a caller can see
        availability **before** calling

        `POST /purchase-orders/{purchaseOrderId}/allocate` (rather than
        allocating blind and guessing the

        PO line).


        Per line: on-hand by warehouse group and each open incoming
        purchase-order line — **with its

        `purchase_order_item_id`** (the id you peg against), the container's
        alternate id, its ETA and how

        much of it is still free to allocate — plus the routing-suggested
        channel. A **kit** line is flagged

        `is_kit` and carries a `components` array: one entry per component (the
        same availability shape),

        each carrying its own `sales_item_id`, which is the grain a kit
        allocation targets.


        ## Allocation workflow


        1. **See what a line can be sourced from** — this endpoint.

        2. *(optional)* find the container PO by its number / alternate id —
        `GET /purchase-orders`
           filtered on the alternate id (e.g. a container code like `SYD7967`).
        3. **Allocate** — `POST /purchase-orders/{purchaseOrderId}/allocate`.

        4. **Read the pegs back** — `GET /purchase-orders/{id}`; each line's
        `allocations[].peg_ids`
           lists the peg ids.
        5. **Reverse (unallocate)** — `POST /purchase-orders/reverse-allocation`
        with a `peg_id`.


        Requires the **purchase-to-order** feature; without it the endpoint
        returns `422`.
      operationId: getSalesOrderAllocationAvailability
      parameters:
        - in: path
          name: salesOrderId
          required: true
          schema:
            type: integer
          description: Sales order ID
      responses:
        '200':
          description: Allocation availability for the sales order
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      sales_order_id:
                        type: integer
                        example: 3048
                      ship_complete:
                        type: boolean
                        description: Whether the order requires ship-complete fulfillment.
                        example: false
                      lines:
                        type: array
                        items:
                          type: object
                          description: >
                            Purchase-to-order sourcing availability for a single
                            sales-order line. Shows what the line can be

                            sourced from right now: on-hand by warehouse group
                            and each open incoming purchase-order line — with

                            the `purchase_order_item_id` you peg against — plus
                            the routing-suggested channel.
                          properties:
                            sales_order_item_id:
                              type: integer
                              description: >-
                                The sales-order line item id this availability
                                entry is for.
                              example: 6982
                            rfq_id:
                              type: integer
                              description: The product (RFQ) id of the line.
                              example: 4464
                            sku:
                              type: string
                              nullable: true
                              example: AS-9061-1.5ER-HESPER-THISTLE
                            name:
                              type: string
                              nullable: true
                              example: Cloud Cosy End Chair Right - HESPER - THISTLE
                            line_quantity:
                              type: number
                              description: Ordered quantity on the line.
                              example: 1
                            already_allocated:
                              type: number
                              description: >-
                                Quantity of the line already pegged against
                                supply.
                              example: 0
                            is_kit:
                              type: boolean
                              description: >
                                When `true`, this line is a kit and its
                                `components` array carries the per-component
                                availability;

                                a kit is allocated at component grain (pass
                                `sales_item_id` per allocation on the allocate
                                call).
                              example: false
                            suggested_channel_id:
                              type: integer
                              nullable: true
                              description: >-
                                The routing-suggested fulfillment channel id for
                                the line.
                              example: 14
                            preferred_vendor_id:
                              type: integer
                              nullable: true
                              description: >-
                                Preferred supplier id for the product, when one
                                is configured.
                              example: null
                            preferred_vendor_name:
                              type: string
                              nullable: true
                              example: null
                            warehouse_groups:
                              type: array
                              description: >-
                                Sourcing availability broken down by warehouse
                                group.
                              items:
                                type: object
                                description: >-
                                  Purchase-to-order sourcing availability within
                                  a single warehouse group.
                                properties:
                                  warehouse_group_id:
                                    type: integer
                                    example: 2
                                  warehouse_group_name:
                                    type: string
                                    nullable: true
                                    example: Sydney
                                  channels:
                                    type: array
                                    description: The channels tied to this warehouse group.
                                    items:
                                      type: object
                                      properties:
                                        id:
                                          type: integer
                                          example: 14
                                        label:
                                          type: string
                                          example: SYD
                                  on_hand_available:
                                    type: number
                                    description: >-
                                      Quantity available to allocate from
                                      on-hand stock in this warehouse group.
                                    example: 0
                                  incoming_pos:
                                    type: array
                                    description: >-
                                      Open incoming purchase-order lines that
                                      can supply this line, in this warehouse
                                      group.
                                    items:
                                      type: object
                                      properties:
                                        purchase_order_id:
                                          type: integer
                                          example: 28
                                        purchase_order_item_id:
                                          type: integer
                                          description: >-
                                            The PO line item id to peg against on
                                            `POST /purchase-orders/{id}/allocate`.
                                          example: 731
                                        alternate_id:
                                          type: string
                                          nullable: true
                                          description: >-
                                            The container's alternate id / code
                                            (e.g. a container code like `SYD7967`).
                                          example: SYD7967
                                        warehouse_name:
                                          type: string
                                          nullable: true
                                          example: Sydney DC
                                        eta:
                                          type: string
                                          nullable: true
                                          description: >-
                                            Estimated arrival date of the incoming
                                            PO line (`YYYY-MM-DD`).
                                          example: '2026-08-21'
                                        available_to_allocate:
                                          type: number
                                          description: >-
                                            Quantity of this incoming PO line still
                                            free to allocate.
                                          example: 1
                                  incoming_totals:
                                    type: object
                                    properties:
                                      po_count:
                                        type: integer
                                        description: >-
                                          Number of open incoming PO lines in this
                                          warehouse group.
                                        example: 1
                                      free_to_allocate:
                                        type: number
                                        description: >-
                                          Total quantity across `incoming_pos`
                                          still free to allocate.
                                        example: 1
                                  has_more_incoming:
                                    type: boolean
                                    description: >-
                                      Whether more incoming PO lines exist
                                      beyond those returned in `incoming_pos`.
                                    example: false
                            components:
                              type: array
                              description: >
                                Present only on kit lines (`is_kit: true`). One
                                entry per kit component, each with the same

                                availability shape as a line plus its own
                                `sales_item_id` (the allocation grain).
                              items:
                                type: object
                                description: >
                                  Purchase-to-order sourcing availability for a
                                  single kit component. Same shape as a
                                  top-level line,

                                  plus its own `sales_item_id` — the grain a kit
                                  allocation targets.
                                properties:
                                  sales_item_id:
                                    type: integer
                                    description: >
                                      The peg grain for the component — the
                                      `mt_shipstation_sales_items` id that a kit
                                      allocation targets.
                                    example: 14961
                                  sales_order_item_id:
                                    type: integer
                                    example: 7001
                                  rfq_id:
                                    type: integer
                                    description: The product (RFQ) id of the component.
                                    example: 1801
                                  sku:
                                    type: string
                                    nullable: true
                                    example: COMP-A
                                  name:
                                    type: string
                                    nullable: true
                                  line_quantity:
                                    type: number
                                    example: 1
                                  already_allocated:
                                    type: number
                                    example: 0
                                  is_kit:
                                    type: boolean
                                    example: false
                                  suggested_channel_id:
                                    type: integer
                                    nullable: true
                                    example: 14
                                  preferred_vendor_id:
                                    type: integer
                                    nullable: true
                                    example: null
                                  preferred_vendor_name:
                                    type: string
                                    nullable: true
                                    example: null
                                  warehouse_groups:
                                    type: array
                                    description: >-
                                      Sourcing availability broken down by
                                      warehouse group.
                                    items:
                                      type: object
                                      description: >-
                                        Purchase-to-order sourcing availability
                                        within a single warehouse group.
                                      properties:
                                        warehouse_group_id:
                                          type: integer
                                          example: 2
                                        warehouse_group_name:
                                          type: string
                                          nullable: true
                                          example: Sydney
                                        channels:
                                          type: array
                                          description: >-
                                            The channels tied to this warehouse
                                            group.
                                          items:
                                            type: object
                                            properties:
                                              id:
                                                type: integer
                                                example: 14
                                              label:
                                                type: string
                                                example: SYD
                                        on_hand_available:
                                          type: number
                                          description: >-
                                            Quantity available to allocate from
                                            on-hand stock in this warehouse group.
                                          example: 0
                                        incoming_pos:
                                          type: array
                                          description: >-
                                            Open incoming purchase-order lines that
                                            can supply this line, in this warehouse
                                            group.
                                          items:
                                            type: object
                                            properties:
                                              purchase_order_id:
                                                type: integer
                                                example: 28
                                              purchase_order_item_id:
                                                type: integer
                                                description: >-
                                                  The PO line item id to peg against on
                                                  `POST /purchase-orders/{id}/allocate`.
                                                example: 731
                                              alternate_id:
                                                type: string
                                                nullable: true
                                                description: >-
                                                  The container's alternate id / code
                                                  (e.g. a container code like `SYD7967`).
                                                example: SYD7967
                                              warehouse_name:
                                                type: string
                                                nullable: true
                                                example: Sydney DC
                                              eta:
                                                type: string
                                                nullable: true
                                                description: >-
                                                  Estimated arrival date of the incoming
                                                  PO line (`YYYY-MM-DD`).
                                                example: '2026-08-21'
                                              available_to_allocate:
                                                type: number
                                                description: >-
                                                  Quantity of this incoming PO line still
                                                  free to allocate.
                                                example: 1
                                        incoming_totals:
                                          type: object
                                          properties:
                                            po_count:
                                              type: integer
                                              description: >-
                                                Number of open incoming PO lines in this
                                                warehouse group.
                                              example: 1
                                            free_to_allocate:
                                              type: number
                                              description: >-
                                                Total quantity across `incoming_pos`
                                                still free to allocate.
                                              example: 1
                                        has_more_incoming:
                                          type: boolean
                                          description: >-
                                            Whether more incoming PO lines exist
                                            beyond those returned in `incoming_pos`.
                                          example: false
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '404':
          description: Sales order not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '422':
          description: Purchase-to-order is not enabled for this account
          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.

````