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

# Map a line item to a product / toggle flags

> Maps a non-posted sales order line item to a Luminous product, and/or
toggles the `ignore_item` / `non_physical_item` flags so unmappable lines
can clear purgatory.

**Side effects:**
- When `product_id` is set, the line's `rfq_id` is updated. If the parent
  order has a `warehouse_group_id`, a stock record for that
  product/warehouse-group pair is resolved or created.
- When `add_as_alternate_sku=true` and the channel SKU differs from the
  product's internal SKU, an alternate SKU row is upserted so future orders
  with that SKU auto-map.
- After the save, the parent order is re-evaluated against the current
  purgatory settings. If `post_clean_orders=true` and the last unmapped
  line just became mapped, the order can post automatically in the same step.

Returns **422** if the parent order is already posted.




## OpenAPI

````yaml /api-reference/build.yaml patch /purgatory/order-items/{salesOrderItemId}
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: Purchase Orders
    description: Get and modify purchase orders
  - 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:
  /purgatory/order-items/{salesOrderItemId}:
    patch:
      tags:
        - Purgatory
      summary: Map a line item to a product / toggle flags
      description: >
        Maps a non-posted sales order line item to a Luminous product, and/or

        toggles the `ignore_item` / `non_physical_item` flags so unmappable
        lines

        can clear purgatory.


        **Side effects:**

        - When `product_id` is set, the line's `rfq_id` is updated. If the
        parent
          order has a `warehouse_group_id`, a stock record for that
          product/warehouse-group pair is resolved or created.
        - When `add_as_alternate_sku=true` and the channel SKU differs from the
          product's internal SKU, an alternate SKU row is upserted so future orders
          with that SKU auto-map.
        - After the save, the parent order is re-evaluated against the current
          purgatory settings. If `post_clean_orders=true` and the last unmapped
          line just became mapped, the order can post automatically in the same step.

        Returns **422** if the parent order is already posted.
      operationId: mapPurgatoryOrderItem
      parameters:
        - in: path
          name: salesOrderItemId
          required: true
          schema:
            type: integer
          description: ID of the sales order line item
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                product_id:
                  type: integer
                  minimum: 1
                  nullable: true
                  description: >
                    Luminous product ID to map this line to. Omit to leave the
                    mapping

                    untouched (useful when only toggling flags).
                add_as_alternate_sku:
                  type: boolean
                  default: false
                  description: >
                    When `true` and the line's channel SKU differs from the
                    product's

                    internal SKU, upsert an alternate SKU record so future
                    orders with

                    that SKU auto-map.
                non_physical_item:
                  type: boolean
                  description: Mark the line as non-physical (no inventory effect on post).
                ignore_item:
                  type: boolean
                  description: Mark the line as ignored for purgatory evaluation.
      responses:
        '200':
          description: Updated sales order line item
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: Unique identifier for the order item
                      line_number:
                        type: integer
                        description: >-
                          Sequential line number for this item on the sales
                          order, only unique within the order, starts at 1
                      created_at:
                        type: string
                        format: date-time
                        description: Creation timestamp
                      updated_at:
                        type: string
                        format: date-time
                        description: Last update timestamp
                      sku:
                        type: string
                        description: Stock keeping unit
                      name:
                        type: string
                        description: Product name
                      image_url:
                        type: string
                        description: URL of product image
                      weight:
                        type: object
                        description: Weight information
                      quantity:
                        type: number
                        format: float
                        description: Ordered quantity
                      unit_price:
                        type: number
                        format: float
                        description: Price per unit
                      tax:
                        type: number
                        format: float
                        description: Tax amount
                      shipping:
                        type: number
                        format: float
                        description: Shipping amount
                      warehouse_location:
                        type: string
                        description: Location in warehouse
                      options:
                        type: object
                        description: Additional options
                      fulfillment_sku:
                        type: string
                        description: SKU used for fulfillment
                      adjustment:
                        type: number
                        format: float
                        description: Price adjustment
                      upc:
                        type: string
                        description: Universal Product Code
                      stock_id:
                        type: integer
                        description: Stock identifier
                      kit_id:
                        type: integer
                        description: Kit identifier if part of a kit
                      non_physical_item:
                        type: boolean
                        description: Whether item is non-physical
                      ignore_item:
                        type: boolean
                        description: Whether to ignore this item
                      quantity_shipped:
                        type: number
                        format: float
                        description: Quantity shipped
                      quantity_cancelled:
                        type: number
                        format: float
                        description: Quantity cancelled
                      quantity_invoiced:
                        type: number
                        format: float
                        description: Quantity invoiced
                      quantity_ordered:
                        type: number
                        format: float
                        description: Original quantity ordered
                      base_uom_id:
                        type: integer
                        description: Base unit of measure ID
                      ordered_uom_id:
                        type: integer
                        description: Ordered unit of measure ID
                      product_id:
                        type: integer
                        description: Product identifier
                      total_returned_base_quantity:
                        type: number
                        format: float
                        description: Total quantity returned
                      parent_id:
                        type: integer
                        description: Parent item ID
                      status:
                        type: string
                        description: Item status
                      discount:
                        type: number
                        format: float
                        description: Discount amount
                      estimated_ship_date:
                        type: string
                        format: date
                        description: Estimated shipping date
                      custom_fields:
                        type: object
                        description: Dynamic custom fields with key-value pairs
                        additionalProperties:
                          type: string
                      product:
                        type: object
                        description: Product information
                        properties:
                          id:
                            type: integer
                            description: Unique identifier for the product
                          name:
                            type: string
                            description: Product name
                          description:
                            type: string
                            nullable: true
                            description: Product description
                          retail_price:
                            type: number
                            format: float
                            description: Retail price
                          wholesale_price:
                            type: number
                            format: float
                            description: Wholesale price
                          unit_cost:
                            type: number
                            format: float
                            description: Cost per unit
                          product_weight:
                            type: number
                            format: float
                            description: Weight of the product
                          product_length:
                            type: number
                            format: float
                            description: Length of the product (in inches)
                          product_width:
                            type: number
                            format: float
                            description: Width of the product (in inches)
                          product_height:
                            type: number
                            format: float
                            description: Height of the product (in inches)
                          sellable:
                            type: boolean
                            description: Whether the product can be sold
                          discontinued:
                            type: boolean
                            description: >-
                              Whether the product is discontinued. Discontinued
                              products will be hidden in the Luminous UI by
                              default.
                          image_url:
                            type: string
                            nullable: true
                            description: URL to the product's main image
                          category:
                            type: object
                            nullable: true
                            properties:
                              id:
                                type: integer
                              name:
                                type: string
                            description: Product category information
                          subcategory:
                            type: object
                            nullable: true
                            properties:
                              id:
                                type: integer
                              name:
                                type: string
                            description: Product subcategory information
                          custom_fields:
                            type: object
                            description: Dynamic custom fields with key-value pairs
                            additionalProperties:
                              type: string
                          variant_attributes:
                            type: object
                            nullable: true
                            description: Available variant attributes
                          sku:
                            type: string
                            description: Internal SKU
                          alternate_skus:
                            type: array
                            description: Alternate SKUs
                            items:
                              type: object
                              properties:
                                id:
                                  type: integer
                                sku:
                                  type: string
                          upc:
                            type: string
                            description: UPC/Barcode
                          tags:
                            type: array
                            description: Tags associated with the product
                            items:
                              type: object
                              properties:
                                id:
                                  type: integer
                                  description: Unique identifier for the tag
                                name:
                                  type: string
                                  description: Name of the tag
                                description:
                                  type: string
                                  nullable: true
                                  description: Description of the tag
                                icon:
                                  type: string
                                  nullable: true
                                  description: Icon identifier or URL for the tag
                                color:
                                  type: string
                                  nullable: true
                                  description: Color code for the tag
                              required:
                                - id
                                - name
                          supplier:
                            type: object
                            nullable: true
                            description: Supplier information
                          created_at:
                            type: string
                            format: date-time
                            description: Timestamp when the product was created
                          updated_at:
                            type: string
                            format: date-time
                            description: Timestamp when the product was last updated
                      tags:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: integer
                            name:
                              type: string
                            description:
                              type: string
                            icon:
                              type: string
                            color:
                              type: string
                            discount_structure:
                              type: object
                            markup_structure:
                              type: object
                        description: Tags associated with the sales order item
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '422':
          description: Validation error or order already posted
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        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.

````