Learn how to use Chainlit Cloud to set up data persistence in your Chainlit app.

Create a Chainlit Project

  1. Navigate to Chainlit Cloud and sign in.
  2. Click on the ’+’ icon to create a new project. You will see a screen similar to the one below: Project Creation Screen
  3. Click on the ‘Create API Key’ button to create a new API key.
  4. We will need this key later on. Project API Key

Activating Data Persistence

After creating a Chainlit Project and an API key for said project. You will need to pass the key via a CHAINLIT_API_KEY environment variable.

Next to your Chainlit application, create a .env file and modify it like so:


Or inlined:

CHAINLIT_API_KEY="your key" chainlit run main.py

Once activated, your chats and elements will be persisted in Chainlit Cloud.

Chat history

To enable chat history in your Chainlit app, you must setup data persistence AND authentication.


If you wish to deactivate data persistence, simply comment out or remove the CHAINLIT_API_KEY environment variable.

Data privacy & security

We prioritize your data’s privacy and security. We understand how crucial the data fed into Chainlit Cloud is for your business and handle it with utmost care.

Contact us for detailed information: contact@chainlit.io