Temporary Chat & Data Retention
Keep individual conversations out of your history and search with temporary chats, and let administrators expire conversation data automatically or make every chat temporary.
Temporary chats let you ask something without keeping it. Use them for sensitive topics, quick experiments, or anything you don't need to save. A temporary chat stays out of your history sidebar, never appears in search, can't be bookmarked, and is deleted automatically once its retention period ends (30 days by default).
The same mechanism powers data retention for administrators: LibreChat can put an expiry date on every conversation, or force every chat to be temporary for the whole deployment.
Two audiences on one page
Using Temporary Chat is for everyone. Data retention
onward is for administrators configuring librechat.yaml. Each option is also listed in the
interface reference.
Using Temporary Chat
Start a temporary chat
Start a new chat, then turn on Temporary Chat before you send the first message:
- Desktop: select the Temporary Chat button (a hat and glasses icon) at the right end of the chat header. Hovering it shows the keyboard shortcut.
- Mobile: open the header menu and select Temporary Chat. A check mark shows it is on.
- Keyboard: press
Ctrl+Shift+Y(Cmd+Shift+Yon macOS).

While it is on, the landing view shows Temporary Chat with the note "This chat won't appear in your history and will be deleted automatically.", and the message box is tinted. Select the button again to turn it off.

The toggle is only available before the first message. Once the conversation starts, a read-only Temporary Chat badge stays in the header so you always know the chat won't be kept.
Make every new chat temporary
To start all new chats as temporary, open Settings > Chat and turn on Temporary Chat by default. This preference is stored in your browser, so set it on each device you use.
What a temporary chat does
- It does not appear in the chat history sidebar.
- It is excluded from search results.
- It cannot be bookmarked.
- It does not get an automatically generated title.
- It is kept until its retention period ends, then deleted automatically. The default period is 30 days; your administrator may set a different one.
Retention applies to conversations, messages, files and shared links. Memories are not deleted when a temporary chat expires.
Administrator-enforced temporary chats
If your administrator has made every chat temporary, the Temporary Chat button is always on and can't be turned off. Hovering or focusing it shows "Temporary Chat is enabled for all chats by your administrator", and the keyboard shortcut does nothing.
Data retention
Administrators control retention with a few options under interface in librechat.yaml. The main one is retentionMode, which decides which chats get an expiry date:
| Mode | What expires | Chats visible in history and search? | Can users opt out? |
|---|---|---|---|
temporary (default) | Only chats a user marks as temporary | Yes for normal chats, no for temporary | Yes, chat by chat |
all | Every chat | Yes, until each chat expires | No |
ephemeral | Every chat | No, every chat is temporary | No, the toggle is locked on |
The default is temporary, so existing deployments keep their current behavior until you change it.
Configuration
interface:
# Who may use the Temporary Chat toggle (seeds the TEMPORARY_CHAT permission for the USER role)
temporaryChat: true
# Which chats expire: "temporary" (default), "all", or "ephemeral"
retentionMode: 'temporary'
# Lifetime of temporary chats, in hours. Default 720 (30 days), range 1 to 8760.
temporaryChatRetention: 720
# Lifetime of regular chats under retentionMode "all", in hours. Defaults to temporaryChatRetention.
# generalChatRetention: 2160
# Under "all" or "ephemeral", keep files uploaded to agents (knowledge and context files) from expiring.
retainAgentFiles: false| Key | Type | Default | Description |
|---|---|---|---|
retentionMode | "temporary" | "all" | "ephemeral" | "temporary" | Which chats receive an expiry date. See The three modes. |
temporaryChatRetention | number (hours) | 720 | How long a temporary chat is kept after it was last saved. Also the lifetime of every chat under ephemeral. Range 1 to 8760. |
generalChatRetention | number (hours) | temporaryChatRetention | How long regular chats are kept under all. Ignored by the other modes. Range 1 to 8760. |
retainAgentFiles | boolean | false | Under all and ephemeral, files uploaded to an agent's resources don't expire. Files attached to messages still expire with their chat. |
temporaryChat | boolean | true | Seeds the TEMPORARY_CHAT permission for the built-in USER role at startup. Manage the permission per role in the Admin Panel. |
A librechat.yaml value outside 1 to 8760 hours fails config validation.
Environment variable
The temporary chat lifetime can also be set with TEMP_CHAT_RETENTION_HOURS. interface.temporaryChatRetention takes precedence when both are set. An invalid value falls back to 720, and a value outside 1 to 8760 is clamped into that range with a warning in the server log.
Prefer librechat.yaml
TEMP_CHAT_RETENTION_HOURS is deprecated. Use interface.temporaryChatRetention instead.
The three modes
temporary (default). Only chats a user marks as temporary expire, whether through the toggle or the Temporary Chat by default setting. They are hidden from history and search and deleted after temporaryChatRetention hours. Normal chats never expire.
all. Every conversation and message gets an expiry date, but the chat experience doesn't change: chats stay in history and search until they expire.
- Regular chats use
generalChatRetention, ortemporaryChatRetentionwhen it isn't set. - Chats a user marks as temporary still behave as temporary chats and use
temporaryChatRetention. - Uploaded files and shared links expire too. Agent resource files are kept only with
retainAgentFiles: true.
Use all for a "keep everything for N days, then delete" policy.
ephemeral. Every chat is temporary. This is "Temporary Chat always on" for the whole deployment.
- Every chat is hidden from history and search, gets no generated title, and is deleted after
temporaryChatRetentionhours.generalChatRetentionis ignored. - The Temporary Chat toggle is locked on for everyone, including users whose role lacks the
TEMPORARY_CHATpermission. The keyboard shortcut is disabled. - The server enforces it: a client that sends
isTemporary: falseis overridden. - Uploaded files and shared links expire with their chat. Agent resource files are kept only with
retainAgentFiles: true.
Use ephemeral when no conversation should be kept long term.
How retention works
Each conversation and message carries an expiredAt date, and temporary ones are also flagged with isTemporary: true. Hidden and expired records are filtered out of the history list and the search index before they are deleted.
- Conversations, messages and shared links are removed by a MongoDB TTL index on
expiredAt. MongoDB runs this cleanup in the background, usually within about a minute of the deadline. - Files are removed by a periodic sweep in LibreChat, which deletes the stored file (local disk, S3, and so on) and then its record.
The deadline is set when a record is saved. Every save of a conversation moves its deadline forward, so an active chat stays around while it is in use. Each message keeps the deadline it got when it was saved.
Under all and ephemeral, retention applies wherever chat data is written: new messages on every endpoint, regenerations and branches, message edits, feedback, artifact edits, resumed responses, forks, duplicates and imports.
- Forks, duplicates and imports. Under
ephemeralthey are always temporary. Underall, a copy of a temporary chat stays temporary, and other copies and imports stay visible with an expiry date. - Shared links take their expiry from the conversation they point to, so a link never outlives its chat.
- Memories have no expiry and are not affected by any retention mode.
Switching modes
Changing retentionMode or a retention period only affects records saved afterwards. LibreChat does not rewrite existing deadlines.
- To
allorephemeral: existing chats get a deadline the next time they are written to. Underephemeral, an older regular chat that receives a new message, edit, feedback or branch is converted to a temporary chat on the spot: it leaves history and search and loses its bookmarks. Chats nobody touches keep their current state. - Back to
temporary: chats saved underallstill carry their deadlines and will still be deleted. Chats saved underephemeralremain temporary chats and keep expiring.
To stop regular chats from expiring after leaving all or ephemeral, clear their deadlines in mongosh:
db.conversations.updateMany(
{ isTemporary: false, expiredAt: { $ne: null } },
{ $unset: { expiredAt: 1 } },
)
db.messages.updateMany(
{ isTemporary: false, expiredAt: { $ne: null } },
{ $unset: { expiredAt: 1 } },
)Search indexes after upgrading
MongoDB doesn't drop superseded indexes on its own. Once the new
_meiliIndex_1_isTemporary_1_expiredAt_1 indexes exist on conversations and messages, you can
drop the old _meiliIndex_1_expiredAt_1 indexes from both collections.
Examples
Delete every chat 90 days after its last activity, and keep chats visible until then:
interface:
retentionMode: 'all'
generalChatRetention: 2160 # 90 days for regular chats
temporaryChatRetention: 24 # 1 day for chats users mark as temporaryMake every chat temporary and delete it after 24 hours:
interface:
retentionMode: 'ephemeral'
temporaryChatRetention: 24Make every chat temporary for a week, but keep the files attached to agents:
interface:
retentionMode: 'ephemeral'
temporaryChatRetention: 168
retainAgentFiles: trueFAQ
How is this guide?
Shareable Links
Share your conversations with others using LibreChat's shareable links feature, complete with QR codes, branching messages, and artifacts support.
Query Parameters
Learn how to configure chat conversations using URL query parameters in LibreChat. Set models, endpoints, and conversation settings dynamically.