Delete a line item
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/sales-order-line-items/v2-order-item-destroy.md. Index of every page and the rules for every call: /llms.txt. Guides and concepts in one file: /llms-full.txt. OpenAPI: /openapi.json.
DELETE/
Deletes one line and recalculates the order's totals.
{order_item_unique_key} is the line's id (a hash id) from the order's line items. Its orditm_ unique key is also accepted, but no API answer shows it, so use id.
Deleting a line that is already deleted is safe: it returns 200 with the line and action_performed: "NONE" (a line an integration brought in is refused with 422 even then). Otherwise the answer is the deleted line in data.item (trashed: true) with action_performed: "DELETED".
Business rules
- Lines an integration brought in can't be deleted through the API: "Cannot delete external object from API."
- Refused while the line's job has a decoration setup that needs repair.
Side effects
- Removes the line from the order's shipments and from every invoice of the order, and cancels its stock reservations and purchase links.
- Recalculates the job's decoration pricing, the order totals and auto-managed invoices.
- On a published sales order with QuickBooks Online connected, queues the order's QuickBooks sync.
- Refreshes the order for people who have it open in the web app. No email is sent.
Path parameters
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
The line's
id(a hash id), from the order's line items. Itsorditm_…unique key is also accepted, but no API answer shows it, so useid.- Example
Owr88lhAk28aqL
- Example
Request body
This operation takes no request body.
Response
200Successful response.
Child fields (5)
object_typestring- Always
"order_item"
- Always
action_performedstringNONEwhen nothing changed.- One of:
"CREATED","UPDATED","DELETED","NONE"
- One of:
has_changesbooleanitemobjectOne line. It has the request's groups (
product,pricing,quantity,job,weight,position) as saved, with the prices YoPrint worked out, and the same values again in_meta. A few groups differ from the request: the catalog cost comes back aspricing.catalog.costwith its date as a date-time, and a linkedjobalso has itsunique_keyandscoped_id(JOB-1001). Each group's_meta.editable_fields_on_updatelists the request paths an update accepts for that group (pricing.typeis listed, but it must stay the line's own).Child fields (16)
_metaobjectThe line's own values again (
id,type,order_id,unit_price,subtotaland so on). Always an object.idstringinventory_statusstring | nullStock status of the line.
jobobjectlock_versioninteger | nullThe line's own lock version (a microsecond timestamp).
order_idstringorder_unique_keystringThe order's
unique_key. The line's ownunique_keyis not in the answer: useid.positionintegerpricingobjectpricing_rule_appliedobject | nullThe pricing rule that set the line's product price, or null when no rule did. List the line items, Get one line item and the bulk save answer with the full summary below. Other answers carry only
type, the two ids and the two totals.Child fields (12)
afterstringFull summary only: the price after the rule, as a decimal string.
after_totaldecimal pairThe product price per unit after the rule. 6 decimal places. A decimal pair: the amount is
value÷ 10^dp({ "value": 1250, "dp": 2 }is 12.50). Readdpevery time: it can differ between fields and records.- See Money and quantities.
basestringFull summary only: that starting price, as a decimal string with at least 2 decimal places.
base_typestringFull summary only: what the rule started from: the supplier price for catalog lines, the product's own price for other lines.
- One of:
"supplier_price","base_price"
- One of:
normal_pricestring | nullFull summary only: what the line would cost with no rule. For catalog lines the supplier price plus the group's catalog markup as it is now; otherwise the same as
base.original_totaldecimal pairThe product price per unit before the rule. 6 decimal places. A decimal pair: the amount is
value÷ 10^dp({ "value": 1250, "dp": 2 }is 12.50). Readdpevery time: it can differ between fields and records.- See Money and quantities.
pricing_group_idstring | nullThe pricing group whose rule applied.
pricing_group_namestring | nullFull summary only: the group's name now.
pricing_group_removedboolean | nullFull summary only: true when the group was removed since. The line keeps its price.
pricing_rule_idstring | nullThe rule that applied.
ruleobject | nullFull summary only: the rule as the group holds it now, with its current name and position (1 is the first rule checked). Null when the rule no longer exists.
typestringproducton a line.
productobjectquantityobjectThe quantity, trailing zeros dropped: 10 is
{ "value": 10, "dp": 0 }.subtotaldecimal pairunit_pricetimes the quantity. 4 decimal places: 125.00 is{ "value": 1250000, "dp": 4 }. A decimal pair: the amount isvalue÷ 10^dp({ "value": 1250, "dp": 2 }is 12.50). Readdpevery time: it can differ between fields and records.- See Money and quantities.
trashedbooleantrue when the line was deleted.
typestringThe kind of line: db_catalog, user_simple, db_variant, custom or fee.
unit_pricedecimal pairThe price of one unit: the product price plus the decoration price. 6 decimal places: 12.50 is
{ "value": 12500000, "dp": 6 }. A decimal pair: the amount isvalue÷ 10^dp({ "value": 1250, "dp": 2 }is 12.50). Readdpevery time: it can differ between fields and records.- See Money and quantities.
lock_versionobjectThe order's lock versions after this call. Each is a whole number (a microsecond timestamp) that changes on every save, or null.
Child fields (1)
Child fields (6)
invoice_lock_versioninteger | nulljob_lock_versioninteger | nullorder_item_lock_versioninteger | nullorder_lock_versioninteger | nullThe order's own
lock_version.payment_lock_versioninteger | nullshipment_lock_versioninteger | null
Errors
401The API key is missing or wrong (
unauthenticated).403You are not allowed to do this.
api_access_not_in_plan: your team's plan doesn't include API access (Pro and above, with an active subscription or trial), so every request answers this until the team upgrades. When your role lacks the permission the operation needs, the body is only{"message": "Insufficient Permission"}. Other refusals use the error envelope, withunauthorizedoruser_is_not_authorized.- When
- The API key's role can't edit this order.
- Fix
- Ask the team owner for sales order edit permission.
404Not found.
page_not_found: the team slug is unknown, you are not a member of the team, or an id in the path is not one of this team's.code: null, with a message that starts "No query results for": there is no record with that id.- When
- The line does not exist in this team.
- Fix
- Check the id.
422The request was refused and changed nothing.
validation_failedlists what to fix inerror.fields; other codes name a business rule, explained inerror.message. A few checks answer with only{"message": "..."}. An operation that calls another service (a payment provider, a carrier, an accounting app) can answerconnect_timeout("Please retry again") when that service does not answer in time: the change may or may not have happened there, so read the record back before you retry.- When
- The line came from an integration, or its job's services need repair.
- Fix
- Change it where it came from, or repair the job in the web app.
Related
- POSTAdd, change and delete line items in one save
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {order_unique_key}/ order_item/ bulk - GETList the line items of a sales order or quote
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {order_unique_key}/ order_item
