> For the complete documentation index, see [llms.txt](https://api-portal.novapost.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api-portal.novapost.com/changelog-1/documentation/returning-doc-was-deleted-response-for-repeated-deletion-of-a-shipment.md).

# Returning doc was deleted response for repeated deletion of a shipment

### General Information

| **Method Name**   | Delete document                                                                                                                                                                                          |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **HTTP Method**   | DELETE                                                                                                                                                                                                   |
| **Route**         | <p>DELETE /ui/v.1.0/shipments/{id}</p><p>DELETE /v.1.0/shipments/{id}</p><p>DELETE /mobileapp/v.1.1/shipments/{id}</p><p>DELETE /cbc/v.1.0/shipments/{id}</p><p>DELETE /internal/awis/shipments/{id}</p> |
| **Change Type**   | existing endpoint update                                                                                                                                                                                 |
| **Authorization** | Authorization: Bearer jwt-token…                                                                                                                                                                         |
| **Related Task**  | <https://novaposhta.atlassian.net/browse/APIGW-149>                                                                                                                                                      |
| **Product**       | API Gateway                                                                                                                                                                                              |

### Description

To correctly handle repeated shipment deletion requests, an additional shipment status check is performed through Tracking Service.\
The purpose is to return a unified response shipment\_was\_deleted if the shipment has already been deleted.

### Processing logic

When executing a **Delete Shipment** request, API additionally sends a GET request to Tracking Service using the following parameter:

```
withDeleted=1
```

This parameter allows retrieving data for previously deleted shipments.

The response is then analyzed based on the field:

```
deleted_at
```

* if deleted\_at ≠ null → the shipment was previously deleted;\
  API returns:

```
{
  "errors": {
    "errorMessage": "shipment_was_deleted"
  }
}
```

**HTTP status:** 422 Unprocessable Entity

* if deleted\_at = null or the field is missing → shipment is not found;\
  current behavior remains unchanged and API returns:

```
{
  "errors": {
    "errorMessage": "shipment_not_found"
  }
}
```

**HTTP status:** 404 Not Found

### Request example

```
DELETE /shipments/{id}
```

### Successful response

```
{
  "success": true
}
```

**HTTP status:** 200 OK


---

# 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:

```
GET https://api-portal.novapost.com/changelog-1/documentation/returning-doc-was-deleted-response-for-repeated-deletion-of-a-shipment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
