---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/build/features/messages/restore
title: Restore messages
updated_at: 2026-05-19T12:09:44.975Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Restore messages

`restore()` recovers soft-deleted messages and their attached files. Hard-deleted messages cannot be restored.

:::note Requires Message Persistence
Enable [Message Persistence](https://youtu.be/qLMtbINWGig) and **Enable Delete-From-History** in the [Admin Portal](https://admin.pubnub.com/).
:::

### Method signature

##### Under the hood

`restore()` calls Message Actions API and the JavaScript SDK [removeMessageAction()](https://www.pubnub.com/docs/sdks/javascript/api-reference/message-actions#remove-message-reaction) method to remove the `deleted` status from the restored messages.

This method has the following signature:

```ts
message.restore()
: Promise<Message>
```

#### Input

This method doesn't take any parameters.

#### Output

| Type | Description |
| --- | --- |
| `Promise<Message>` | Object returning the restored [Message object](https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/message). |

### Sample code

Restore a previously soft deleted message with the `16200000000000001` timetoken.

```ts
// reference the "message" object
const { messages } = await channel.getHistory({
    startTimetoken: "16200000000000000",
    endTimetoken: "162000000000000001"
})
const message = messages[0]
// soft delete this message
await message.delete({
    soft: true
})

// restore the deleted message
await message.restore()
```