Delete a sales order or quote
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/sales-orders/v2-order-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 a sales order or quote. You can bring it back with Restore.
Deleting a published sales order also undoes its money and stock: payments on it are moved to the customer's credit (not on Shopify orders), its stock workflows are cancelled and its stock reservations released. Its invoices, jobs, shipments and messages are deleted with it, and its Shippo labels are voided.
Deleting an order that is already deleted succeeds and changes nothing. The answer has no data.
{order_unique_key} is the sales order or quote id (for example V4keXwwxMQyXw7) or its unique_key (it starts with ord_). The order number people see, such as SO1001, is not accepted here.
Business rules
- A Shopify-linked draft can't be deleted until it is published: "Publish this order before deleting a Shopify-linked order."
- A draft with a shipping label bought through YoPrint can't be deleted: "Publish this order before deleting an order with a shipping label."
- An order (other than a Shopify order) can't be deleted while a payment holding money on it is frozen by an open dispute or review: 422
customer_payment_disputed_funds_unavailable("This order can't be deleted while a payment on it is under dispute. You can delete it once <provider> decides.") orinvoice_payment_funding_withheld("This order can't be deleted while a payment on it is under review. You can delete it once the review is finished."), witherror.reason,error.provideranderror.provider_label. Nothing changes.
Side effects
- Moves every payment on a published order to the customer's credit (money from a Customer Portal payment goes back to that payment's credit). Shopify orders keep their payments.
- Cancels stock workflows and releases stock reservations.
- Deletes the order's invoices, jobs, shipments, packages and messages.
- Voids Shippo labels bought for the order and asks Shippo for their refund (a provider call).
- On a Shopify order, cancels the fulfillments YoPrint created in Shopify.
- Sends the
order.deletedwebhook (quote.deletedfor a quote), drafts included, and on a published order updates the customer's totals. - When the team syncs to QuickBooks Online automatically, queues a sync that removes the order's payments and invoices from QuickBooks.
Path parameters
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
The sales order's or quote's
id(a hash id), or itsunique_key(ord_…). The order number (scoped_id) does not work.- Example
V4keXwwxMQyXw7
- Example
Request body
This operation takes no request body.
Response
200Successful response.
No data.
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
- No such order 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
- A Shopify-linked draft, or a draft with a bought shipping label.
- Fix
- Publish it first, then delete.
- When
- A payment on the order is frozen by an open dispute or review (
customer_payment_disputed_funds_unavailableorinvoice_payment_funding_withheld). - Fix
- Wait for the provider's decision, then delete.
Related
- PATCHRestore a deleted sales order or quote
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {order_unique_key}/ restore - PATCHMove all of an order's payments to customer credit
/v2/ api/ store/ {team_slug}/ v2/ sales_order/ {hash_id}/ credit/ refund_all_to_customer_credit
