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

# Export sales orders (incremental)

> Incrementally export active sales orders updated within a given time window, with cursor-based
pagination. Designed for real-time syncing and data pipelines.

## How it works

Each export run is anchored to a **fixed cutoff time** (set at the start of the first request),
so pages are stable even if records are updated mid-export.

**Starting a run** — provide `since` with a UTC datetime. The endpoint returns up to `limit`
orders updated on or after that time, up to the cutoff.

**Continuing a run** — use the `next_cursor` value from the previous response. The cursor
encodes the run's position and is cryptographically signed; do not modify it.

**Run complete** — when `has_more` is `false`, you have received all orders in the window.
Store the cutoff time (available in the first response's `meta.cutoff`) as your next `since`
value to pick up changes on the following sync.

## Pagination parameters

| Parameter | Description |
|-----------|-------------|
| `since`   | Start of the time window (UTC). Required when starting a new run. Cannot be combined with `cursor`. |
| `cursor`  | Continuation token from a previous response. Required when continuing a run. Cannot be combined with `since`. |
| `limit`   | Max records per page. Default and maximum: 1000. |

## Example flow

```
# 1. Start a run from a known point in time
GET /sales-orders/export?since=2024-01-01T00:00:00Z&limit=1000

# 2. If has_more is true, continue with the cursor
GET /sales-orders/export?cursor=<next_cursor from previous response>

# 3. Repeat until has_more is false
# 4. Save meta.cutoff as your next since value
```

## Notes

- Only active sales orders are returned.
- Results are ordered by `updated_at` ascending, then by `id` ascending, ensuring a
  stable and consistent traversal order.
- `since` accepts any parseable UTC datetime string (e.g. `2024-01-01`, `2024-01-01T00:00:00Z`,
  `2024-01-01 00:00:00`).




## OpenAPI

````yaml /api-reference/build.yaml get /sales-orders/export
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/export:
    get:
      tags:
        - Sales Orders
      summary: Export sales orders (incremental)
      description: >
        Incrementally export active sales orders updated within a given time
        window, with cursor-based

        pagination. Designed for real-time syncing and data pipelines.


        ## How it works


        Each export run is anchored to a **fixed cutoff time** (set at the start
        of the first request),

        so pages are stable even if records are updated mid-export.


        **Starting a run** — provide `since` with a UTC datetime. The endpoint
        returns up to `limit`

        orders updated on or after that time, up to the cutoff.


        **Continuing a run** — use the `next_cursor` value from the previous
        response. The cursor

        encodes the run's position and is cryptographically signed; do not
        modify it.


        **Run complete** — when `has_more` is `false`, you have received all
        orders in the window.

        Store the cutoff time (available in the first response's `meta.cutoff`)
        as your next `since`

        value to pick up changes on the following sync.


        ## Pagination parameters


        | Parameter | Description |

        |-----------|-------------|

        | `since`   | Start of the time window (UTC). Required when starting a
        new run. Cannot be combined with `cursor`. |

        | `cursor`  | Continuation token from a previous response. Required when
        continuing a run. Cannot be combined with `since`. |

        | `limit`   | Max records per page. Default and maximum: 1000. |


        ## Example flow


        ```

        # 1. Start a run from a known point in time

        GET /sales-orders/export?since=2024-01-01T00:00:00Z&limit=1000


        # 2. If has_more is true, continue with the cursor

        GET /sales-orders/export?cursor=<next_cursor from previous response>


        # 3. Repeat until has_more is false

        # 4. Save meta.cutoff as your next since value

        ```


        ## Notes


        - Only active sales orders are returned.

        - Results are ordered by `updated_at` ascending, then by `id` ascending,
        ensuring a
          stable and consistent traversal order.
        - `since` accepts any parseable UTC datetime string (e.g. `2024-01-01`,
        `2024-01-01T00:00:00Z`,
          `2024-01-01 00:00:00`).
      operationId: exportSalesOrders
      parameters:
        - in: query
          name: since
          schema:
            type: string
            format: date-time
            example: '2024-01-01T00:00:00Z'
          description: >
            UTC datetime marking the start of the export window. Required when
            starting a new run.

            Cannot be combined with `cursor`.
        - in: query
          name: cursor
          schema:
            type: string
            example: eyJ2IjoxLCJtb2RlIjoiZXhwb3J0In0.abc123
          description: >
            Signed continuation token from a previous export response. Required
            when continuing a run.

            Cannot be combined with `since`.
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 1000
          description: Maximum number of orders to return per page.
      responses:
        '200':
          description: Successful export page
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        order_id:
                          type: integer
                          description: Internal Luminous order ID
                        order_number:
                          type: string
                          description: Order reference number
                        status:
                          type: string
                          description: Luminous internal status label (e.g. Active)
                        order_status:
                          type: string
                          description: ShipStation order status (e.g. awaiting_shipment)
                        total_amount:
                          type: number
                          format: float
                          description: Order total
                        total_tax:
                          type: number
                          format: float
                        total_shipping:
                          type: number
                          format: float
                        total_paid:
                          type: number
                          format: float
                        customer_id:
                          type: integer
                          nullable: true
                        customer_username:
                          type: string
                          nullable: true
                        customer_email:
                          type: string
                          nullable: true
                        order_date:
                          type: string
                          format: date
                        created_at:
                          type: string
                          format: date-time
                        updated_at:
                          type: string
                          format: date-time
                        items:
                          type: array
                          items:
                            type: object
                            properties:
                              order_item_id:
                                type: integer
                              sku:
                                type: string
                                nullable: true
                              name:
                                type: string
                                nullable: true
                              quantity:
                                type: number
                                format: float
                              price:
                                type: number
                                format: float
                              tax:
                                type: number
                                format: float
                              quantity_ordered:
                                type: number
                                format: float
                              quantity_shipped:
                                type: number
                                format: float
                              quantity_cancelled:
                                type: number
                                format: float
                              created_at:
                                type: string
                                format: date-time
                              updated_at:
                                type: string
                                format: date-time
                        shipments:
                          type: array
                          items:
                            type: object
                            properties:
                              shipment_id:
                                type: integer
                              tracking_number:
                                type: string
                                nullable: true
                              tracking_url:
                                type: string
                                nullable: true
                              carrier_code:
                                type: string
                                nullable: true
                              service_code:
                                type: string
                                nullable: true
                              ship_date:
                                type: string
                                format: date
                                nullable: true
                              shipment_cost:
                                type: number
                                format: float
                              status:
                                type: string
                                nullable: true
                              created_at:
                                type: string
                                format: date-time
                              updated_at:
                                type: string
                                format: date-time
                        fulfillment_orders:
                          type: array
                          items:
                            type: object
                            properties:
                              fulfillment_order_id:
                                type: integer
                              order_number:
                                type: string
                                nullable: true
                              status:
                                type: string
                                nullable: true
                              warehouse_group_id:
                                type: integer
                                nullable: true
                              created_at:
                                type: string
                                format: date-time
                              updated_at:
                                type: string
                                format: date-time
                  next_cursor:
                    type: string
                    nullable: true
                    description: >-
                      Signed cursor token to fetch the next page. Null when the
                      export is complete.
                    example: eyJ2IjoxLCJtb2RlIjoiZXhwb3J0In0.abc123
                  has_more:
                    type: boolean
                    description: Whether more pages exist in this export run.
                  meta:
                    type: object
                    properties:
                      rows:
                        type: integer
                        description: Number of orders returned in this page.
                      cutoff:
                        type: string
                        format: date-time
                        description: >
                          The fixed upper bound of this export run. Save this as
                          your next `since`

                          value after the run completes.
              examples:
                first_page:
                  summary: First page with more results
                  value:
                    data:
                      - order_id: 1001
                        order_number: ORD-2024-001
                        status: Active
                        order_status: awaiting_shipment
                        total_amount: 128.23
                        total_tax: 15.75
                        total_shipping: 12.5
                        total_paid: 128.23
                        customer_id: 42
                        customer_username: johndoe
                        customer_email: john@example.com
                        order_date: '2024-01-15'
                        created_at: '2024-01-15T10:30:00Z'
                        updated_at: '2024-01-15T10:30:00Z'
                        items:
                          - order_item_id: 5001
                            sku: WIDGET-001
                            name: Premium Widget
                            quantity: 2
                            price: 49.99
                            tax: 7.5
                            quantity_ordered: 2
                            quantity_shipped: 0
                            quantity_cancelled: 0
                            created_at: '2024-01-15T10:30:00Z'
                            updated_at: '2024-01-15T10:30:00Z'
                        shipments: []
                        fulfillment_orders:
                          - fulfillment_order_id: 9001
                            order_number: ORD-2024-001-A
                            status: pending
                            warehouse_group_id: 3
                            created_at: '2024-01-15T10:31:00Z'
                            updated_at: '2024-01-15T10:31:00Z'
                    next_cursor: eyJ2IjoxLCJtb2RlIjoiZXhwb3J0In0.abc123
                    has_more: true
                    meta:
                      rows: 1000
                      cutoff: '2024-01-16T00:00:00Z'
                last_page:
                  summary: Final page — export complete
                  value:
                    data:
                      - order_id: 1999
                        order_number: ORD-2024-999
                        status: Active
                        order_status: shipped
                        total_amount: 55
                        total_tax: 5
                        total_shipping: 0
                        total_paid: 55
                        customer_id: null
                        customer_username: null
                        customer_email: jane@example.com
                        order_date: '2024-01-15'
                        created_at: '2024-01-15T23:50:00Z'
                        updated_at: '2024-01-15T23:55:00Z'
                        items:
                          - order_item_id: 5999
                            sku: GADGET-ABC
                            name: Gadget
                            quantity: 1
                            price: 50
                            tax: 5
                            quantity_ordered: 1
                            quantity_shipped: 1
                            quantity_cancelled: 0
                            created_at: '2024-01-15T23:50:00Z'
                            updated_at: '2024-01-15T23:55:00Z'
                        shipments:
                          - shipment_id: 8001
                            tracking_number: 1Z999AA10123456784
                            tracking_url: >-
                              https://www.ups.com/track?tracknum=1Z999AA10123456784
                            carrier_code: ups
                            service_code: ups_ground
                            ship_date: '2024-01-16'
                            shipment_cost: 8.5
                            status: shipped
                            created_at: '2024-01-16T09:00:00Z'
                            updated_at: '2024-01-16T09:00:00Z'
                        fulfillment_orders: []
                    next_cursor: null
                    has_more: false
                    meta:
                      rows: 1
                      cutoff: '2024-01-16T00:00:00Z'
        '400':
          description: Invalid cursor
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  error:
                    type: string
              examples:
                invalid_cursor:
                  summary: Tampered or malformed cursor
                  value:
                    message: Invalid cursor signature.
                    error: invalid_cursor
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '422':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              examples:
                missing_params:
                  summary: Neither since nor cursor provided
                  value:
                    message: The given data was invalid.
                    errors:
                      since:
                        - >-
                          The since field is required when cursor is not
                          present.
                both_params:
                  summary: Both since and cursor provided
                  value:
                    message: The given data was invalid.
                    errors:
                      cursor:
                        - Cannot specify both since and cursor.
                invalid_since:
                  summary: Invalid since date
                  value:
                    message: The given data was invalid.
                    errors:
                      since:
                        - The since does not match the format Y-m-d H:i:s.
      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.

````