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
api.roboflow.comand add your
api_keyto 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.
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_keyin the query string (in the documentation samples we have stored our
api_keyas an environment variable called
ROBOFLOW_API_KEYwhich you could do with
export ROBOFLOW_API_KEY="xxxxxxx"(see below for how to obtain your API key from your account).
/:workspace- the Workspace route gives you information about your workspace and a list of its projects.
/: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.
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.Your model ID;
- 2.Your model version number and;
- 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:
In this case:
license-plate-recognition-rxg4eis the model ID and;
1is the version number.
In the next section, we'll talk about how to retrieve your API key.
For the REST API you will use your workspace's
api_keywhich 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.
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.