> For the complete documentation index, see [llms.txt](https://developer.esw.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.esw.com/package-management/package-management-api/api-methods/delete-a-package.md).

# Delete a Package

Delete or cancel an existing package. You can delete packages as long as they are not canceled in the system. Once a package is deleted, the label is also cancelled and no further changes can be made.&#x20;

{% hint style="danger" %}
You cannot retrieve deleted packages using the `GET` method. If you want to reinstate a deleted package, you must create a new package with the same details. You can do so by sending a  **Create Package** request. Refer to  [create a new package](/package-management/package-management-api/api-methods/create-a-new-package.md) for more.
{% endhint %}

## DELETE /packagemanagement/v1/{tenantCode}/orders/{orderReference}/packages/{packageReference}

> Deletes a package for a specified tenant code, order reference and package reference.

```json
{"openapi":"3.1.1","info":{"title":"Package Management API","version":"1"},"servers":[{"url":"https://api.sandbox.esw.com"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"apiKey","name":"Authorization","in":"header","description":"Please insert JWT with Bearer into field"}},"schemas":{"Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse":{"description":"Represents an error response containing detailed information about validation or server errors.","type":"object","properties":{"errors":{"description":"A collection of errors where the key is the field name and the value is a list of error messages.","type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}},"type":{"description":"The type of error encountered.","type":"string"},"title":{"description":"A brief title or summary of the error.","type":"string"},"status":{"format":"int32","description":"The HTTP status code associated with the error.","type":"integer"},"detail":{"description":"Detailed information about the error.","type":"string"},"instance":{"description":"An instance identifier for tracing the error.","type":"string"},"additionalProp1":{"description":"Additional property 1, used for custom data.","type":"string"},"additionalProp2":{"description":"Additional property 2, used for custom data.","type":"string"},"additionalProp3":{"description":"Additional property 3, used for custom data.","type":"string"},"traceId":{"description":"A trace identifier for debugging or logging purposes.","type":"string"}},"additionalProperties":false}}},"paths":{"/packagemanagement/v1/{tenantCode}/orders/{orderReference}/packages/{packageReference}":{"delete":{"tags":["Package"],"summary":"Deletes a package for a specified tenant code, order reference and package reference.","parameters":[{"schema":{"type":"string"},"in":"path","name":"tenantCode","required":true},{"schema":{"type":"string"},"in":"path","name":"orderReference","required":true},{"schema":{"type":"string"},"in":"path","name":"packageReference","required":true}],"responses":{"204":{"description":"Package has been successfully marked as cancelled (deleted) or it's status is already 'Cancelled'."},"400":{"description":"Invalid request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"401":{"description":"Unauthenticated client.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"403":{"description":"Client does not have access rights to the resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"404":{"description":"Requested resource does not exist (tenantCode, orderReference, or packageReference).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}},"500":{"description":"An unexpected error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Logistics.PackageManagement.WebApiService.Models.Responses.ErrorResponse"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.esw.com/package-management/package-management-api/api-methods/delete-a-package.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
