API tokens allow you to connect to Mode’s API programmatically. An API token is used instead of your email address and account password whenever you programmatically authenticate to Mode with basic authentication.
To call the API, you must first create an API access token. Currently, Mode supports two types of access tokens – Workspace API tokens and personal API tokens. Starting in June 2023, you can only create Workspace API tokens, as this is the more secure and therefore recommended way to provide API access. Any personal tokens that were created prior to June 2023 can continue to be used to authenticate with the API; however, we will be fully deprecating personal API tokens in August 2024.
The Workspace API tokens are meant to be used for programmatic management, such as archiving inactive Reports or deleting schedules for stale Reports across your Workspace. These tokens mimic Admin access to the Workspace and only Admins will be able to create and manage them.
See the full documentation for Mode's API here.
Creating an API Access token
Only Admins are able to create Workspace tokens. You can create as many API access tokens as you need. To create one, navigate to your Workspace Settings > Privacy & Security > API. Click the “gear” icon and select “Create new API token.” You will be prompted to add a display name and save the token.
The credentials are comprised of two parts:
- Token: The public component of the credential. Often referred to as the username or access key during authentication.
- Secret: The private component of the credential. Often referred to as the password or access secret during authentication. This is only shown once when creating the token and must be saved somewhere secure before closing the modal.
- Workspace API tokens cannot be used for creating new invites
- Granular permissions are not currently supported with the Workspace API tokens; they allow admin access to the Workspace for now.
For more information on generating and managing Workspace API tokens, see here.
When using personal API tokens, access to resources in the API directly matches your level of permissions in the Mode Workspace you’re calling. Before returning a response, Mode validates every API call against your permissions in that Workspace.
Q: Mode API Rate Limiting
As of today, our API rate limiting is approximately 40 requests every 10 seconds, or 4 requests per second per username. We currently publish two headers:
- X-RateLimit-Limit, which shows the total number of requests allowed for that class of resources.
- X-RateLimit-Remaining, which shows how many requests until you'll be throttled.
Q: How to check which reports are scheduled and viewed
You can loop through every single report in the workspace (the ones in public/private collections, but not other members' personal collections), and check each individual report to see whether it's scheduled. The API documentation on how to get all the reports in your workspace is here.
From there you can see the
view_count property which will allow you to see the view count for an individual report.
Discovery Database Method
You can also use the Discovery Database to obtain the same information for their reporting. The documentation for the Discovery Database can be found here.
Was this article helpful?