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

# Set or clear a purchase-order line's lot

> Assign a lot to a single purchase-order line item, or clear the one it already has, **ahead of
receiving**. The change is lot-only and stock-neutral — nothing is received, allocated, or costed
— so an automated process can annotate the lots on an active purchase order without going through
the replace-all `PUT /purchase-orders/{id}`.

Provide exactly one intent:

- **Assign** — supply a lot identifier (`lot_id`, or `lot_number` / `lot_name`). By default the
  lot must already exist for the line's product; pass `create_lot: true` to create it from
  `lot_number` on the fly (optionally seeding `production_date`, `expiry_date` and
  `manufacturer_code`).
- **Clear** — send `clear_lot: true` to unassign the line's current lot.

Unassigning is **explicit**: an absent, empty, or `null` lot value is never read as a request to
clear — you must send `clear_lot: true`. This protects unattended callers, where an unset template
variable (`"lot_id": ""`) would otherwise silently wipe a lot the office had already set. Send a
lot identifier **or** `clear_lot`, never both.

The lot is resolved against the line's own product; a lot belonging to a different product, an
unknown `lot_number` without `create_lot`, or a non-lot-tracked product all return `422`.




## OpenAPI

````yaml /api-reference/build.yaml patch /purchase-orders/{purchaseOrderId}/items/{lineItemId}/lot
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:
  /purchase-orders/{purchaseOrderId}/items/{lineItemId}/lot:
    patch:
      tags:
        - Purchase Orders
      summary: Set or clear a purchase-order line's lot
      description: >
        Assign a lot to a single purchase-order line item, or clear the one it
        already has, **ahead of

        receiving**. The change is lot-only and stock-neutral — nothing is
        received, allocated, or costed

        — so an automated process can annotate the lots on an active purchase
        order without going through

        the replace-all `PUT /purchase-orders/{id}`.


        Provide exactly one intent:


        - **Assign** — supply a lot identifier (`lot_id`, or `lot_number` /
        `lot_name`). By default the
          lot must already exist for the line's product; pass `create_lot: true` to create it from
          `lot_number` on the fly (optionally seeding `production_date`, `expiry_date` and
          `manufacturer_code`).
        - **Clear** — send `clear_lot: true` to unassign the line's current lot.


        Unassigning is **explicit**: an absent, empty, or `null` lot value is
        never read as a request to

        clear — you must send `clear_lot: true`. This protects unattended
        callers, where an unset template

        variable (`"lot_id": ""`) would otherwise silently wipe a lot the office
        had already set. Send a

        lot identifier **or** `clear_lot`, never both.


        The lot is resolved against the line's own product; a lot belonging to a
        different product, an

        unknown `lot_number` without `create_lot`, or a non-lot-tracked product
        all return `422`.
      operationId: updatePurchaseOrderItemLot
      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 set the lot on
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: >
                Supply a lot identifier to assign, or `clear_lot: true` to
                unassign. Exactly one of the

                two intents is required.
              properties:
                lot_id:
                  type: integer
                  nullable: true
                  minimum: 1
                  description: >
                    ID of an existing lot on the line's product. Mutually
                    exclusive with `lot_number` /

                    `lot_name`. A `null` or empty value is **not** treated as a
                    clear — use `clear_lot`.
                  example: 3312
                lot_number:
                  type: string
                  maxLength: 255
                  nullable: true
                  description: >
                    Lot number to resolve on the line's product. With
                    `create_lot: true` a matching lot

                    is created if none exists. Mutually exclusive with `lot_id`.
                  example: LOT-2026-0042
                lot_name:
                  type: string
                  maxLength: 255
                  nullable: true
                  description: Human-readable lot name, used when resolving by number.
                  example: Batch 42
                create_lot:
                  type: boolean
                  description: >
                    When `true`, create the lot from `lot_number` if it does not
                    already exist on the

                    product. When omitted or `false`, an unknown `lot_number`
                    returns `422`.
                  example: true
                production_date:
                  type: string
                  format: date
                  nullable: true
                  description: Production date to seed on a newly created lot.
                  example: '2026-08-01'
                expiry_date:
                  type: string
                  format: date
                  nullable: true
                  description: Expiry date to seed on a newly created lot.
                  example: '2027-08-01'
                manufacturer_code:
                  type: string
                  maxLength: 255
                  nullable: true
                  description: Manufacturer code to seed on a newly created lot.
                  example: MFR-77
                clear_lot:
                  type: boolean
                  description: >
                    Send `true` to unassign the line's current lot. Cannot be
                    combined with a lot

                    identifier.
                  example: false
            examples:
              assign_existing_lot:
                summary: Assign an existing lot by id
                value:
                  lot_id: 3312
              assign_by_number_creating:
                summary: Assign by lot number, creating it if needed
                value:
                  lot_number: LOT-2026-0042
                  create_lot: true
                  production_date: '2026-08-01'
                  expiry_date: '2027-08-01'
              clear_lot:
                summary: Clear the line's lot
                value:
                  clear_lot: true
      responses:
        '200':
          description: Lot set or cleared on the line item
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: integer
                        description: ID of the purchase-order line item
                        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 line's product
                        example: 4501
                      lot_id:
                        type: integer
                        nullable: true
                        description: >-
                          ID of the assigned lot, or `null` if the lot was
                          cleared
                        example: 3312
                      lot_number:
                        type: string
                        nullable: true
                        description: Lot number of the assigned lot, or `null` if cleared
                        example: LOT-2026-0042
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '404':
          description: >-
            Purchase order line item not found on this purchase order, or it has
            no product
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '422':
          description: >
            Unprocessable entity — no lot identifier and no `clear_lot`, both
            supplied at once, a lot

            belonging to a different product, an unknown `lot_number` without
            `create_lot`, or a

            non-lot-tracked product.
          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.

````