Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Authentication and API keys

Get, reset and revoke a Drivetrain API key, and see exactly which of your Drivetrain permissions each API endpoint applies.

Every call to the Drivetrain API carries an API key in the apikey request header. The key belongs to one Drivetrain user, and every call runs as that user.

Before you start

  • Role: you need the Admin role to view or reset an API key, and the key only works while its user has the Admin role.

  • Subscription: your subscription must include Drivetrain API access. Without it, Settings doesn't show API Key and every call returns 401 Unauthorized, even with a valid key. Contact Drivetrain support to enable it.

  • Host: use the host you open Drivetrain on (see Base URL). A key only works on its own workspace's host.

Send the key

Add the apikey header to every request. There's no token exchange, session or Authorization: Bearer header.

curl 'https://{your_subdomain}.drivetrain.ai/drive/api/v1/public/versions' \
  --header 'apikey: {your_apikey}'

Send the key exactly as copied.

Get your API key

  1. Navigate to Settings > API Key.

  2. Under Your API key, the key is masked except for its first and last 4 characters. Click the eye icon (Show key) to reveal it, or click Copy. The button changes to Copied.

API key accessible within Settings
Click on Copy to copy your API key

Drivetrain creates your key the first time you open Settings > API Key. After that you see the same key every time you open it, until you reset it.

About keys

Format

A 32-character string of letters and digits.

Keys per user

One. Each Admin has their own key.

Acts as

The user who owns it. Calls have that user's Drivetrain access (see What the API applies from your permissions).

Scope

No scopes or read-only keys. A key can call every endpoint of the API.

Expiry

None. A key works until it's reset, its user is deactivated or loses the Admin role, or API access leaves your subscription.

Workspace

A key works only in the workspace it was created in.

Treat the key like a password. Anyone who has it can read your data and replace list rows as you.

Reset (rotate) a key

  1. Navigate to Settings > API Key.

  2. Click Reset Key.

The new key replaces the old one immediately, with no confirmation step. Every integration still using the old key starts getting 401 Unauthorized, so update them right after you reset.

Reset only changes your own key. To rotate with no downtime, use a second Admin user's key for the switch-over.

Revoke access

There's no separate revoke button. Depending on whose key it is:

To stop...
Do this
Calls then return

Your own key

Click Reset Key and don't use the new one.

401 Unauthorized

Another user's key

Deactivate the user, or remove their Admin role.

401 (deactivated) or 403 Forbidden (no longer Admin)

If a deactivated user is reactivated, their old key works again. Reset it if it may have leaked.

Create keys from a dedicated Admin user for long-running integrations, so a person leaving or changing roles doesn't break them.

What the API applies from your permissions

Every endpoint checks that the key's user has the Admin role, and returns 403 Forbidden if not. An Admin has access to every version and scenario. Beyond that, each endpoint applies the user's other Drivetrain access differently:

Endpoint
What it applies

Admin role only. Returns every metric.

Admin role only. Returns values for every dimension value, even values the user's roles hide in Drivetrain.

Admin role only. Lists every dimension.

The user needs full access to the dimension. Otherwise 403, never a partial list.

Admin role only. Returns every version.

Returns the scenarios the user can access, which for an Admin is every scenario.

The user needs access to the list. Rows the user can't see aren't returned.

The user needs full access to the list, and no limited access to any dimension that's also a column of the list.

If someone must not see every value, don't give them the Admin role or an Admin's API key.

FAQ

Can a user without the Admin role use the API?

No. Every endpoint returns 403 Forbidden for a key whose user doesn't have the Admin role, and only Admins can view a key.

Can I create a read-only key, or a key for just one endpoint?

No. Keys have no scopes. Of the endpoints in this section, only Upload list CSV API changes data, and it needs full access to the list.

I reset my key by mistake. Can I get the old one back?

No. Copy the new key from Settings > API Key and update every integration that used the old one.

A colleague who set up our integration left. What happens?

When their user is deactivated, their key stops working and calls return 401 Unauthorized. Have another Admin copy their own key into the integration.

Last updated

Was this helpful?