---
title: "Update ERP Sales Order"
method: PUT
path: "/erp/sales-orders/{sales_order_id}"
tags: ["erp", "Sales Orders"]
---

# Update ERP Sales Order

`PUT /erp/sales-orders/{sales_order_id}`

## Request

- Base URL: `https://production.trackstarhq.com`
- URL: `https://production.trackstarhq.com/erp/sales-orders/{sales_order_id}`
- Auth: none required

Edits header fields, edits or closes existing line items, and/or adds
new line items on an existing sales order. Get the required, optional,
and integration specific fields by calling the
[integrations](/api-reference/mgmt/integrations) endpoint.

## Path parameters

- `sales_order_id` string, required

## Headers

- `x-trackstar-api-key` string, required
- `x-trackstar-access-token` string, required
- `Idempotency-Key` string

## Request body

- union
  - object
    - `trackstar_tags` unknown[], nullable: A list of custom tags associated with the resource. A tag can be either a string or a dictionary with one key-value pair.
      - unknown
    - `reference_id` string: An external reference on the order, such as the customer's PO number. Null if the ERP has no external reference.
    - `order_date` string, date-time: The date the order was placed or booked in the ERP.
    - `expected_ship_date` string, date-time: The expected or promised ship date for the order.
    - `notes` string[]: List of free-form notes recorded on the order.
    - `line_items` ErpSalesOrderUpdateLineItemfulfil[]: List of line items on the sales order.
      - `line_item_id` string: ID of the order line being edited; omit to add a new line.
      - `item_id` string
      - `sku` string
      - `quantity` number
      - `unit_price` number
  - object
    - `trackstar_tags` unknown[], nullable: A list of custom tags associated with the resource. A tag can be either a string or a dictionary with one key-value pair.
      - unknown
    - `customer_id` string: ID of the customer in the ERP.
    - `reference_id` string: An external reference on the order, such as the customer's PO number. Null if the ERP has no external reference.
    - `order_date` string, date-time: The date the order was placed or booked in the ERP.
    - `expected_ship_date` string, date-time: The expected or promised ship date for the order.
    - `location_id` string: ID of the ERP location the order ships from, when set at the order level.
    - `ship_to_address` ErpSalesOrderUpdateShipToAddressLinnworks
      - `full_name` string
      - `company` string
      - `address1` string
      - `address2` string
      - `city` string
      - `state` string
      - `postal_code` string
      - `country` string
      - `address3` string
      - `phone_number` string
    - `bill_to_address` ErpSalesOrderUpdateBillToAddressLinnworks
      - `full_name` string
      - `company` string
      - `address1` string
      - `address2` string
      - `city` string
      - `state` string
      - `postal_code` string
      - `country` string
      - `address3` string
    - `notes` string[]: List of free-form notes recorded on the order.
    - `line_items` ErpSalesOrderUpdateLineItemlinnworks[]: List of line items on the sales order.
      - `line_item_id` string: ID of the sales order line being updated. Omit to add a new line.
      - `item_id` string
      - `sku` string
      - `quantity` number
      - `unit_price` number
      - `location_id` string
    - `custom_fields` object: Per-account custom fields defined on the sales order. Keys are the field names as defined in the ERP; each value carries the raw value, its declared type, and a human-readable label.
  - object
    - `trackstar_tags` unknown[], nullable: A list of custom tags associated with the resource. A tag can be either a string or a dictionary with one key-value pair.
      - unknown
    - `customer_id` string: ID of the customer in the ERP.
    - `reference_id` string: An external reference on the order, such as the customer's PO number. Null if the ERP has no external reference.
    - `order_number` string: The user-facing identifier of the sales order as assigned by the ERP.
    - `order_date` string, date-time: The date the order was placed or booked in the ERP.
    - `expected_ship_date` string, date-time: The expected or promised ship date for the order.
    - `location_id` string: ID of the ERP location the order ships from, when set at the order level.
    - `ship_to_address` ErpSalesOrderUpdateShipToAddressNetsuite
      - `full_name` string
      - `company` string
      - `address1` string
      - `address2` string
      - `city` string
      - `state` string
      - `postal_code` string
      - `country` string
      - `phone_number` string
    - `bill_to_address` ErpSalesOrderUpdateBillToAddressNetsuite
      - `full_name` string
      - `company` string
      - `address1` string
      - `address2` string
      - `city` string
      - `state` string
      - `postal_code` string
      - `country` string
    - `notes` string[]: List of free-form notes recorded on the order.
    - `line_items` ErpSalesOrderUpdateLineItemnetsuite[]: List of line items on the sales order.
      - `line_item_id` string: ID of the source sales-order line being updated. Required to edit or close an existing line; omit when adding a new line.
      - `close` boolean: Set to true to close this open line on the sales order. Closing transitions the order toward closed/fulfilled without requiring the line to be shipped. Requires line_item_id.
      - `item_id` string
      - `sku` string
      - `quantity` number
      - `unit_price` number
      - `location_id` string
    - `custom_fields` object: Per-account custom fields defined on the sales order. Keys are the field names as defined in the ERP; each value carries the raw value, its declared type, and a human-readable label.

