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

# Cancel ERP Sales Order

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

## Request

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

Cancels an existing sales order. The exact transition is integration
specific — for NetSuite, all open lines are closed.

## Path parameters

- `sales_order_id` string, required

## Headers

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

## Response `200`

Successful response

- ErpCancelSalesOrderResponse
  - `data` CancelErpSalesOrderResponseDataSchema
    - `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/cancel/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)
