Links

REST API

Programmatic access to your Roboflow projects.
The primary way for humans to interact with Roboflow is the web UI, but sometimes your code needs access to information about your projects, datasets, and models too.
Over time, the REST API will be expanded to have feature parity with the web UI so that you can perform any action via code that you can by hand. But currently, the API contains primarily read-only methods (with the exceptions of the Upload API, the Annotate API, and the Inference API).
For the most part, routes in the API follow the same naming conventions as those in the web app. This means, oftentimes, you can simply change the domain from app.roboflow.com to api.roboflow.com and add your api_key to the URL and receive the information corresponding to that resource in JSON format.
We are working on SDKs to wrap the REST API in the conventions of your favorite programming languages. The Roboflow Python pip package will be released first. If you need examples for other languages, please reach out.

Overview

The data structure in Roboflow is largely hierarchical; the API layout matches this. Workspaces contain Projects which contain Versions which have trained models and are exported in various Formats.
To access the data for a resource, pass your api_key in the query string (in the documentation samples we have stored our api_key as an environment variable called ROBOFLOW_API_KEY which you could do with export ROBOFLOW_API_KEY="xxxxxxx" (see below for how to obtain your API key from your account).

Routes

  • / - the Root route can be used to validate your API Key and find your workspace ID.
  • /:workspace - the Workspace route gives you information about your workspace and a list of its projects.
  • /:workspace/:project - the Project route shows information about a project and its versions.
  • /:workspace/:project/:version - the Version route surfaces information about a version, its trained model (if present), and exported datasets.
  • /:workspace/:project/:version/:format - the Format route is where you go to retrieve a download link for a zipped dataset in a particular export format.

How to Find Your Model ID and Version

To run inference on your model, or to query the Roboflow API endpoints associated with your project, you will need three pieces of information:
  1. 1.
    Your model ID;
  2. 2.
    Your model version number and;
  3. 3.
    Your API key.
To retrieve your model ID, go to the Version page associated with your trained model in the Roboflow dashboard.
At the top of the page, you will see a box that shows the model ID, the version number, and statistics about how the model performs:
The model ID is the text that appears before the forward slash character. The model version number is the number that appears after the forward slash.
You can also find this information by copying the URL of your model, which will something like this:
https://app.roboflow.com/roboflow-universe-projects/license-plate-recognition-rxg4e
In this case:
  1. 1.
    license-plate-recognition-rxg4e is the model ID and;
  2. 2.
    1 is the version number.
In the next section, we'll talk about how to retrieve your API key.

Obtaining Your API Key

For the REST API you will use your workspace's api_key which is available via its settings. You can get to the workspace settings using the drop-down arrow at the top of the Workspace's project list.
Then, select the Roboflow API tab from the settings page's sidebar navigation:
First, navigate to your workspace's settings.
First, navigate to your workspace's settings.
Finally, copy your Private API Key. Be sure to keep this secret. Treat it like a password; it grants the bearer access to all of your workspace's data and models.
Copy your API Key.
If you ever accidentally expose your key to someone who isn't authorized to access your workspace, click "Revoke API Key" and we will disable it. You can then issue a new one.