> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flowx.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Deleting files

> The Documents plugin provides functionality for deleting files.

## How files get deleted

Files in the Documents Plugin can be deleted in two ways:

> [card] Explicit deletion
>
> Using the Kafka delete action described below to manually delete a specific file by its `fileId` and `customId`.

> [card] Implicit deletion (replacement)
>
> When uploading a new file with the **same `customId` AND `documentType`** combination as an existing file, the previous file is automatically marked as deleted.

> [!NOTE]
>
> **Understanding implicit deletion**
>
> The implicit deletion behavior ensures that each `customId` + `documentType` combination points to only one active file. When you upload a new file with an existing combination:
>
> * The previous file is marked as deleted in the database
> * The previous file's download URLs stop working
> * The new file becomes the active document for that combination
>
> This is by design and useful for scenarios where you want to replace documents (e.g., updating a profile photo or replacing a draft contract). However, if you need to store multiple files of the same type, ensure each has a **unique `customId`**.

## Prerequisites

Before deleting files, ensure:

1. **Access Permissions**: Ensure that the user account used has the necessary access rights for updates or deletions.

2. **Kafka Configuration**:

* **Verify Kafka Setup**: Ensure proper configuration and accessibility of the Kafka messaging system.
* **Kafka Topics**: Understand the Kafka topics used for these operations.

3. **File IDs and Document Types**: Prepare information for updating or deleting files:

* `fileId`: ID of the file to delete.
* `customId`: Custom ID associated with the file.

> [!NOTE]
>
> In the example below, we use a `fileId` generated for a document using [**Uploading a New Document**](https://docs.flowx.ai/6.x/docs/platform-deep-dive/core-extensions/content-management/documents-plugin/uploading-a-new-document.md) scenario.
>
> ```json theme={"dark"}
> {
>   "docs": [
>     {
>       "customId": "119407",
>       "fileId": "c4e6f0b0-b70a-4141-993b-d304f38ec8e2",
>       "documentType": "BULK",
>       "documentLabel": null,
>       "minioPath": "flowx-dev-process-id-119408/119407/466_BULK.pdf",
>       "downloadPath": "internal/files/c4e6f0b0-b70a-4141-993b-d304f38ec8e2/download",
>       "noOfPages": 2,
>       "error": null
>     }
>   ],
>   "error": null
> }
> ```

## Configuring the deletion process

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/delete_file_proc.png)

To delete files, follow these steps:

1. Create a process that includes a [**Send Message Task (Kafka)**](https://docs.flowx.ai/6.x/docs/building-blocks/node/message-send-received-task-node.md) node and [**Message Event Receive (Kafka)**](https://docs.flowx.ai/6.x/docs/building-blocks/node/message-send-received-task-node.md#configuring-a-receive-message-task) node:

* Use the **Send Message Task** node to send the delete request.
* Use the **Receive Message Task** node to receive the delete reply.

2. Configure the **first node (Send Message Task)** by adding a **Kafka Send Action**.

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/delete_file_action.png)

3. Specify the [**Kafka topic**](https://docs.flowx.ai/6.x/setup-guides/documents-plugin-setup.md) for sending the delete request.

> [!TIP]
>
> To identify defined topics in your environment:
>
> * Navigate to **Platform Status > FLOWX Components > document-plugin-mngt** and click the eye icon on the right side.
> * In the details screen, expand the `KafkaTopicsHealthCheckIndicator` line and then **details → configuration → topic → file → delete**. Here will find the in and out topics for deleting files.
>
> ![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/delete_topics.png)

4. Fill in the request message body.

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/delete_request_message.png)

#### Message request example

Example of a message following the custom integration data model:

```json theme={"dark"}
{
  "customId": "119408",
  "fileId": "c4e6f0b0-b70a-4141-993b-d304f38ec8e2"
}
```

* **fileId**: The ID of the file.
* **customId**: The custom ID.

5. Configure the **second node (Receive Message Task)** by adding a data stream (**Integration Output** → **Add Stream**, **Source**: **Custom Topic**):

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/delete_stream.png)

> [!NOTE]
>
> The response will be sent to `..out` Kafka topic.

### Receiving the reply

![](https://s3.eu-west-1.amazonaws.com/docx.flowx.ai/release34/delete_response.png)

The reply body should contain the following values:

* **customId**: The unique identifier for your document (it could be for example the ID of a client)
* **fileId**: The ID of the file
* **documentType**: The document type
* **error**: Any error message in case of an error during the deleting process

#### Message response example

```json theme={"dark"}
{
  "customId": "119408",
  "fileId": "c4e6f0b0-b70a-4141-993b-d304f38ec8e2",
  "documentType": null,
  "error": null
}
```


## Related topics

- [Getting URLs](https://docs.flowx.ai/6.x/docs/platform-deep-dive/core-extensions/content-management/documents-plugin/getting-urls-to-documents.md)
- [Documents plugin setup](https://docs.flowx.ai/6.x/setup-guides/documents-plugin-setup.md)
- [Fonts](https://docs.flowx.ai/6.x/docs/flowx-designer/design-assets/font-files.md)
- [Build and change apps with the Developer Agentic Harness](https://docs.flowx.ai/6.x/ai-platform/developer-agentic-harness.md)
- [Resources](https://docs.flowx.ai/6.x/docs/projects/resources.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.