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.

🚧

Compatible with Similarweb Batch API only

To enable access to the Similarweb Snowflake connector, please speak to a Similarweb representative.

Snowflake integration instructions

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.

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

Step 2

Retrieve your Snowflake region using the following request:

select current_region()

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/batch/v3/batch/setup-snowflake

Header
api-key: {{your_batch_API_key}}

Body
{
"snowflake_account_id”: "LOCATOR_ID",
“snowflake_region”: “SNOWFLAKE_REGION”
}

Note: The name of this share will always be “Similarweb{{yourlocator_id}}”. For example, "Similarweb_2341515"

Step 4

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

Step 5

Navigate to ‘Data’ > ‘Shared Data’.

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

*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:

{
    "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 to verify the report is complete (“status”: “completed”). The table names will appear in the response (“snowflake_tables”).

Step 3

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

Each report requested will be viewable under Data > Databases

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

{
    "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:

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

📘

Need help?

For technical assistance, please reach out to your Similarweb Account Manager.