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

Quickstart

Go from an API key to metric values in four calls, with curl and Python examples.

This walk-through pulls quarterly revenue by region for your live model and one budget version. It takes four calls: versions, scenarios, metrics, then values.

Before you start

  • You have the Admin role, and your subscription includes Drivetrain API access. See Authentication and API keys.

  • You know your base URL: https://{your_subdomain}.drivetrain.ai/drive/api/v1/public, or https://{your_subdomain}.eu.drivetrain.ai/drive/api/v1/public for an EU workspace.

1. Get your API key

Navigate to Settings > API Key and click Copy. Store it in an environment variable rather than in your code:

export DRIVETRAIN_API_KEY='{your_apikey}'
export DRIVETRAIN_BASE='https://{your_subdomain}.drivetrain.ai/drive/api/v1/public'

2. Check the key and find version names

curl "$DRIVETRAIN_BASE/versions" --header "apikey: $DRIVETRAIN_API_KEY"

A 200 with a data array means the key works. Note the name of each version you want (for example Budget_2026). Current is your live model. A 401 or 403 means the key, role or subscription isn't right: see Errors and troubleshooting.

3. Find scenario names

curl "$DRIVETRAIN_BASE/scenarios" --header "apikey: $DRIVETRAIN_API_KEY"

Skip this if you only need the base case: Get metrics bulk data API uses Base_Case when you don't send scenarios.

4. Find metric and dimension names

For each metric you want, note:

  • name, for example metrics.Revenue.

  • versions[].dimensions, the dimensions you can break it down by in each version.

  • Whether versions[].name includes Current or Actual. Only those metrics return values.

5. Pull the values

Each row in data is one metric, version, scenario, quarter and region. The response also includes roll-up rows for all regions together, which have no region key. Drop them before you add values up (see Things to check in your results).

The same flow in Python

This example uses the requests library. json= sends the body as Content-Type: application/json, which Get metrics bulk data API requires.

The roll-up filter assumes every requested dimension applies to the metric. If one doesn't, that metric's rows never carry its key. Check versions[].dimensions first.

Read every value of a dimension

Get dimension values API is the only paged endpoint. Request pages until hasMore is false:

Next steps

Last updated

Was this helpful?