Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

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+Y on macOS).

The Temporary Chat button at the right end of the chat header, with its tooltip

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.

A new temporary chat: the Temporary Chat landing message and the tinted message box

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:

ModeWhat expiresChats visible in history and search?Can users opt out?
temporary (default)Only chats a user marks as temporaryYes for normal chats, no for temporaryYes, chat by chat
allEvery chatYes, until each chat expiresNo
ephemeralEvery chatNo, every chat is temporaryNo, 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
KeyTypeDefaultDescription
retentionMode"temporary" | "all" | "ephemeral""temporary"Which chats receive an expiry date. See The three modes.
temporaryChatRetentionnumber (hours)720How long a temporary chat is kept after it was last saved. Also the lifetime of every chat under ephemeral. Range 1 to 8760.
generalChatRetentionnumber (hours)temporaryChatRetentionHow long regular chats are kept under all. Ignored by the other modes. Range 1 to 8760.
retainAgentFilesbooleanfalseUnder all and ephemeral, files uploaded to an agent's resources don't expire. Files attached to messages still expire with their chat.
temporaryChatbooleantrueSeeds 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, or temporaryChatRetention when 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 temporaryChatRetention hours. generalChatRetention is ignored.
  • The Temporary Chat toggle is locked on for everyone, including users whose role lacks the TEMPORARY_CHAT permission. The keyboard shortcut is disabled.
  • The server enforces it: a client that sends isTemporary: false is 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 ephemeral they are always temporary. Under all, 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 all or ephemeral: existing chats get a deadline the next time they are written to. Under ephemeral, 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 under all still carry their deadlines and will still be deleted. Chats saved under ephemeral remain 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 temporary

Make every chat temporary and delete it after 24 hours:

interface:
  retentionMode: 'ephemeral'
  temporaryChatRetention: 24

Make every chat temporary for a week, but keep the files attached to agents:

interface:
  retentionMode: 'ephemeral'
  temporaryChatRetention: 168
  retainAgentFiles: true

FAQ

How is this guide?