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

# Metabase

## Overview

The Metabase connector allows Zenskar to integrate directly with your Metabase instance and sync data for analytics and reporting. By connecting Metabase as a data source, Zenskar can automatically retrieve datasets, dashboards, and query results used in your business intelligence workflows.

***

Would you like it tailored more toward *Zenskar analytics usage* (for example, “to populate dashboards and metrics in Zenskar’s Analytics module”)?

## Prerequisites

To connect Metabase as a data source in Zenskar, ensure the following:

### Authentication

To set up a Metabase data source connector in Zenskar, you need:

* Username and password: Used to generate a new session token

* Session token: A token used to authenticate API requests (typically expires every 14 days)

<Callout icon="📑" theme="default">
  If you provide only username and password, Zenskar will generate a session token automatically when running queries. This may trigger security notifications in the user's Metabase account.
</Callout>

### Metabase API URL

* The URL of your Metabase instance API (must use `https://`)
* Example: `https://your-metabase-domain.com/api/`

### Obtain a session token (optional)

You can manually generate a session token using Metabase’s API:

```bash theme={null}
curl -X POST \
-H "Content-Type: application/json" \
-d '{"username": "person@metabase.com", "password": "fakepassword"}' \
https://your-metabase-domain.com/api/session
```

The response includes an `id` field — this is your `session_token`:

```json theme={null}
{"id":"38f4939c-ad7f-4cbe-ae54-30946daf8593"}
```

<Callout icon="🚧" theme="warn">
  Session tokens expire (14 days by default). Update it in Zenskar when expired or configure your Metabase server’s `MAX_SESSION_AGE` environment variable to extend the session duration.
</Callout>

<Callout icon="❗️" theme="error">
  The connector will alert you of an invalid or expired session token by returning a [401 Unauthorized](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401) response status code.
</Callout>

***

## Set up a Metabase data-source connector via Zenskar dashboard

Once the prerequisites are complete, connect Metabase as a data source in Zenskar.

1. Log into your Zenskar dashboard.
2. In the left side bar, click Usage > Data Sources.
3. In the top-right corner, click + ADD DATA SOURCE.
4. On the **Add New Data Source** page, [configure the connector](https://docs.zenskar.com/docs/data-source-connector-for-metabase#configure-the-connector-1).
5. Click on the **SAVE SOURCE** button

### Configure the connector

#### General details

| Field           | Description                                 | Required |
| :-------------- | :------------------------------------------ | :------- |
| **Source Name** | Enter a unique name for this data source.   | Yes      |
| **Source Type** | Select **Metabase** from the dropdown menu. | Yes      |

#### Connector configuration

| Field                     | Description                                                                                             | Required |
| ------------------------- | ------------------------------------------------------------------------------------------------------- | -------- |
| Metabase instance API URL | URL to your Metabase instance API. Must start with `https://`. Example: `"https://localhost:3000/api/"` | Yes      |
| Username                  | Username for authenticating with Metabase                                                               | Yes      |
| Password                  | Password for authenticating with Metabase                                                               | Yes      |
| Session token             | Session token for Metabase authentication                                                               | Yes      |

#### Data source access mode (read-only)

Zenskar replicates data directly from the source to Zenskar’s data infrastructure. The data is periodically synced to maintain freshness. This option is:

* Ideal for small-mid size database (less than 30GB)
* Ideal for periodical data ingestion
* Optimised for quicker invoice generation

***

## Addendum

### Supported streams

Refer to the [Metabase API reference](https://www.metabase.com/docs/latest/api).

| Stream               | Description                            |
| -------------------- | -------------------------------------- |
| Card                 | Export cards (questions) from Metabase |
| Collections          | Export collection metadata             |
| Dashboard            | Export dashboards and metadata         |
| User                 | Export user information                |
| Databases            | Export database metadata               |
| Native Query Snippet | Export SQL snippets saved in Metabase  |

<br />

<br />
