Create Sales Order Line

Beta
POST/v1/sales/sales-orders/{id}/lines

Idempotent with Idempotency-Key header. Learn more

Adds a line item to a sales order.

The new line is appended below the existing product lines, keeping the order's freight and discount lines at the bottom. When the order has already been issued, the line is added to its pick as outstanding work and the pick is reopened if it had been finished.

Permissions requiredValues:customers:updatesuppliers:updatesales_orders:update
The role behind your API key or agent must grant every one of these permissions.
idstring

Sales order ID.

include[]optional arrayenumValues:productquantity_orderedunit_price

Sub-objects to expand in the response. When omitted, sub-objects are returned as null.

product_idstring

ID of the product being ordered.

product_skustring

The product SKU recorded on the line.

product_descriptionoptional string

The product description recorded on the line.

quantityobject

Quantity ordered.

The unit must belong to the product's unit group.

valuestring (decimal)

Decimal value, as a string to preserve precision.

unit_idstring

ID of the unit of measure for the value.

unit_priceoptional object

Unit price override.

When omitted, the line is priced server-side from the product's pricing rules (customer price, unit-conversion and volume discounts, account-price overrides) — the same pricing applied when the order is created. An explicit value is honored only for internal users. The unit cost is always resolved from the product and never taken from the request.

valuestring (decimal)

Decimal value of the rate, expressed as the amount of the numerator unit per one denominator unit.

numerator_unit_idstring

ID of the unit for the rate's numerator (e.g. the currency of a price).

denominator_unit_idstring

ID of the unit for the rate's denominator (the per-unit basis).

idstring

Sales order line ID.

objectstringenumValues:sales_order_line

Resource type identifier.

line_item_numberinteger

Position of the line on the order.

Assigned automatically in sequence, starting at 1. Product lines are numbered first and the automatically generated freight and discount lines always sit at the bottom; removing a line renumbers the rest so the sequence stays contiguous.

product_skustring

SKU recorded on this line.

Taken from the product unless the line supplies its own, and editable afterwards, so it preserves what was sold even if the product's SKU later changes.

product_descriptionstringnullable

Description recorded on this line, taken from the product unless the line supplies its own.

itemitemnullable

The item this line sells, identified by the SKU recorded when the line was created.

productproductExpandablenullable

The product being sold on this line.

The product's type tells you what kind of line this is: the freight and discount lines an order generates for itself reference the account's built-in shipping and credit products, so their type is shipping or credit rather than sale.

idstring

Product ID.

objectstringenumValues:product

Resource type identifier.

typestringenumValues:saleserviceshipping

Product type code, which determines how the product behaves on orders and invoices.

  • sale: a standard sellable product.
  • service: a non-physical service line, such as labor or installation.
  • shipping: a shipping charge applied to an order.
  • credit: a credit applied against an order or invoice.
  • return: a returned product (RMA).
  • tax: a tax line.
portal_visibilitystringenumValues:visiblehidden

Whether the product is shown to buyers in the customer portal.

  • visible: buyers can see and order the product in the portal.
  • hidden: the product is concealed from the portal but remains usable internally.

Visibility alone is not enough to expose a product: a buyer only sees it if their account has also been granted access to the product's product line.

product_lineproduct_linenullable

The product line this product is assigned to, if any.

Customer accounts are granted access to whole product lines, so this assignment is what decides which buyers can see and order the product. A product with no product line is never visible in the customer portal. The line also supplies the default commission and freight policies for the product.

Always returned as null in this endpoint.
itemitemnullable

The inventory item backing this product, which holds its SKU, description, pricing, and attributes.

Always returned as null in this endpoint.
created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

quantity_orderedquantityExpandablenullable

Quantity ordered.

idstring

Quantity ID.

objectstringenumValues:quantity

Resource type identifier.

valuestring (decimal)

Raw decimal value of the quantity, as a string to preserve precision.

This is the unformatted machine value; see display_value for the human-readable rendering with unit and thousands separators.

display_valuestring

Formatted value with unit abbreviation (e.g. "$1,234.56" or "100 kg").

unitunitnullable

Unit of measure for this value (e.g. a currency, mass, or count unit).

Always returned as null in this endpoint.
unit_pricerateExpandablenullable

Price charged per unit.

idstring

Rate ID.

objectstringenumValues:rate

Resource type identifier.

valuestring (decimal)

Decimal value of the rate, as a string to preserve precision.

Expressed as the amount of the numerator unit per one denominator unit.

numerator_unitunitnullable

Unit of the rate's numerator (e.g. the currency of a price).

Always returned as null in this endpoint.
denominator_unitunitnullable

Unit of the rate's denominator (the per-unit basis, e.g. kilograms for a price per kilogram).

Always returned as null in this endpoint.
display_valuestring

Human-readable formatted value (e.g. "$25.50 / kg" or "100 kg / hr").

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

unit_costrateExpandablenullable

Internal cost per unit.

Reflects what the business pays for the item, not what the customer is charged, and is used to derive line profitability.

idstring

Rate ID.

objectstringenumValues:rate

Resource type identifier.

valuestring (decimal)

Decimal value of the rate, as a string to preserve precision.

Expressed as the amount of the numerator unit per one denominator unit.

numerator_unitunitnullable

Unit of the rate's numerator (e.g. the currency of a price).

Always returned as null in this endpoint.
denominator_unitunitnullable

Unit of the rate's denominator (the per-unit basis, e.g. kilograms for a price per kilogram).

Always returned as null in this endpoint.
display_valuestring

Human-readable formatted value (e.g. "$25.50 / kg" or "100 kg / hr").

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

totalssales_order_totalsExpandablenullable

Derived monetary totals for this line.

objectstringenumValues:sales_order_totals

Resource type identifier.

orderedstring (decimal)

Total ordered amount as a decimal string (unit price x quantity ordered).

This is the baseline the stage completions are measured against.

pickedsales_order_stage_total

Picked amount and completion.

Always returned as null in this endpoint.
packedsales_order_stage_total

Packed amount and completion.

Always returned as null in this endpoint.
invoicedsales_order_stage_total

Invoiced amount and completion.

Always returned as null in this endpoint.
created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

Responses

201

Successful response for Create Sales Order Line