# Neon

How to back up Neon managed PostgreSQL databases via SimpleBackups.

Neon is a serverless PostgreSQL platform with branching and autoscaling. Backing it up through SimpleBackups lets you store portable copies in your own storage with custom retention schedules, independent of Neon's built-in history. This guide covers both the automatic API-based setup and the manual connection string approach.

## Automatic setup

In this section, you will generate a Neon API key and connect your Neon project to SimpleBackups so that databases are discovered automatically.

### Step 1: Obtain Neon API credentials

1. Go to [https://console.neon.tech/app/settings/api-keys](https://console.neon.tech/app/settings/api-keys).
2. Click **Create new API key**.
3. Copy the generated key to a safe location.

![Neon API keys settings page with Create new API key button](https://simplebackups.com/docs/docs-assets/media-helpkit-co/d0c66729ccc53bbac112.png)

### Step 2: Get the project ID and whitelist SimpleBackups IPs

1. From the menu, click **Projects** and choose the project that contains the database you want to back up.
2. From the menu, click **Settings**, then **General**.
3. Copy the **Project ID**.
4. Navigate to **IP Allow** and add the [SimpleBackups IP addresses](https://simplebackups.com/docs/help-tips-and-troubleshooting/connecting-a-server/simplebackups-ip-addresses-firewall).

![Neon project settings showing Project ID field](https://simplebackups.com/docs/docs-assets/media-helpkit-co/0055aea3684a5ac7310a.png)

![Neon IP Allow settings tab](https://simplebackups.com/docs/docs-assets/media-helpkit-co/849bc97fad3f8bd99de8.png)

![Neon IP address entry form](https://simplebackups.com/docs/docs-assets/media-helpkit-co/b2de83de8edbcbfb0ae9.png)

### Step 3: Create a Neon provider in SimpleBackups

1. Go to the [database backup page](https://my.simplebackups.com/backup/create?type=db) and click **Add** in the **Connect your DBaaS Provider** section.
2. Select **Neon** from the **Provider** dropdown, enter a name for your Neon account, paste the API key and project ID from the previous steps, then click **Save provider**.

![SimpleBackups provider connection form for Neon](https://simplebackups.com/docs/docs-assets/media-helpkit-co/2155d9be8cbba3a286a3.png)

![SimpleBackups Neon provider saved confirmation](https://simplebackups.com/docs/docs-assets/media-helpkit-co/bda8c4b785d81cac2d85.png)

3. Select your provider, then the database you want to back up.
4. Click **Validate**.

![SimpleBackups database selection and validate screen for Neon](https://simplebackups.com/docs/docs-assets/media-helpkit-co/2e312a3a625125ea8f31.png)

### Step 4: Schedule and activate

Set a schedule for your backups and configure retention policies and storage. Review your configuration and save — SimpleBackups will start backing up your database according to your schedule.

## Manual setup

Use this approach if you prefer to supply connection credentials directly rather than through the Neon API.

### Step 1: Copy your connection string

1. Log in to your Neon dashboard and navigate to the database you want to back up.
2. Click **Overview**, then **Connect**, or refer to **Connection Details** on the dashboard.
3. Create a new user or role with read access to the database if needed. This user will be used by SimpleBackups to connect.
4. Copy the connection string and replace the `****` placeholder with your actual password.

![Neon connection details screen showing the connection string](https://simplebackups.com/docs/docs-assets/media-helpkit-co/1c3fedf94aa654edd8c1.png)

### Step 2: Whitelist SimpleBackups IP addresses

**Info:**
If your database is behind a firewall, you need to allowlist SimpleBackups before it can connect.

1. In the Neon dashboard, go to **Project settings**, then **IP Allow**.
2. Add the [SimpleBackups IP addresses](https://simplebackups.com/docs/help-tips-and-troubleshooting/connecting-a-server/simplebackups-ip-addresses-firewall) to the allowlist.

![Neon IP Allow settings with IP address entry](https://simplebackups.com/docs/docs-assets/media-helpkit-co/87885186b50d96930982.png)

### Step 3: Create a database backup in SimpleBackups

1. Navigate to **Backups** and click **Create Backup**, then select **Database Backup**.
2. Choose **Serverless** as the backup server type.
3. Select **PostgreSQL** as the database type.
4. Click **Paste connection string** and fill in the complete connection string, making sure the password is included.
5. Click **Validate Connection**.

![SimpleBackups database connection form with Neon PostgreSQL connection string](https://simplebackups.com/docs/docs-assets/media-helpkit-co/4d932cac01c498364e78.png)

6. Set a schedule and configure retention policies and storage. Review your configuration and save.

## Restoring a backup

To restore a backup, navigate to your backup page and open the **Logs** tab. Click the detail icon on the backup you want to restore from, then open the **Restore** tab. Generate a download link and copy it.

![Neon backup logs tab](https://simplebackups.com/docs/docs-assets/media-helpkit-co/040206ac8242bdba98a9.png)

![Neon backup detail view](https://simplebackups.com/docs/docs-assets/media-helpkit-co/8edfed3e82927b38ffa1.png)

![Neon restore tab with download link](https://simplebackups.com/docs/docs-assets/media-helpkit-co/69bdb6dd8c995ba9bdec.png)

Run the following command to download and decompress your backup (replace the URL with your signed download link):

```bash
wget -O - "<signed-download-url>" | gunzip -c > backup.pgsql
```

Then restore using `pg_restore`, replacing `<your-database-uri>` with your full database connection string:

```bash
pg_restore -d "<your-database-uri>" ./backup.pgsql
```

**Tip:**
Use the latest version of `pg_restore` to avoid compatibility issues during restore.
