Delete a package (voids its label)
AI agents: read /llms.txt; add .md to any page URL. This page as Markdown: /reference/shipment-packages/v2-shipment-package-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 package. For a Shippo label this is how you void it: YoPrint asks Shippo for a refund in the background, and a refused refund is not reported back. Shippo and the carrier decide whether you get the money back.
In a multi-parcel label, deleting the master makes the next parcel the master; deleting one parcel voids only that parcel. A shipping cost line tied to the package is not removed: when you delete a master that has other parcels, the cost line moves to the new master and keeps billing; otherwise it stays linked to the deleted package. Remove it yourself if you no longer bill it.
Business rules
- On a draft order, a package with a label can't be deleted: "Publish this order before deleting a shipment package with a shipping label."
- On a shipment linked to Shopify: 422
shopify_managed_shipment_locked("Cannot modify Shopify-managed shipment packages from API."),shopify_fulfilled_shipment_package_locked("This shipment has already been fulfilled to Shopify. Void fulfillment first to edit packages or create labels.") orshopify_broken_link_shipment_locked; and 422 "Shipment package cannot be deleted because shipment contains items fulfilled by a third-party." (error.codevalidation_error). There is no carrier check here.
Side effects
- Requests a refund from Shippo for a Shippo label, in the background.
- Open Admin Portal pages refresh, and so do Customer Portal pages the order's customer has open.
Path parameters
Your team slug, shown as Team ID next to your API key in Profile.
- Example
your-team
- Example
The package's hash id. Hash ids only: a unique key or a document number gives 404.
- Example
o6foWpSAayc79D
- Example
Request body
This operation takes no request body.
Response
200Successful response.
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
- Your role can't view the order of the package's shipment (
user_is_not_authorized). Nothing is deleted or refunded. - Fix
- Ask the team owner for permission to view this order, or to be assigned to it.
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 package isn't your team's.
- 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 draft order, or a Shopify rule (see rules).
- Fix
- Publish the order, or void the fulfillment in Shopify first.
Related
- GETList the packages of a shipment
/v2/ api/ store/ {team_slug}/ v2/ shipment/ {hash_id}/ packages - POSTBuy a shipping label (charges your Shippo account)
/v2/ api/ store/ {team_slug}/ v2/ shipment/ {hash_id}/ label/ goshippo
