Authentication
Access to Supermetrics API is through an API key along with a valid Supermetrics API license. Please see the Getting Started page for more details on paid licenses to Supermetrics API. You can also follow the steps below and get started immediately.
Creating an API key
If you do not have an account with Supermetrics, you will need to create an account by logging into the Supermetrics Hub with your Google or Microsoft account.
Navigate to the Query Manager in the Supermetrics Hub.
Click on a data source name (such as Google Analytics) to log in to an account, or choose an already connected data source. If you do not have a license, we will automatically enroll you in our trial program.
Select at least one data source account. Depending on the data source, this can mean properties such as ad accounts, views, or pages.
Select at least one field as a metric, or as a field to split by.
Your API key should now be visible in the composed query URL area.
Using an API key
Supermetrics API expects an api_key parameter to included into a request.
https://api.supermetrics.com/enterprise/v2/query/data/json?json={
"api_key":"<your api key>"
}
You can also use the Authorization header instead of the parameter.
Authorization: Bearer <your api key>
Secure your API key
An API key provides access to all the data sources you have connected to. It is important you store this API key securely. Please adhere to the following practises.
Do not store your API key into applications or other places where it could be exposed to unintended parties.
Whenever possible, use the Authorization header to transmit the API key.
When an application only needs access to data from a single query, use a short url. Access is more restricted, and the API key is not visible.
In case your API key ever gets compromised, please invalidate the API key immediately from the Query Manager by removing access to that data source account under “Selected data source”. If that functionality is not available to you, please contact us for further instructions.
Enhanced features
Managing multiple API keys, custom CORS headers, IP restrictions and other enhanced features are subject to license restrictions. Please contact us for more information.
Best practices
- Use the Authorization header instead of the api_key parameter.
- Prefer to use short urls whenever you can.
Resources
→ How to use Query Manager »
→ Support options »