Roboflow Docs
DashboardResourcesProducts
  • Documentation
  • Developer Reference
  • Changelog
  • Developer Tools
  • Authentication
  • Command Line Interface (CLI)
    • Using the CLI
    • Installation and Authentication
    • Download dataset
    • Upload Dataset
    • Run inference
    • Getting help
  • REST API
    • REST API Structure
    • Workspace and Project IDs
    • Workspaces
  • Workspace Image Query
  • Projects
    • Initialize
    • Project Folders API
    • Create
  • Batches
  • Annotation Jobs
  • Images
    • Upload Images
    • Image Details
    • Upload Dataset
    • Upload an Annotation
    • Search
    • Tags
  • Versions
    • Create a Project Version
    • View a Version
  • Train a Model
  • Export Data
  • Inference
  • Annotation Insights
    • Annotation Insights (Legacy Endpoint)
  • Model Monitoring
    • Stats
    • Custom Metadata
  • Python SDK
    • Using the Python SDK
  • iOS SDK
    • Using the iOS SDK
Powered by GitBook
On this page
  • Recommended Authentication Flows
  • In a Production Application
  • In a Notebook
  • Retrieve an API Key
  • Create a New API Key
  • Using Your API Key
  • Query Parameter
  • Authentication Header
  • Body Parameter
  • Token Issuance Flow

Was this helpful?

Authentication

PreviousDeveloper ToolsNextUsing the CLI

Was this helpful?

To authenticate with the Roboflow API, you need an API key. You can obtain an API key using our web application or via our token issuance flow, supported by the CLI and Python package.

Recommended Authentication Flows

In a Production Application

If you are using Roboflow in a production application (i.e. scripts, a web application, an API), we recommend using your API key to authenticate with Roboflow.

In a Notebook

If you are using our Python SDK in a notebook, we recommend authenticating using the Token Issuance flow documented below.

Retrieve an API Key

You can retrieve an API key from your Roboflow settings.

First, go to the . In the left navigation bar, click on "Settings" and then "API Keys":

You will be taken to a page with your API keys. API keys are scoped to a workspace, which means you must use the API key associated with a workspace to access that workspace's private projects.

All API keys are scoped to that workspace. However, scoped permissions/access are available as a feature on some plans. See our for more info

On the left sidebar, you will see a list of workspaces. Select the workspace for which you want to issue an API key. Finally, copy your Private API Key.

Be sure to keep this secret. Treat it like a password; it grants the bearer access to your workspace's data and models.

If you ever accidentally expose your key to someone who isn't authorized to access your workspace, click "Revoke API Key". Your API key will be disabled immediately. You can then create a new one.

Create a New API Key

You should already have an API Key automatically generated for you. If you revoked your API key, you can always create a new one using the "Generate Private API Key" button that appears if you do not already have one.

Using Your API Key

Most Roboflow API endpoints require an API key. You can authenticate your request through the api_key parameter in the body and the query, or via an authentication header.

Query Parameter

You can send your API key through a query parameter in the URL of your request.

Example: https://api.roboflow.com?api_key=abcdefghijklmnopqrstuvwxyz

Due to security implications, using a query parameter to authenticate may not be the best practice. For production use cases, we recommend sending your API key via the header.

Authentication Header

You can also send your API key as a bearer authentication header.

Example Header:

Authorization: Bearer abcdefghijklmnopqrstuvwxyz

Body Parameter

You can also send your API key as a parameter within a JSON request body of POST endpoints.

Example JSON Body:

{
    "api_key":"abcdefghijklmnopqrstuvwxyz"
}

Token Issuance Flow

The Roboflow CLI and Python package support token issuance, a convenient way to grant an API key. When you authenticate with roboflow.login() in Python, or roboflow auth in the CLI, you will be given a URL to a page through which you can issue a token to access a workspace.

You will be asked to select a workspace, then given a token for use in the Python package or CLI.

Roboflow dashboard
pricing page