> For the complete documentation index, see [llms.txt](https://shiply-integration-apis.gitbook.io/shiply-integration-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shiply-integration-apis.gitbook.io/shiply-integration-documentation/integration-apis/companion-parcels/delete-companion-parcel.md).

# Delete Companion Parcel

```php
DELETE /parcels/companion/{id}
```

This API is used to delete a companion parcel.

{% hint style="info" %}
**Note:** Replace <mark style="color:blue;">{id}</mark> with the id of the companion parcel you want to delete.
{% endhint %}

#### Headers

<table><thead><tr><th width="374">Key</th><th>Value</th></tr></thead><tbody><tr><td>Accept</td><td>application/json</td></tr></tbody></table>

#### Request body

{% code lineNumbers="true" %}

```json
{
    "Shiply_API_KEY": "your_api_key"
}
```

{% endcode %}

#### Response body

{% tabs %}
{% tab title="Success" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

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

{% endcode %}

The response includes a <mark style="color:blue;">success</mark> field, indicating that the companion parcel has been successfully deleted.
{% endtab %}

{% tab title="Parcel not found" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "errors": [
        "parcel not found"
    ]
}
```

{% endcode %}

This response is returned when:

* The <mark style="color:blue;">{id}</mark> provided in the route does not correspond to an existing companion parcel.
* The user cannot access the parent parcel.
  {% endtab %}

{% tab title="Cannot delete companion parcel" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "cant delete companion parcel for closed invoice"
}
```

{% endcode %}

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "cant delete companion parcel for finished parcel"
}
```

{% endcode %}

This response is returned when:

* The <mark style="color:blue;">{id}</mark> provided in the route corresponds to a companion parcel whose parent parcel can no longer be edited (closed invoice or finished parcel).
  {% endtab %}

{% tab title="Fail" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "error": "error while deleting companion parcel"
}
```

{% endcode %}

This response is returned when a database error occurs while attempting to delete a companion parcel.
{% endtab %}

{% tab title="Unauthorized" %}
Status code: <mark style="color:green;">200 OK</mark>

{% code lineNumbers="true" %}

```json
{
    "success": false,
    "errors": [
        "unauthorized"
    ]
}
```

{% endcode %}

This response is returned when the <mark style="color:blue;">Shiply\_API\_KEY</mark> is not included in the request body.
{% endtab %}
{% endtabs %}
