> ## Documentation Index
> Fetch the complete documentation index at: https://similarweb-zp8zf.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Snowflake API Integration

> Integrate Similarweb Batch API reports into your Snowflake account.

Store, access, and analyze Similarweb data directly from your Snowflake database, so you can easily perform queries on your custom reports, or automatically integrate them into your own analytics or visualization tools.

<Warning>
  Compatible with Similarweb Batch API only

  To enable access to the Similarweb Snowflake connector, please speak to a Similarweb representative.
</Warning>

## Snowflake integration instructions

<Card title="Snowflake Table Integration" href="#" horizontal icon="snowflake">
  Open Recipe >
</Card>

The screenshots below are taken from Snowflake's latest user interface (UI), Snowsight. If you are using a different version of the UI, your account might look different.

**Step 1**

Retrieve your Snowflake locator ID. This can be found on the platform’s left sidebar.

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/3fd469e4-b32a235-Screen_Shot_2022-11-09_at_10.43.58.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=6f089ddd4b800a8953cde812a412fd57" width="932" height="472" data-path="images/3fd469e4-b32a235-Screen_Shot_2022-11-09_at_10.43.58.png" />
</Frame>

*Note: Your reports can only be shared to 1 Snowflake ID.*

**Step 2**

Retrieve your [Snowflake region](https://docs.snowflake.com/en/sql-reference/functions/current_region) using the following request:

`select current_region()`

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/288fd514-c3ce573-Screen_Shot_2022-11-09_at_10.47.07.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=837a4a7410bbf5214696f519f71a0880" width="998" height="536" data-path="images/288fd514-c3ce573-Screen_Shot_2022-11-09_at_10.47.07.png" />
</Frame>

*Note: we support all snowflake regions.*

**Step 3**

Once you have your Snowflake locator ID and region, use them to set up the integration via a POST request:

URL\
`https://api.similarweb.com/v3/batch/setup-snowflake`

Header\
api-key: \{\{your\_batch\_API\_key}}

Body\
\{\
"snowflake\_account\_id”: "LOCATOR\_ID",\
“snowflake\_region”: “SNOWFLAKE\_REGION”\
}

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/20a53f55-9bfbe99-Screen_Shot_2022-11-09_at_10.49.24.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=c6009b97f81943b27091cc39291d245c" width="920" height="610" data-path="images/20a53f55-9bfbe99-Screen_Shot_2022-11-09_at_10.49.24.png" />
</Frame>

*Note: The name of this share will always be “Similarweb*\{\{your*locator\_id}}”. For example, "Similarweb\_2341515"*

**Step 4**

In your Snowflake account, ensure your role is set to Account Admin.

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/2a1a4170-4fe3a14-Screen_Shot_2022-11-09_at_10.50.39.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=c5dcbd17a67bdacb2377b46206c38f40" width="1044" height="814" data-path="images/2a1a4170-4fe3a14-Screen_Shot_2022-11-09_at_10.50.39.png" />
</Frame>

**Step 5**

Navigate to ‘Data’ > ‘Shared Data’.

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/e28d4ff5-027c106-Screen_Shot_2022-11-09_at_10.51.50.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=5e33f2d8132eb810780f5f6c5945813f" width="302" height="528" data-path="images/e28d4ff5-027c106-Screen_Shot_2022-11-09_at_10.51.50.png" />
</Frame>

Locate the new share, and click ‘Get Data’.

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/f134118f-ea48eae-Screen_Shot_2022-11-09_at_10.52.21.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=168f97cd0873adea9ecdda689be693a7" width="652" height="594" data-path="images/f134118f-ea48eae-Screen_Shot_2022-11-09_at_10.52.21.png" />
</Frame>

\*Note: you can still push data into Snowflake without approving the data share, however, it won’t be visible until approval.

## Requesting reports: First time reports and defining your report structure

**Step 1**

When requesting a Similarweb Batch API report, state where you’d like the data to be delivered via the create-report table. Add the full schema and report query parameters.

Using the create-table endpoint:

`https://api.similarweb.com/batch/v4/integration/create-table`

Add the delivery information to the body, example:

```json theme={null}
{
  "delivery_information": {
    "delivery_method": "snowflake",
    "delivery_method_params": {
      "table_name": "{{table_name}}"
    }
  },
  "report_query": {
    "tables": [
      {
        "vtable": "traffic_and_engagement",
        "granularity": "monthly",
        "all_history": true,
        "filters": {
          "countries": ["WW", "US"],
          "include_subdomains": true,
          "domains": ["amazon.com", "google.com"]
        },
        "metrics": ["desktop_new_visitors", "desktop_returning_visitors"],
        "paging": {
          "limit": 10000000
        }
      }
    ]
  }
}
```

*Note: When the delivery method is set to “snowflake”, the “response\_format” field is not required.*

You should receive “status”: “pending”

**Step 2**

Use the [request report status endpoint](https://documenter.getpostman.com/view/8688131/SWLe78Fo#78f134ec-e1ef-49b8-8528-5e6fdbfb7e9a)to verify the report is complete (“status”: “completed”). The table names will appear in the response (“snowflake\_tables”).

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/be735563-6a7dae9-Screen_Shot_2022-11-09_at_10.58.00.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=bbc7ee071fd9badfc293fad9eb7b3318" width="1216" height="342" data-path="images/be735563-6a7dae9-Screen_Shot_2022-11-09_at_10.58.00.png" />
</Frame>

**Step 3**

In Snowflake, from your Worksheet, use the table name to see the report.

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/abc7dccc-d4edb52-Screen_Shot_2022-11-09_at_10.59.11.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=06d4bb9fa07334faa0a067b188ca650f" width="1254" height="494" data-path="images/abc7dccc-d4edb52-Screen_Shot_2022-11-09_at_10.59.11.png" />
</Frame>

Each report requested will be viewable under Data > Databases

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/eecf5e7c-66a283d-Screen_Shot_2022-11-09_at_10.59.38.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=48629e08127cd76da46d241e1d952cb7" width="1316" height="568" data-path="images/eecf5e7c-66a283d-Screen_Shot_2022-11-09_at_10.59.38.png" />
</Frame>

## Requesting reports - Aggregated recurring tables

To fully automate your analysis, you can request reports to be delivered to pre-defined tables within your Snowflake account. This will allow you to have fresh data sent directly to the same tables, rather than having a new table created each time you request a report. Configure your tables with Tableau, Looker, and other data visualization tools.

**Step 1:**

After defining the table, you can use the request-report endpoint.

The schema cannot be changed from the original table. You can change the filters: domains, countries and dates in order to update the latest data.

POST [https://api.similarweb.com/batch/v4/request-report](https://api.similarweb.com/batch/v4/request-report)

```json theme={null}
{
    "delivery_information": {
        "delivery_method": "snowflake",
        "delivery_method_params": {
            "table_name": "table_name"
        }
    },
    "report_query": {
        "tables": [
            {
                "vtable": "traffic_and_engagement",
                "granularity": "monthly",
                "latest": true,
                "filters": {
                    "countries": [
                        "WW", "US"
                    ],
                    "include_subdomains": true,
                    "domains":[
"amazon.com",
"google.com"
                    ]
                }
                "paging": {
                    "limit": 10000000
                }
            }
        ]
    }
}
```

Once the data is ready, it will be available in your Snowflake table:

<Frame caption="">
  <img src="https://mintcdn.com/similarweb-zp8zf/QQXWocDl1farlVor/images/81cdd19c-c799534-Screen_Shot_2022-11-09_at_11.06.02.png?fit=max&auto=format&n=QQXWocDl1farlVor&q=85&s=2c4bb95dbce5db3eb01f302a82696801" width="1252" height="408" data-path="images/81cdd19c-c799534-Screen_Shot_2022-11-09_at_11.06.02.png" />
</Frame>

In aggregated table reports, a column named "created\_date" is provided. These values are for your reference and do not cost any data points.

<Info>
  Need help?

  For technical assistance, please reach out to your Similarweb Account Manager.
</Info>
