Authenticate with the Python SDK

To use the Roboflow Python SDK, you need to authenticate with your API key.

Using an API Key

import roboflow

rf = roboflow.Roboflow(api_key="YOUR_API_KEY")

Using an Environment Variable

Set the ROBOFLOW_API_KEY environment variable, then initialize without passing the key:

export ROBOFLOW_API_KEY=your_api_key_here
import roboflow
import os

rf = roboflow.Roboflow(api_key=os.environ["ROBOFLOW_API_KEY"])

Finding Your API Key

See Find Your Roboflow API Key for instructions on locating your API key.