# Backups and restore

> Backups are built on your server, downloaded to your computer and then removed from the server. Restore them from the same screen.

A backup protects you from things a snapshot cannot cover: a lost server, a mistake that was noticed after the rollback window, or a big job that goes wrong. PowerWP AI builds the backup on your server, but you keep it. It is downloaded to your computer and then removed from the server.

## What a backup contains

You choose one of three types on the **PowerWP AI › Backups** screen:

| Type | Contents |
|---|---|
| Full | The database and the files. |
| Database | All tables with your site's table prefix, as compressed SQL. |
| Files | The files in the WordPress root folder, such as `wp-config.php` and `.htaccess`, and everything in `wp-content`: themes, plugins and uploads. |

Two options apply to files: **Include uploads** (on by default, often the largest part) and **Include WordPress core** (off by default, `wp-admin` and `wp-includes`, which can be downloaded again).

Left out of every backup:

- PowerWP AI's own data: its connections, activity log, change log, site memory and recipes. Export the memory on the **Memory** screen if you want a copy.
- PowerWP AI's private storage folder, symbolic links, and the paths listed under **Settings › Backups › Excluded paths**. By default these are cache folders, other backup plugins' archives, `debug.log`, `node_modules` and `.git`.
- Files larger than **Skip files larger than** (512 MB by default). They are listed as skipped.

A backup is a folder of files: a `manifest.json`, one or more `db-0001.sql.gz` files and one or more `files-0001.tar.gz` files. The manifest holds a SHA-256 checksum for each file.

> [!WARNING] A backup includes `wp-config.php`, which holds your database password and keys. Keep the files as carefully as a password.

## Create a backup

:::steps
1. Open **PowerWP AI › Backups** and choose **Create backup**.
2. Pick **Full**, **Database** or **Files**, set the options and add a label such as "Before WooCommerce update".
3. Choose **Start backup**. Keep the page open: the backup then moves faster.
:::

Your AI app can start one too, with the Backups & restore permission:

```
Make a database backup before we change anything, wait until it is ready, then download it to my Documents folder.
```

The server builds the backup in small steps of about 20 seconds, so a short PHP time limit does not stop it. The steps are driven while the Backups screen is open, when an AI app checks on the job, and by WP-Cron. If WP-Cron is switched off on your server, keep the screen open. Only one backup can run at a time.

## Download it to your computer

**In your browser.** Select **Download links** on a ready backup and save every file. The links are signed and expire. Check the SHA-256 checksums, then select **Mark as downloaded**. The browser cannot check the files for you, so the server copy is kept until it expires. Use **Delete from server** (the bin icon) once you have checked the files.

**With an AI app that can run commands**, such as Claude Code. `backup_download_links` returns signed links and a script that downloads the files and prints their checksums. The app then calls `backup_confirm_downloaded` with the checksums. When they all match, the server copy is deleted. The links last 2 hours unless the app asks for another time, between 5 minutes and 24 hours.

A server copy that is never downloaded is deleted when it expires, after 48 hours by default.

## Restore from your computer

> [!WARNING] A restore replaces your current database and files with the backup. It cannot be rolled back from the change log. If you may need today's state, create a fresh backup first.

:::steps
1. Open **PowerWP AI › Backups** and choose **Restore from your computer**.
2. Select the `manifest.json` and every `.sql.gz` and `.tar.gz` file of one backup.
3. Check the summary: backup ID, date and the address it came from. Choose what to restore: **Database**, **Files** or both.
4. Type your site's host name to confirm, then choose **Upload and restore**.
:::

While the restore runs, your site is in maintenance mode. PowerWP AI keeps its own data, the running plugin, its private storage, the rescue loader and `wp-config.php`. When the restore ends, maintenance mode is switched off (unless it was already on), and the site is checked once.

Good to know:

- If the backup comes from another address, URLs inside the database are not rewritten. Restore the files only, or ask your AI app to replace the old address afterwards.
- The table prefix must match, or the backup is refused. The restore needs free disk space of about 2.2 times the size of the backup.
- A restore that has started cannot be cancelled. If it fails, the site stays in maintenance mode, which ends by itself, so you can inspect it.

AI apps use `restore_prepare` to get upload links from the manifest, upload the files, and then call `restore_start` with the site's host name as confirmation. They should only do this when you explicitly ask.

## Where backups are kept and limits

Backups are written to PowerWP AI's private folder on the server. Unless you set another place, it is `wp-content/wpai-mcp-` followed by a random string. Set `WPAI_MCP_STORAGE_DIR` to move it outside the web root. See [wp-config constants](/docs/reference/constants/).

- The database is split into parts of about 64 MB of SQL, and files into parts of about 256 MB of content, so large sites make several files.
- A backup needs the PHP zlib extension. A job with no progress for 6 hours is marked as failed.

These settings are under **Settings › Backups**:

| Setting | Default |
|---|---|
| Server copy lifetime | 48 hours |
| Delete server copy after download | On |
| Skip files larger than | 512 MB |
| Excluded paths | Caches, other backup plugins' archives, `debug.log`, `node_modules`, `.git` |

:::cards
- [Work safely on a live site](/docs/guides/safe-workflow/) — When to back up, and what else to do first.
- [Staging, copies and moving sites](/docs/guides/staging/) — Use a backup to move or copy a site.
- [What can't be undone](/docs/safety/limits/) — Why a restore is not in the change log.
:::

Source: https://powerwp.ai/docs/safety/backups/
