> ## 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.

# Notion

> Power up your Notion databases with data from your data warehouse

| Sync Type | Description | Supported Sync Modes |
| - | - | - |
| Database rows | Upsert or update rows in a Notion [database](https://www.notion.so/help/intro-to-databases) | Upsert, Update |

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 Notion

Go to the [**Destinations** overview page](https://app.hightouch.com/destinations?from=docs) and click the **Add destination** button. Select **Notion** and click **Continue**. You can then authenticate Hightouch to Notion by logging into Notion.

Next, select which Notion pages you want to give Hightouch access to.

> [!TIP]
>
> Be sure to give access to pages that include databases you want to sync to.
> If the page containing the database within Notion has restricted access, you won't be able to configure a sync to it.

Once successful, you will be redirected back to Hightouch to enter a descriptive name for your destination and complete setup.

## Sync configuration

Once you've set up your Notion destination and have a [model](https://docs.hightouch.com/getting-started/concepts.md#models) to pull data from, you can set up your sync configuration to begin syncing data. Go to the [**Syncs** overview page](https://app.hightouch.com/syncs?from=docs) and click the **Add sync** button to begin. Then, select the relevant model and the Notion destination you want to sync to.

### Database selection

After selecting your desired [sync mode](#supported-syncing), select the Notion database you want to sync data to.

### Record matching

To match rows from your model to database rows in Notion, you need to select a model column and corresponding Notion field.
It's best to select a unique identifier for record matching, otherwise the intended records may not be updated properly.
Refer to the [record matching docs](https://docs.hightouch.com/syncs/record-matching.md) for more information.

![Record matching in the Hightouch UI](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-notion-record-matching.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=8bbb0ee524d3e585b47039998a8c5f2d)

> [!TIP]
>
> The Notion field you select for record matching [must be a **text** field](#column-not-appearing-for-record-matching).

### Field mapping

You can sync model columns to Notion's database properties.
Hightouch automatically detects existing database properties from your Notion databases.

![Field mapping in the Hightouch UI](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-field-mapping.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=e5e9a791e05ca5745d6dfd3b611f3839)

#### Supported Notion properties

Hightouch supports the following Notion database properties when field mapping.

* `Checkbox`
* `Date`: Hightouch supports a single date, and not a date range
* `Email`
* `Multi Select`
* `Number`: If a number field is passed an invalid number, Hightouch attempts to convert it to a number. If the conversion result is invalid, the sync errors.
* `Phone`
* `Rich Text`
* `Select`
* `Title`
* `URL`

To learn more about Notion's available properties, please refer to [Notion's docs](https://developers.notion.com/reference/property-object).

#### Delete behavior

The [delete behavior](https://docs.hightouch.com/syncs/overview.md#delete-behavior) you select dictates what to do when a row no longer appears in your model's query results. You have the following options:

> [!NOTE]
>
> **Delete** is only available on **Upsert** mode and **Clear** is available for
> **Upsert** and **Update** mode.

| Behavior | Description |
| - | - |
| **Do nothing** | Keep the row in the database with all its synced fields |
| **Clear** | Clear all the mapped fields, but keep the row in the database |
| **Delete** | Delete the synced row in the database |

## 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).

## Common errors

### Database not appearing in dropdown

If the page containing the database within Notion has restricted access, the database won't appear in the dropdown menu of the sync configuration, even if Hightouch is explicitly granted access during authentication.
You may also receive a `404 - Could not find database with ID: {...}` error in the [record matching](https://docs.hightouch.com/syncs/record-matching.md) section of your sync configuration, or when attempting to sync to Notion.

To fix this, go to the [**Destinations** overview page](https://app.hightouch.com/destinations?from=docs) and select your Notion destination.
Click **Log in to Notion** and add access to any required pages.

![Notion OAuth in the Hightouch UI](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-notion-log-in.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=a54d88767761eecea95c9d6a5a975d5d)

Then, return to your sync configuration or create a new one from the [**Syncs** overview page](https://app.hightouch.com/syncs?from=docs).
You may need to click the refresh button to see the new database.

![Refreshing Notion databses in the Hightouch UI](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-notion-refresh.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=3f5c31785984d6bb6727e455715449de)

### Column not appearing for record matching

Hightouch only supports record matching on **text** fields in Notion.
Convert the field type to text in Notion, or create a new text field.

![Text fields in Notion](https://mintcdn.com/hightouch-3c037897/L_vQfA0JQEpeGUUo/images/destinations/destination-notion-record-matching-text-type.png?fit=max\&auto=format\&n=L_vQfA0JQEpeGUUo\&q=85\&s=b4de2ebcc8e6d1984de72cbf4ba3f279)

### 400 - body failed validation \{...} should be defined, instead was undefined

This error occurs if you try to sync `null` values to [Select](https://developers.notion.com/reference/property-object#select) or [Multi-select](https://developers.notion.com/reference/property-object#multi-select) fields in Notion.
To resolve this, check the [**Don't sync null values** option](https://docs.hightouch.com/syncs/mapping-data.md#dont-sync-null-values) in the template mapper or [remove rows containing `null` values](https://docs.hightouch.com/models/sql-editor#exclude-rows-with-null-values) from your model's query results.
You need to do this option for all field mappings to [Select](https://developers.notion.com/reference/property-object#select) or [Multi-select](https://developers.notion.com/reference/property-object#multi-select) fields in Notion, if you believe the mapped model columns might contain `null` values.

### 400 - body failed validation \{...} should be a string, instead was \{...}

This error occurs if you try to sync non-text values to a [Text](https://developers.notion.com/reference/property-object#rich-text) field in Notion.
To resolve this, [cast](https://docs.hightouch.com/models/data-types-casting.md#casting-from-your-model-configuration) the relevant column or columns from your model to a **String** type.
