Skip to main content

Login with API Key

You can authenticate with Modelbit using API keys stored in environment variables.

First, create an API key in Modelbit. Then set two environment variables:

  • MB_API_KEY: Your Modelbit API Key
  • MB_WORKSPACE_NAME: The name of your Modelbit workspace

Your Modelbit workspace name

Your Modelbit workspace name comes from your Modelbit URL. When logged into Modelbit, your URL looks like:

https://app.modelbit.com/w/<WORKSPACE_NAME>/...

For example, if your URL is https://app.modelbit.com/w/science-inc/... your workspace name is science-inc. Workspace names are case-sensitive.

Examples

Here are examples using API keys to authenticate with Modelbit.

Set your API key in Python using os.environ:

import os

os.environ['MB_API_KEY'] = "<KEY>" # Example: "mizAO2tWpi:mszPoa5k..."
os.environ['MB_WORKSPACE_NAME'] = "<WORKSPACE_NAME>" # Example: "science-inc"

After setting your envvars, calls to mb.login() will authenticate automatically.