Skip to content

Click in-app to access the full platform documentation for your version of DataRobot.

Get started with the API

The DataRobot API provides a programmatic alternative to the web interface for creating and managing DataRobot projects. The API can be used via REST or with DataRobot's Python or R clients in Windows, UNIX, and OS X environments. This guide walks you through setting up your environment and then you can follow a sample problem.

Set up your environment

Using DataRobot APIs, you will execute a complete modeling workflow, from uploading a dataset to making productions on a model deployed in a production environment.

Create a DataRobot API token

Using the API requires an API key, a unique identifier used for authentication. You can use an existing key if you have one, or create a new one.

  1. In the UI, select your user icon and navigate to Developer Tools:

  2. In the API Keys section, click Create New Key. Enter a name for the key and click Save. This activates the new key.

Copy the key into a text file and save it.

Configure API authentication

To authenticate with DataRobot's API, your code needs to have access to endpoint and token from the previous steps. This can be done in three ways:

export DATAROBOT_ENDPOINT=your_endpoint
export DATAROBOT_API_TOKEN=your_api_token

drconfig.yaml is a file that the DataRobot Python and R clients automatically look for.

Both clients look for the file at ~/.config/datarobot/drconfig.yaml.

drconfig.yaml is formatted as:

endpoint=https://...
token=your_token

You can instruct the API clients to look for the file in a different location or under a different name. Therefore, you can leverage this to have multiple config files. For example:

drconfig-us.yaml drconfig-eu.yaml drconfig-trial.yaml

Optional. Be cautious to never commit your credentials to Git.

import datarobot as dr
dr.Client(endpoint='your_endpoint', token='your_api_token')

Test API access

You can test your access to the API by listing DataRobot projects:

import datarobot as dr
dr.Client()
dr.Project.list()
curl --location -X GET "${DATAROBOT_API_ENDPOINT}/projects" --header "Authorization: Bearer ${DATAROBOT_API_TOKEN}"

Retrieve the API endpoint

DataRobot provides several deployment options to meet your business requirements. Each deployment type has its own set of endpoints. Choose from the tabs below:

The default endpoint root for the DataRobot AI Platform Trial and Self-Service users is https://app2.datarobot.com.

The Managed AI Cloud (US) offering is primarily accessed by US and Japanese users. It can be accessed at https://app.datarobot.com.

The Managed AI Cloud (EU) offering is primarily accessed by EMEA users. It can be accessed at https://app.eu.datarobot.com.

For on-premise users, the API root will be the same as your DataRobot UI root. Replace {datarobot.example.com} with your deployment endpoint.

  • UI endpoint (DATAROBOT_ENDPOINT): https://{datarobot.example.com}
  • API endpoint root (DATAROBOT_API_TOKEN): https://{datarobot.example.com}/api/v2
  • In-app platform (UI) documentation: https://{datarobot.example.com}/docs
  • In-app API documentation: https://{datarobot.example.com}/apidocs

Environment variables

Next, create environment variables.

export DATAROBOT_API_TOKEN=<your_api_key>
export DATAROBOT_ENDPOINT=<your_endpoints>

Next steps

Use the API by following a sample problem that outlines an end-to-end workflow for the API.

Learn more

Note

Log in to GitHub before accessing these GitHub resources.


Updated October 1, 2021