---
title: Deleting messages and attachments | API Docs
description: Remove a message's content, a received attachment, an upload, or a chat's history up to a cutoff, what each delete reaches, what it keeps, and how long it takes.
---

You can delete content from what Linq stores at four levels: one message, one received attachment, one uploaded file, or every message in a chat up to a cutoff. A delete removes **Linq’s copies** of the content and, within limits, the copies of media files held by the provider that carries WhatsApp messages. It doesn’t unsend anything.

A delete doesn't unsend

The customer still has the message on their phone. The provider also keeps its own copy of the message text for up to 30 days, and no API can delete it or recall a sent message. Deleting through this API changes neither.

## The routes

| Route                                                                                                                                              | Deletes                                                | Answers                       |
| -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ----------------------------- |
| [`DELETE /v1/messages/{message}`](/channel/whatsapp/api/resources/destination_messages/methods/delete/index.md)                                    | One message’s content, sent or received                | `204`                         |
| [`DELETE /v1/attachments/{attachment}`](/channel/whatsapp/api/resources/attachments/methods/delete/index.md)                                       | One received attachment’s file                         | `204`                         |
| [`DELETE /v1/media/{upload_ref}`](/channel/whatsapp/api/resources/media/methods/delete/index.md)                                                   | One file you uploaded                                  | `204`                         |
| [`DELETE /v1/chats/{chat}/messages`](/channel/whatsapp/api/resources/chats/subresources/messages/methods/delete/index.md) with `?before={message}` | Every message in the chat up to and including `before` | `202` with a request to track |
| [`GET /v1/content_deletions/{content_deletion}`](/channel/whatsapp/api/resources/content_deletions/methods/retrieve/index.md)                      | Nothing. Reads a chat-wide request’s progress          | `200`                         |

All four deletes require an `Idempotency-Key` header.

### One message

