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

# Remap a sales-order item

> Remap a single posted line item to a different product and re-post the
order's sales items. Use this to correct an incorrect product mapping on an
already-posted sales order (purgatory mapping only covers pre-posting
orders).

The service evaluates a guardrail matrix before acting:

- If a fulfillment order exists, it is deleted and recreated for the new
  product.
- A **pushed** fulfillment order is blocked unless `force` is `true`, in
  which case it is unpushed, deleted, and recreated.
- Shipped, cancelled, and refunded orders are **hard-blocked**, as are
  line items that have already shipped or been invoiced — invoices are
  never auto-voided.
- The split-fulfillment block is scoped to the **target line item**: a
  remap is blocked only when that item itself spans multiple fulfillment
  orders, not merely because the order as a whole is split.

Pass `dry_run=true` to get the same plan as the
[preview](/api-reference/sales-orders/preview-a-sales-order-item-remap)
endpoint without mutating. When a guardrail blocks the remap at commit time
the endpoint returns `422` with a `message`.




## OpenAPI

````yaml /api-reference/build.yaml patch /sales-orders/{salesOrderId}/items/{salesOrderItemId}/remap
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:
  /sales-orders/{salesOrderId}/items/{salesOrderItemId}/remap:
    patch:
      tags:
        - Sales Orders
      summary: Remap a sales-order item
      description: >
        Remap a single posted line item to a different product and re-post the

        order's sales items. Use this to correct an incorrect product mapping on
        an

        already-posted sales order (purgatory mapping only covers pre-posting

        orders).


        The service evaluates a guardrail matrix before acting:


        - If a fulfillment order exists, it is deleted and recreated for the new
          product.
        - A **pushed** fulfillment order is blocked unless `force` is `true`, in
          which case it is unpushed, deleted, and recreated.
        - Shipped, cancelled, and refunded orders are **hard-blocked**, as are
          line items that have already shipped or been invoiced — invoices are
          never auto-voided.
        - The split-fulfillment block is scoped to the **target line item**: a
          remap is blocked only when that item itself spans multiple fulfillment
          orders, not merely because the order as a whole is split.

        Pass `dry_run=true` to get the same plan as the

        [preview](/api-reference/sales-orders/preview-a-sales-order-item-remap)

        endpoint without mutating. When a guardrail blocks the remap at commit
        time

        the endpoint returns `422` with a `message`.
      operationId: remapSalesOrderItem
      parameters:
        - in: path
          name: salesOrderId
          required: true
          schema:
            type: integer
          description: Sales order ID
        - in: path
          name: salesOrderItemId
          required: true
          schema:
            type: integer
          description: Sales order line-item ID (must belong to the sales order)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - product_id
              properties:
                product_id:
                  type: integer
                  minimum: 1
                  description: ID of the product to remap the line item to
                add_as_alternate_sku:
                  type: boolean
                  default: false
                  description: >
                    When `true`, record the line's original SKU as an alternate
                    SKU

                    on the new product so future orders auto-map to it.
                force:
                  type: boolean
                  default: false
                  description: >
                    Proceed even when the fulfillment order is pushed —
                    unpushes,

                    deletes, and recreates it. Without this, a pushed
                    fulfillment

                    order blocks the remap.
                dry_run:
                  type: boolean
                  default: false
                  description: >
                    Evaluate only and return the remap plan; mutate nothing. The

                    response is the same plan shape as the `remap-preview`
                    endpoint.
      responses:
        '200':
          description: |
            When `dry_run` is `false`, the remapped line item. When `dry_run` is
            `true`, the remap plan.
          content:
            application/json:
              schema:
                oneOf:
                  - type: object
                    title: Remapped line item
                    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
                  - type: object
                    title: Remap plan (dry run)
                    properties:
                      data:
                        type: object
                        description: >
                          Result of analysing a posted-order line-item remap.
                          Returned by the

                          `remap-preview` endpoint and by the `remap` endpoint
                          when `dry_run` is true.

                          Lets a caller decide whether to proceed before
                          mutating — whether the remap is

                          allowed, whether a `force` flag is required, and what
                          will happen to the

                          fulfillment order.
                        properties:
                          allowed:
                            type: boolean
                            description: Whether the remap can proceed as requested.
                          blocked_reason:
                            type: string
                            nullable: true
                            description: >
                              Human-readable reason the remap is blocked.
                              Populated only when `allowed`

                              is `false`. Hard blocks include invoiced, shipped,
                              split, or cancelled

                              orders.
                          requires_force:
                            type: boolean
                            description: >
                              `true` when the only thing standing in the way is
                              a pushed fulfillment

                              order and the caller did not pass `force`.
                              Re-submit with `force=true` to

                              unpush, delete, and recreate the fulfillment
                              order.
                          fulfillment_order_exists:
                            type: boolean
                            description: >-
                              Whether the sales order currently has a
                              fulfillment order.
                          fulfillment_order_id:
                            type: integer
                            nullable: true
                            description: >-
                              ID of the existing fulfillment order, when one
                              exists.
                          fo_is_pushed:
                            type: boolean
                            description: >-
                              Whether the existing fulfillment order has been
                              pushed to a source/3PL.
                          fo_action:
                            type: string
                            enum:
                              - none
                              - delete_and_recreate
                            description: >
                              What will happen to the fulfillment order on
                              commit. `none` when no

                              fulfillment order exists; `delete_and_recreate`
                              when an existing one will

                              be deleted and regenerated for the new product.
                          will_delete_fulfillment_order:
                            type: boolean
                            description: >-
                              Convenience flag — `true` when `fo_action` is
                              `delete_and_recreate`.
                          will_recreate_fulfillment_order:
                            type: boolean
                            description: >-
                              Whether a new fulfillment order will be generated
                              after the remap.
                          will_delete_invoice:
                            type: boolean
                            description: >
                              `true` when an invoice is linked to the
                              fulfillment order. This is a hard

                              block — invoices are never auto-voided, so the
                              remap is rejected.
                          old_product_id:
                            type: integer
                            description: >-
                              ID of the product the line item is currently
                              mapped to.
                          new_product_id:
                            type: integer
                            description: >-
                              ID of the product the line item will be remapped
                              to.
                          warnings:
                            type: array
                            items:
                              type: string
                            description: Non-blocking warnings about the planned remap.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '404':
          description: >-
            Sales order or line item not found, or item does not belong to the
            order
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '422':
          description: Remap blocked by a guardrail, or validation error
          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.

````