> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hightouch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Firestore

> Power internal tools, in-app experiences, and more

## Supported syncing

| Supported Sync Modes | Description |
| - | - |
| Upsert | Push new records and update records that change in your source |

For more information about sync modes, refer to the [sync modes](https://docs.hightouch.com/syncs/types-and-modes.md#sync-modes) docs.

## Connect to Firestore

You can decide whether to set up Firestore with [Firebase](#firebase) or with [Google Cloud Platform](#google-cloud-platform).
The following sections outline the necessary setup for either service.

### Firebase

To find the credentials, navigate to [Firestore](https://console.firebase.google.com) and select your project.

In the left-hand sidebar, click the wheel icon next to **Project Overview** and select **Project settings** from the menu.

Once on the Project setting screen, select the **Service accounts** tab. Make sure you are on the **Firebase Admin SDK**.

You will need to click the **Generate new private key** button to download a JSON file of the credentials.

![Firestore Firebase credentials](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-firebase-firestore-credentials.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=6f0a61de4a9a9afb447a2a2bf62f81b7)

In Hightouch, paste your **private key** including the header and footer in the following format:

```bash theme={null}
-----BEGIN PRIVATE KEY-----
<private key body>
<private key body>
<private key body>
-----END PRIVATE KEY-----\n
```

Make sure to include the final `\n` character as well, as that is still part of the private key.

### Google Cloud Platform

To find the credentials, navigate to [Google Cloud Platform](https://console.cloud.google.com/firestore/welcome). In the header, next to Google Cloud Platform, click the **Select a project** dropdown and select a project.

If you do not have Firestore set up within this project, you will be taken to the **Get started** screen. Click the **Select Native Mode** button.

![Firestore GCP Get started](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-google-firestore-get-started-api.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=0fb62b5a34b0201ce22d8d9bdad67c13)

Select a location from the dropdown, and then click the **Create Database** button.

![Firestore GCP Database](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-google-firestore-get-started-location.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=40df2f313883d94376f720f97fccecfa)

Once you are redirected to the Firestore dashboard screen, click the **Security Rules** in the sidebar. Click on the **Enable Firebase** button, and confirm by clicking the **Enable** link within the modal.

Click on the hamburger menu in the top left corner. Select **APIs & Services** from the sidebar, and then select **Credentials** from the dropdown menu.

Once on the Credentials screen, scroll to the **Service Accounts** table. Click on the edit icon in the row with the **Name** as **App Engine default service account**.

![Firestore GCP Service Accounts](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-google-firestore-service-accounts.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=be2b7e6b70644c2ab986a1d54060897e)

Click on the **Keys** tab, and then click the **Add Key** button.

![Firestore GCP Keys](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-google-firestore-keys.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=e702a2c633baf65af53b0df731808ee8)

Select the **Create new key** option. Keep the **Key type** as **JSON**, and click the **Create** button in the modal. This will download a JSON with the needed credentials.

![Firestore GCP Create key](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-google-firestore-create-key.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=37cea28f653911c460bc8afb04b1232b)

In Hightouch, paste your **private key** including the header and footer in the following format:

```bash theme={null}
-----BEGIN PRIVATE KEY-----
<private key body>
<private key body>
<private key body>
-----END PRIVATE KEY-----\n
```

Make sure to include the final `\n` character as well, as that is still part of the private key.

### Custom database name

Firestore defaults to the `(default)` database. If your setup requires a custom database name enter it in the **Database Name** field in Hightouch during setup.

## Sync configuration

### Sync modes

Hightouch supports the Upsert sync mode.

During the Upsert mode, new rows will be inserted into Firestore and existing rows will be kept up-to-date within Firestore.

### Record matching

Records can be matched from your source to Firestore by any unique property.

### Columns to sync

For Firestore, we give you the ability to send all columns as they are represented in your model.

![Firestore columns](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-firestore-sync-columns.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=f2466d745901af833e1f8616a4ce61b3)

You can also choose to manually map fields. Only the fields that you map will be exported. All other columns from your results are ignored.

![Firestore mappings](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-firestore-add-mappings.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=c5f11bd44df863712e51effd768429b0)

### Delete mode

The default is to do nothing, but you can also set Hightouch to delete the record when it leaves the query result.

## Tips and troubleshooting

To see the exact API requests and responses from each sync run, use the [live debugger](https://docs.hightouch.com/syncs/debugger.md). To get notified by Slack, PagerDuty, SMS, or email when a sync fails, set up [sync alerts](https://docs.hightouch.com/syncs/alerting.md). If you run into an issue this page doesn't cover, [contact support](#pylon-chat).
