> For the complete documentation index, see [llms.txt](https://api.pdf.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.pdf.ai/v1/delete-pdf.md).

# Delete PDF

You can delete your PDF and your chats using `docId`. To get `docId` [<mark style="color:blue;">upload</mark>](/v1/upload-pdf.md) the PDF first.

{% hint style="danger" %}
When you delete the PDF, you also delete the chat history of it
{% endhint %}

## Delete PDF

## Delete a PDF

<mark style="color:green;">`POST`</mark> `https://pdf.ai/api/v1/delete`

Delete uploaded PDF with chats using `docId`

#### Headers

| Name                                        | Type   | Description |
| ------------------------------------------- | ------ | ----------- |
| X-API-Key<mark style="color:red;">\*</mark> | string | \<API-key>  |

#### Request Body

| Name                                    | Type   | Description                              |
| --------------------------------------- | ------ | ---------------------------------------- |
| docId<mark style="color:red;">\*</mark> | string | Document ID obtained after uploading PDF |

{% tabs %}
{% tab title="200 Success message if PDF is deleted successfully" %}

```json
{
    "message": "Successfully deleted!"
}
```

{% endtab %}

{% tab title="401 Invalid API key" %}

```json
{
    "error": "Invalid API key"
}
```

{% endtab %}

{% tab title="400: Bad Request No API key or docId is present" %}

```json
{
    "error": "No API key present"
}
```

{% endtab %}

{% tab title="404: Not Found Give docId PDF is not present" %}

```json
{
    "error": "Document with given docId not found!"
}
```

{% endtab %}
{% endtabs %}