## Response `200`

Successful response

- ErpUpdateSalesOrderResponse
  - `data` UpdateErpSalesOrderResponseDataSchema
    - `id` string, required: The unique ID of the sales order in the ERP.
    - `created_date` string, date-time, required: The date the sales order was created.
    - `updated_date` string, date-time, required: The date the sales order was last updated.
    - `order_number` string, required: The user-facing identifier of the sales order as assigned by the ERP.
    - `reference_id` string, nullable, required: An external reference on the order, such as the customer's PO number. Null if the ERP has no external reference.
    - `status` 'pending_approval' | 'open' | 'partially_fulfilled' | 'fulfilled' | 'on_hold' | 'closed' | 'cancelled' | 'other', required: The status of the sales order. See the [sales order information](info) for more details.
    - `raw_status` string, nullable, required: The raw status label returned directly from the ERP (e.g., 'Pending Fulfillment', 'Partially Fulfilled').
    - `order_date` string, date-time, required: The date the order was placed or booked in the ERP.
    - `expected_ship_date` string, date-time, nullable, required: The expected or promised ship date for the order.
    - `customer_id` string, nullable, required: ID of the customer in the ERP.
    - `location_id` string, nullable, required: ID of the ERP location the order ships from, when set at the order level.
    - `subtotal` number, nullable, required: Sum of item line amounts before tax, shipping, and discount, in the order currency.
    - `total_tax` number, nullable, required: Total tax charged on the order, in the order currency.
    - `total_shipping` number, nullable, required: Total shipping charged on the order, in the order currency.
    - `total_discount` number, nullable, required: Total discount applied to the order, in the order currency.
    - `total_price` number, nullable, required: Grand total the customer will be billed for the order, in the order currency.
    - `ship_to_address` ShipToAddress, required
      - `full_name` string, nullable, required
      - `company` string, nullable, required
      - `address1` string, nullable, required
      - `address2` string, nullable, required
      - `address3` string, nullable, required
      - `city` string, nullable, required
      - `state` string, nullable, required
      - `postal_code` string, nullable, required
      - `country` string, nullable, required
      - `phone_number` string, nullable, required
      - `email_address` string, nullable, required
    - `bill_to_address` BillToAddress, required
      - `full_name` string, nullable, required
      - `address1` string, nullable, required
      - `address2` string, nullable, required
      - `address3` string, nullable, required
      - `city` string, nullable, required
      - `state` string, nullable, required
      - `postal_code` string, nullable, required
      - `country` string, nullable, required
    - `shipping_method_id` string, nullable, required: ID of the shipping method on the order.
    - `shipping_method_name` string, nullable, required: Display name of the shipping method.
    - `notes` string[], required: List of free-form notes recorded on the order.
    - `line_items` ErpSalesOrderLineItem[], required: List of line items on the sales order.
      - `line_item_id` string, required: Line-unique ID within the order.
      - `item_id` string, required: ID of the item sold on this line.
      - `sku` string, required: SKU / item number of the item.
      - `quantity` number, required: Quantity ordered on this line.
      - `unit_price` number, required: Per-unit price in the order currency.
      - `is_kit` boolean, required: Whether this line is a kit. A kit ships as a unit, so its components are not listed as separate lines here; they are nested under `kit_components`.
      - `kit_components` ErpSalesOrderKitComponent[], required: The items inside this kit line, at the quantities this line ordered. Empty unless the line is a kit. Each entry has its own line_item_id, which is what you reference when supplying lot or bin information at fulfillment.
        - `line_item_id` string, required: Line-unique ID of the component within the order.
        - `item_id` string, required: ID of the component item.
        - `sku` string, required: SKU / item number of the component item.
        - `quantity` number, required: Quantity of this component ordered on this kit line.
      - `location_id` string, nullable, required: ID of the location the line ships from. Set per-line when an order splits items across multiple origins; otherwise inherits the order-level `location_id`.
    - `custom_fields` object, required: Per-account custom fields defined on the sales order. Keys are the field names as defined in the ERP; each value carries the raw value, its declared type, and a human-readable label.
    - `external_system_url` string, nullable, required: URL link to the sales order in the external system (WMS/Freight etc).
    - `trackstar_tags` unknown[], nullable, required: A list of custom tags associated with the resource. A tag can be either a string or a dictionary with one key-value pair.
      - unknown
    - `additional_fields` object, required: Integration-specific fields
    - `trackstar_created_date` string, date-time, required
    - `trackstar_updated_date` string, date-time, required
  - `id` string, required: The ID of the object that has been created or modified
  - `unused_fields` string[], required: Unused fields

## Other responses

- `404`: Not found
- `422`: Validation error

## Changes

- **2026-11-03** `f9f948f2a7b3`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/trackstarhq/apis/trackstar-api/changes/erp/sales-orders/:sales_order_id/put.md)

---

[API](https://skmtc.dev/trackstarhq/apis/trackstar-api.md) - [All operations](https://skmtc.dev/trackstarhq/apis/trackstar-api/llms.txt) - [OpenAPI document](https://skmtc.dev/trackstarhq/apis/trackstar-api/revisions/08647f790594?raw)
