---
title: "Database Backups"
description: "Automatic backups at a fixed time, copies in Dropbox and Google Drive, keeping only the latest backup in the cloud, and how to restore."
---

> [!NOTE]
> New in Xtream AI 2.5.0: Google Drive, **Keep only the latest backup in the cloud** and the fixed backup time. They require engine 2.5.0 on your main server. Dropbox and automatic backups work with older engines too.

Your database holds your clients, resellers, channels and movies. If a server fails or someone deletes data by mistake, a recent backup brings everything back. This page shows how to make backups on a schedule and keep a copy outside your server, in Dropbox or Google Drive.

Everything is in **Settings** → **Backups** (the **Database Backups** section). It has three cards: **Automatic backups**, **Cloud copies** and **Available Backups**.

> [!IMPORTANT]
> Backups always stay on your server too. Dropbox and Google Drive are copies.

## Step 1: Turn on automatic backups

1. In the **Automatic backups** card, turn on **Automatic backups**.
2. In **Backup Interval**, set a number and a unit: **Hours**, **Days**, **Weeks** or **Months**. For example, every 1 day. It saves when you change it.

### Fixed time (engine 2.5.0)

Automatic backups run at a fixed time. Below the interval you see it, for example "Fixed time: 03:00 (your time zone). Next: tomorrow 03:00".

- The first backup after you turn on **Automatic backups** sets the time.
- To choose the time yourself, click **Run and pin the time now** at the hour you want. A backup starts within a minute, and its start time becomes the fixed time.
- A manual backup (**Create Backup Now**) does not move the fixed time.
- If the server was off at the backup time, the late backup runs as soon as it can, and the fixed time stays the same.

### Include all logs

On installs that have run for a long time, log tables are most of the backup size. Turn off **Include all logs** to leave some or all log tables out. Pick the tables to leave out; with no selection, all logs are left out. EPG data is always included. This applies from the next backup.

## Step 2: Keep a copy in the cloud

In the **Cloud copies** card you can connect Dropbox, Google Drive or both.

### Dropbox

You authorize Dropbox once, and the panel keeps the connection alive on its own.

1. In **Permanent Dropbox connection**, click **Connect Dropbox**.
2. Create your Dropbox app, following the steps in the window:
   - Open dropbox.com/developers/apps and click **Create app**.
   - Pick **Scoped access** and then **App folder**, so the backups stay in their own folder.
   - In the **Permissions** tab, enable `files.content.write` and save. Do this **before** you authorize.
   - Copy the **App key** and **App secret** from the **Settings** tab.
3. Paste them in **App key** and **App secret** and click **Get authorization link**.
4. Open the link, authorize the app in Dropbox, and copy the code Dropbox shows.
5. Paste it in **Authorization code** and click **Connect**.

The status changes to **Dropbox connected (permanent)**. Every new backup uploads on its own from now on.

> [!NOTE]
> The old **Set your Dropbox API Token** option still exists as a fallback, but its token expires every few hours. Use the permanent connection.

### Google Drive (engine 2.5.0)

Each admin connects their own Google account. Backups upload to a folder named `backups-xtreamai`. The panel can only see and delete the files it uploads.

First, create your Google app (once):

1. Open console.cloud.google.com and create a project, or use one you have.
2. In **APIs & Services** → **Library**, enable **Google Drive API**.
3. In **OAuth consent screen**, choose **External**, fill in the name and email, add the scope `.../auth/drive.file` and **publish the app** (**In production**).
4. In **Credentials** → **Create credentials** → **OAuth client ID**, choose **TVs and Limited Input devices**. Copy the **Client ID** and **Client secret**.

> [!WARNING]
> If the Google app stays in testing mode, Google cuts the access after 7 days and the backups stop uploading. Publish it.

Then connect:

1. In the **Google Drive** row, click **Connect Google Drive**.
2. Paste the **Client ID** and **Client secret** and click **Get code**.
3. A code appears, for example `ABCD-EFGH`. Open google.com/device on any device, sign in with the Google account that will keep the backups, and enter the code. The code is valid for 30 minutes.
4. The window closes on its own when you authorize. You see "Google Drive connected. Backups start uploading within a minute."

With Drive connected, the **Upload** switch turns uploads on or off without disconnecting. Uploads run in the background and resume if the network drops.

### Keep only the latest backup in the cloud (engine 2.5.0)

Turn on **Keep only the latest backup in the cloud** to keep only the newest backup in Dropbox and Google Drive.

- Older cloud backups are deleted only **after** the new one finishes uploading. If the new upload fails, the previous one stays.
- Backups on your server are not touched.
- Only backups that this server uploaded are deleted. If two panels share the same Dropbox or Drive account, one never deletes the backups of the other.
- If you turn off uploads to one cloud, what is already there stays.

## Step 3: Check your backups

The **Available Backups** card lists every backup with **Creation Date**, **Size**, **Filename**, **Dropbox** (a check mark when it is uploaded), **Google Drive** and **Actions**.

- **Create Backup Now** makes a backup right away. A progress bar shows **Queued**, **Dumping database**, **Encrypting** and **Completed**. The percentage is an estimate.
- **Send** uploads one backup to Google Drive now. With **Keep only the latest backup in the cloud** on, only the newest backup can be sent.
- **Delete** removes a backup.

## Restore a backup

> [!WARNING]
> A restore overwrites your current database with the backup. Everything created or changed after that backup is lost. Log tables that were left out of that backup are empty after the restore.

1. In **Available Backups**, click **Restore** on the backup you want.
2. Enter your **License Key** and **Verification Key**. You find both in your client area, in the details of your license.
3. Click **Restore backup**.

## Common problems

- **"Dropbox rejected the connection"** The code is single-use and expires in minutes, or the App key and App secret are from another app. Click **Get authorization link** again and paste the new code right away.
- **Dropbox is connected but nothing uploads.** The `files.content.write` permission was not enabled before you authorized. Click **Disconnect** and connect again.
- **"Dropbox stopped accepting uploads (access revoked)"** or **"Google Drive stopped accepting uploads (access revoked)"** The access was removed in your account, or the app was deleted. Backups are still saved on the server. Click **Reconnect**. You also get a notification on the [Dashboard](/docs/dashboard), once a day, until you fix it.
- **Google Drive stopped uploading after 7 days.** Your Google app is still in testing mode. Publish it (**In production**) and click **Reconnect**.
- **"Paste both the Client ID and the Client secret."** One of the two fields is empty.
- **An error from Google after Get code, such as `invalid_client`.** The Client ID does not exist or is not of the type **TVs and Limited Input devices**.
- **"The code expired. Start again with "Get code"."** The 30 minutes passed. Get a new code.
- **I reconnected with a different Client ID.** Backups uploaded with the old one stay in your Drive, but the panel cannot see or delete them anymore. Remove them by hand if you need the space.
- **I do not see Google Drive, Keep only the latest backup or the fixed time.** Your main server runs an engine older than 2.5.0. See [Update the engine](/docs/update-the-engine).
- **I do not see Permanent Dropbox connection.** Your main server runs an engine older than 2.2.1.

## Related

- [General settings](/docs/general-settings)
- [Generate a backup](/docs/generate-a-backup)
- [Update the engine](/docs/update-the-engine)
- [Dashboard](/docs/dashboard)