A `204` means the message no longer appears on any read, and its content is gone from our database. The transcript, the event log, the event stream and replays all leave it out, along with its related events such as `message.delivered` and `message.read`. Their `seq` values become gaps in the chat’s sequence, the same way an expired [ephemeral message](/channel/whatsapp/guides/platform/data-retention#ephemeral-messages/index.md) does.

Files the message used are removed from Linq’s storage shortly after the `204`, and, within limits, from the provider (see [How long it takes](#how-long-it-takes)). A file that another message, template or carousel still uses stays until its last use ends. A webhook or download already sending the content when you delete may still finish.

A pending webhook delivery about the message is withdrawn. It isn’t sent again, and the webhook deliveries list no longer shows it or its earlier attempts. Retrying it answers `404` with `webhook_delivery_not_found` ([2053](/channel/whatsapp/error/codes/2xxx/2053/index.md)). An attempt already in progress may finish, and a finished delivery stays listed.

Deleting a message that’s already deleted answers `204` again, under a new key. So does a message whose content [data retention](/channel/whatsapp/guides/platform/data-retention/index.md) already removed. A message that never existed answers `404` with `not_found` ([2011](/channel/whatsapp/error/codes/2xxx/2011/index.md)).

If you retry the original send with its own `Idempotency-Key` after deleting the message, you get `202` with empty `parts`. The message is never sent again.

### One attachment

The attachment is removed everywhere it appears in your account. Downloading it then answers `404` with `attachment_not_found` ([2003](/channel/whatsapp/error/codes/2xxx/2003/index.md)). The stored file is removed shortly after the `204`, and normally the provider’s copy too (see [How long it takes](#how-long-it-takes)). A download already in progress may finish.

The message that carried the attachment stays, with its caption and filename. Delete the message too if you want those gone. An attachment on a received message waits for the message’s first event to reach you, like the message itself: see [When a delete is refused for now](#when-a-delete-is-refused-for-now).

### One upload

After the `204`, the `upload_ref` no longer works. A send or template that names it is refused with `422` and `upload_ref_not_found` ([5006](/channel/whatsapp/error/codes/5xxx/5006/index.md)). The provider’s copy is removed as described in [How long it takes](#how-long-it-takes).

You can’t delete an upload that a template, a carousel or an unfinished send still uses. That answers `409` with `upload_in_use` ([2063](/channel/whatsapp/error/codes/2xxx/2063/index.md)) and no `Retry-After`. Wait for sends that use it to finish, or stop using it in templates and carousels, then retry.

### A chat, up to a cutoff

`before` is the ID of a message in the chat. The request covers that message and every earlier one. It never covers a message after `before`, including messages that arrive later. The chat itself stays, and so does every message after the cutoff. An unknown chat answers `404` with `chat_not_found` ([2001](/channel/whatsapp/error/codes/2xxx/2001/index.md)), and a `before` that isn’t a message in this chat answers `404` with `not_found` ([2011](/channel/whatsapp/error/codes/2xxx/2011/index.md)).

The `202` returns a `content_deletion` request:

202 response

```
{
  "id": "cdel_example",
  "chat_id": "chat_example",
  "before": "msg_example",
  "state": "blocked",
  "created_at": "2026-11-11T15:00:00Z",
  "completed_at": null,
  "counts": { "deleted": 41, "already_gone": 3, "blocked": 1 },
  "blocked_reasons": ["awaiting_first_delivery"]
}
```

The values are examples. Messages are removed as they become deletable, and each one vanishes from every read as it goes.

| `state`     | Meaning                                                                               |
| ----------- | ------------------------------------------------------------------------------------- |
| `pending`   | Accepted, not started                                                                 |
| `running`   | Removing messages                                                                     |
| `blocked`   | Some messages can’t be deleted yet. `blocked_reasons` says why. It resumes on its own |
| `completed` | No message in range has content left in our database                                  |

New states and reasons may be added. Treat an unknown value as “not yet completed”.

`counts.deleted` is messages this request removed. `counts.already_gone` is messages whose content was already gone, for example removed by data retention. `counts.blocked` is messages still waiting.

Track progress with [`GET /v1/content_deletions/{content_deletion}`](/channel/whatsapp/api/resources/content_deletions/methods/retrieve/index.md), or wait for the `content_deletion.completed` event. `completed` covers our database. Files, and their copies at the provider, can still be removed after it, on the same schedule as the one-message delete.

## The completion event

A chat-wide request records one `content_deletion.completed` event when it completes. It’s a chat event, like `message.received`: it arrives on webhooks, the event stream and the event log with the chat’s `chat_id` and a `seq` range. Reading that range from the chat’s events shows an entry with a `content_deletion` object: the request’s `id`, its `before`, and its `deleted` and `already_gone` counts. It carries no message content.

If your webhook endpoint subscribes to a list of event kinds, add `content_deletion.completed` to receive it. Single-item deletes answer synchronously and record no event.

## How long it takes

| What                                      | When                                                                                                                                                                                                                                                                                |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The content in Linq’s database            | Immediately: gone when the delete answers `204`, or as a chat-wide request removes each message                                                                                                                                                                                     |
| Files in Linq’s storage                   | Shortly after, usually within minutes                                                                                                                                                                                                                                               |
| A file the customer sent, at the provider | Shortly after, usually within minutes, retried until 7 days after it arrived, which is as long as the provider lets us delete it. A file older than that, or one we can’t delete in that time (for example, because the number has left Linq), is left to the provider’s own expiry |
| A file you sent, at the provider          | Shortly after the delete if its delivery is already confirmed, otherwise once it is. If it never is, the provider removes it when it expires, up to 30 days after upload                                                                                                            |
| Backups                                   | Age out within 7 days                                                                                                                                                                                                                                                               |

There’s no event when a provider’s copy is removed: the `204` and `completed` cover Linq’s database, and the rest follows on its own.

## When a delete is refused for now

Some content can’t be deleted yet. The delete answers `409`. The three waiting codes carry a `Retry-After` header, in whole seconds, also in `error.retry_after`. Each route answers only the codes that apply to it.

| Code                      | `error.code`                                             | Why                                                              | What to do                                                                                                      |
| ------------------------- | -------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `message_in_flight`       | [2061](/channel/whatsapp/error/codes/2xxx/2061/index.md) | A send of this message is still being handed to the channel      | Retry after the wait                                                                                            |
| `awaiting_first_delivery` | [2062](/channel/whatsapp/error/codes/2xxx/2062/index.md) | A received message’s first event to you is still being delivered | Retry after the wait                                                                                            |
| `content_deletion_busy`   | [2064](/channel/whatsapp/error/codes/2xxx/2064/index.md) | The chat, the attachment or the upload is busy for a moment      | Retry after the wait                                                                                            |
| `upload_in_use`           | [2063](/channel/whatsapp/error/codes/2xxx/2063/index.md) | A template, carousel or unfinished send still uses the upload    | Wait for sends that use it to finish, or stop using it in templates and carousels, then retry. No `Retry-After` |

A received message, or an attachment on one, can only be deleted once every delivery of the message’s first event to you has succeeded or failed for good. If your endpoint is failing, that delays the delete. If there’s a hold on webhook delivery to your endpoint, the delete waits until the hold is lifted; contact support if you need it sooner.

Nothing is deleted on a `409`, and the refusal isn’t recorded against your `Idempotency-Key`. Repeat the same request with the same key after the wait.

A chat-wide request doesn’t refuse for these reasons. It counts the message as `blocked` and picks it up again on its own.

## Idempotency

- `Idempotency-Key` is required on all four deletes.
- Repeating a request with the same key after a `204` or `202` returns the original answer. For a chat-wide request, that’s the same request in its current state. After one of the four refusals in the table above, the same key makes a fresh attempt. After `idempotency_conflict`, it keeps conflicting.
- Using a key on the same route for a different message, attachment, upload, chat or cutoff answers `409` with `idempotency_conflict` ([2009](/channel/whatsapp/error/codes/2xxx/2009/index.md)). Keys are separate per route.
- Deleting something already deleted, with a new key, answers `204`. In a chat-wide request it counts as `already_gone`.

## What’s removed and what’s kept

A delete removes the content from Linq’s database: text, captions and the other parts of a message, and the files it used, from Linq’s storage and, within limits, from the provider. Everything below stays.

| Kept                                                                                                                                                 | Why                                                                                                                    |
| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| The customer’s phone                                                                                                                                 | A delete doesn’t unsend, and nothing reaches the customer’s device                                                     |
| The provider’s copy of the message text                                                                                                              | The provider keeps it for up to 30 days, and no API can delete it                                                      |
| The provider’s copy of a file we couldn’t delete                                                                                                     | Left to the provider’s own expiry (see [How long it takes](#how-long-it-takes))                                        |
| Message and chat IDs, timestamps, direction, delivery and status records, webhook delivery attempts (except a withdrawn delivery’s), billing records | The record that a message existed, and what it cost. Kept in our database; the message’s events still leave every read |
| The customer’s identifier, such as their phone number                                                                                                | Part of the chat and its billing records                                                                               |
| Reply references, and chat settings such as a subject or description                                                                                 | They link messages together or describe the chat, not one message                                                      |
| Digests derived from the content                                                                                                                     | Fingerprints computed from the content, used to match records; they aren’t the content itself                          |
| Raw records received from the channel that also carry other customers’ messages                                                                      | Rewriting them would alter other customers’ records                                                                    |
| Raw records received from the channel that can’t be tied to exactly one message                                                                      | We can’t tell which message they belong to, so this API’s deletes don’t reach them                                     |
| Error responses from the channel                                                                                                                     | Kept for up to 90 days                                                                                                 |
| Backups                                                                                                                                              | Age out within 7 days                                                                                                  |
| Content already on its way to your endpoint                                                                                                          | A webhook already being sent may still arrive                                                                          |

Note

A delete removes content. It isn’t a full erasure of a person’s data: their identifier and the metadata above stay.

## Compared with the iMessage API

|                                               | iMessage                           | WhatsApp                                                                    |
| --------------------------------------------- | ---------------------------------- | --------------------------------------------------------------------------- |
| Delete one message                            | `204`                              | `204`                                                                       |
| Unsends from the device                       | No                                 | No                                                                          |
| Removes media at the provider                 | Not applicable                     | Usually: received files within 7 days of arrival, sent files once delivered |
| Retry the send with the deleted message’s key | `404`                              | `202` with empty `parts`, never resent                                      |
| Delete an attachment                          | `204`                              | `204`                                                                       |
| Delete an upload                              | `204` (an upload is an attachment) | `204`, or `409 upload_in_use`                                               |
| Delete a chat’s history                       | Not available                      | `202`, tracked, with `content_deletion.completed`                           |

## Best practices

- **Send an `Idempotency-Key` you can reuse.** After a `409` that carries `Retry-After`, retry with the same key once it has passed. After `upload_in_use`, wait for its sends to finish or stop using it first.
- **Treat a missing message as deleted or expired.** After a delete, the message and its related events are gone from transcripts and the event log, leaving gaps in `seq`. An expired ephemeral message looks the same.
- **Use the chat-wide delete for history.** It handles messages that can’t be deleted yet for you, instead of you retrying each one.
- **Save what you must keep before you delete.** Nothing brings deleted content back.

## Related

- [Data retention](/channel/whatsapp/guides/platform/data-retention/index.md) — opt-in settings that remove content on a schedule
- [Sending messages](/channel/whatsapp/guides/messaging/sending-messages/index.md) — idempotent retries and delivery outcomes
- [Attachments](/channel/whatsapp/guides/messaging/attachments/index.md) — upload and download
- [Events and recovery](/channel/whatsapp/guides/events/index.md) — the stream, the event log and chat sequences
- [Errors](/channel/whatsapp/guides/platform/errors/index.md) — the envelope and the code ranges
