# Import from Metabase

URL: https://www.digia.tech/docs/user/connect-your-data/metabase

Connect Metabase to Digia Engage and import a saved question or model as an audience, with optional columns as properties.

This guide connects Metabase to Digia Engage and imports a **saved question or model** as an audience. Each row the question returns is one person. Digia runs the question every hour, so the audience follows your data without any exports.

Use this when your audience lives in your database or warehouse: write the query once in Metabase, and Digia keeps it in sync.

By the end, you should have:

- Metabase connected under **Data → Connectors**
- a saved question imported as an audience, matched to your app users by one of its columns
- optionally, other columns such as `plan` available in campaign text

## Before you start

Make sure you have:

- Audiences enabled for your Digia Engage project (see [Before you start](/docs/user/connect-your-data/#before-you-start) ).
- A Metabase that is reachable over `https://` from the internet, such as Metabase Cloud.
- **Admin** access in Metabase, to create an API key.
- A **saved question or model** that returns one row per person, with a column holding the **same user ID your app passes to `setUserId`** .
- To import properties: [user verification](/docs/user/connect-your-data/#turn-on-user-verification) turned on.
tip
Keep the question focused: one row per user, the ID column, and only the columns you want as properties. Digia reads every row each hour, so a question that takes a long time to run may time out.

## Step 1: Create a Metabase API key

1. In Metabase, go to **Admin → Settings → Authentication → API keys** .
2. Create a key and put it in a **group that can view the collection** holding your question.
3. Copy the key. It starts with `mb_` and is shown only once.
Screenshot coming soon
Metabase: creating an API key and choosing its group. Until then, see Metabase's guide to [API keys](https://www.metabase.com/docs/latest/people-and-groups/api-keys) .

## Step 2: Connect Metabase in Digia

1. Open **Data → Connectors** .
2. On the **Metabase** card, click **+ Connect** .
3. Enter your **Metabase URL** , for example `https://yourcompany.metabaseapp.com` .
4. Paste the **API key** .
5. Click **Connect** .
![Connect Metabase dialog with Metabase URL and API key fields](/docs/img/engage/user-guides/data/metabase-connect.webp) Digia checks the URL and key against Metabase before saving the connection.Digia checks the details against Metabase before it saves them. When they work, you see *Metabase connected. Import a question now, or come back to it later.* , and the question list opens.

## Step 3: Choose a question

Pick the saved question or model to import and click **Continue** . The list shows every question and model the API key's group can view. A question that is already imported shows **Already imported** .

Screenshot coming soon
Digia: the **Choose a question** step listing Metabase saved questions and models.

tip
Seeing *No saved questions or models are visible to this API key* ? Save the question in Metabase, or give the key's group view access to its collection.

## Step 4: Choose the user ID column and properties

1. Under **User id column** , choose the column that holds the same value your app passes to `setUserId` . Rows without a value are left out and counted.
2. Optional: pick other columns to import as properties, and name each one. The name is what you type in campaign text, for example `{{plan}}` .
3. Click **Import "{question}"** .
Screenshot coming soon
Digia: the **Import properties** step with **User id column** and the property picker.

## Step 5: Check the audience

Open **Data → Audiences** . After the first sync, the audience shows its size and how many of its people match an app user.

Digia runs the question **every 60 minutes** . To sync right away, click **Sync now** on the row.

Now [use the audience in a campaign](/docs/user/connect-your-data/#use-your-data-in-a-campaign) .

## Troubleshooting

| Message | What to do | **The Metabase URL must start with https://** | Use the `https://` address of your Metabase. | **Metabase rejected the API key** | The key is wrong or revoked. Create a new one under **Admin → Settings → Authentication → API keys** . | **The API key's group cannot view Metabase question {id}** | Give the key's group view access to the collection that holds the question. | **Metabase question {id} was not found** | The question was deleted. Delete the audience in Digia, or import another question. | **Metabase question {id} took too long to run** | Add filters or simplify the question, then click **Sync now** . | **Column "{x}" not found in the question's columns** | The ID column was renamed or removed from the question. Restore it, or import the question again. | **Metabase rate limit reached** | Click **Sync now** in a few minutes. | **Could not reach Metabase with those details** | Check the URL is reachable from the internet.
