For the complete documentation index, see llms.txt. This page is also available as Markdown.

API Key Management API

Create, list, update, protect, disable, roll and revoke workspace API keys with the Roboflow REST API, the roboflow api-key CLI, or the MCP server.

You can manage your workspace's API keys in code: create keys, list and inspect them, rename them, attach metadata, set a rotation schedule, and disable, protect, roll or revoke them. To do the same in the dashboard, see Manage API Keys in the Dashboard.

The roboflow api-key CLI and the Roboflow MCP server use the same endpoints, so an agent can create the key an application needs without anyone copying it from the dashboard.

The secret key value is returned only when you create or roll a key. Every other endpoint returns a non-secret keyId handle and a short prefix. Store the value at creation time, in a secret store or a .gitignore'd .env file.

HTTP API

Authentication

Send a private API key as the api_key query parameter or an Authorization: Bearer header, as on every other endpoint (see Authenticate with the REST API). The key must belong to the workspace in the path. Each endpoint below lists the scope it needs. An unscoped (full-access) key has all of them.

With an OAuth token acting for a user, the user's role must also allow the action. By default only workspace owners and admins can manage API keys. A scoped key or an OAuth token can only grant abilities the caller already has (see Privilege Subset Rules).

List API Keys

Lists the workspace's keys, masked, and the workspace publishable key. Disabled keys are left out unless you pass includeDisabled=true.

List workspace API keys

get

Lists the workspace's API keys with masked metadata, and returns the workspace publishable key. Requires api-key:read. With an OAuth token, the user's role must allow viewing workspace API keys (owners and admins by default).

Authorizations
AuthorizationstringRequired

Roboflow API key or OAuth access token.

Path parameters
workspacestringRequired

Workspace URL slug.

Query parameters
includeDisabledbooleanOptional

Set to true to include disabled keys.

Default: false
includeFoldersbooleanOptional

Set to true to add folder names (folders) to folder-scoped keys.

Default: false
Responses
200

Successful response.

application/json
publishableKeystringRequired

The workspace publishable key, rf_ followed by the workspace id.

get/{workspace}/api-keys
GET /{workspace}/api-keys HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "apiKeys": [
    {
      "keyId": "9f8c1a2b3d4e5f60",
      "name": "production-server",
      "prefix": "abcd",
      "scopes": [
        "model:infer"
      ],
      "folderIds": [],
      "default": false,
      "protected": true,
      "disabled": false,
      "created_on": "2026-06-19T18:24:01.000Z",
      "rotationDueAt": "2027-06-19T12:00:00.000Z",
      "owners": [
        "user_abc123"
      ],
      "created_by": "user_abc123",
      "customMetadata": {
        "env": "prod"
      }
    }
  ],
  "publishableKey": "text"
}

Get a Single API Key

Returns masked metadata for one key, addressed by its keyId.

Get an API key

get

Returns masked metadata for one key. Requires api-key:read.

Authorizations
AuthorizationstringRequired

Roboflow API key or OAuth access token.

Path parameters
workspacestringRequired

Workspace URL slug.

keyIdstringRequired

The key's keyId handle, from the list response. Never the secret key value.

Example: 9f8c1a2b3d4e5f60
Responses
200

Successful response.

application/json
get/{workspace}/api-keys/{keyId}
GET /{workspace}/api-keys/{keyId} HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "apiKey": {
    "keyId": "9f8c1a2b3d4e5f60",
    "name": "production-server",
    "prefix": "abcd",
    "scopes": [
      "model:infer"
    ],
    "folderIds": [],
    "default": false,
    "protected": true,
    "disabled": false,
    "created_on": "2026-06-19T18:24:01.000Z",
    "rotationDueAt": "2027-06-19T12:00:00.000Z",
    "owners": [
      "user_abc123"
    ],
    "created_by": "user_abc123",
    "customMetadata": {
      "env": "prod"
    }
  }
}

Create an API Key

Creates a key. Leave out scopes to give the new key the same access as the credential that calls the endpoint. This works on every plan, so a script behaves the same whether or not the workspace has Advanced API Keys.

Create a workspace API key

post

Creates an API key and returns its secret once in key. Requires api-key:create. The new key can never have more scopes or folders than the caller. Sending a scopes array, folderIds, customMetadata, rotationDueAt or owners requires Advanced API Keys; omitting scopes or sending null does not.

Authorizations
AuthorizationstringRequired

Roboflow API key or OAuth access token.

Path parameters
workspacestringRequired

Workspace URL slug.

Body

Every field is optional. An empty body creates a key with the caller's own scopes and folders. Unknown fields return 400.

namestring · max: 200Optional

Display name for the key.

scopesstring[] · nullableOptional

Limits the key to these scopes. Omitted: the key gets the calling credential's own scopes, on every plan. A full-access caller creates a full-access key. null: an unscoped (full-access) key. The caller must have full access itself. []: a valid key with no abilities, which you can grant scopes to later. A list: exactly those scopes. A section name (ex: model) grants all of that section's scopes. A role preset (ex: role:reviewer, or a custom role's name after role:) expands to that role's scopes, and role:owner means full access. Presets combine with explicit scopes. Sending an array (including []) requires Advanced API Keys.

Example: ["model:infer"]
folderIdsstring[]Optional

Limits the key to these project folders. Omitted, the key gets the caller's folders. A key for every folder needs a caller who can see every folder. A non-empty list requires Advanced API Keys.

protectedbooleanOptional

Creates the key protected. See Protecting a Key.

rotationDueAtstringOptional

Rotation due date as an ISO date or date-time (UTC), strictly in the future (ex: 2027-10-22). The owners get one reminder email in the 15 days before it. Requires Advanced API Keys.

Example: 2027-10-22
ownersstring[] · max: 50Optional

Member ids to remind before rotationDueAt. Omitted while signed in with Advanced API Keys, you become the only owner if you can roll the key yourself from an enabled account with an email address. Omitted with an API key, the list stays empty. Each id must be a member who can roll the key (see List Owner Candidates). An empty list reminds everyone who can roll the key. Requires Advanced API Keys.

Responses
201

Created.

application/json
keyIdstringRequired

The new key's non-secret handle.

keystringRequired

The secret key value. Returned only in this response. Store it now: no endpoint returns it again.

namestringRequired

Display name.

scopesstring[] · nullableRequired

Stored scopes, after role presets and sections expand. null for a full-access key.

folderIdsstring[]Required

Folders the key is limited to.

protectedbooleanRequired

True when the key is protected.

rotationDueAtstring · nullableRequired

Rotation due date, or null.

ownersstring[]Required

Member ids reminded before the due date.

publishableKeystringRequired

The workspace publishable key.

post/{workspace}/api-keys
POST /{workspace}/api-keys HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 107

{
  "name": "production-server",
  "scopes": [
    "model:infer"
  ],
  "rotationDueAt": "2027-10-22",
  "owners": [
    "user_abc123"
  ]
}
{
  "keyId": "9f8c1a2b3d4e5f60",
  "key": "AbCdEf0123456789xyz",
  "name": "production-server",
  "scopes": [
    "model:infer"
  ],
  "folderIds": [],
  "protected": false,
  "rotationDueAt": "2027-10-22T00:00:00.000Z",
  "owners": [
    "user_abc123"
  ],
  "publishableKey": "rf_5f3Tq8k2ZbW1aXyZ"
}

Update an API Key

Changes a key's name, scopes, metadata or rotation schedule, protects it, or disables or re-enables it. Send only the fields you want to change. scopes, customMetadata and owners replace the current values.

Update an API key

patch

Updates a key's name, scopes, metadata or rotation schedule, protects it, or disables or re-enables it. Requires api-key:update. Changing scopes, metadata, disabled, rotationDueAt or owners requires Advanced API Keys.

Authorizations
AuthorizationstringRequired

Roboflow API key or OAuth access token.

Path parameters
workspacestringRequired

Workspace URL slug.

keyIdstringRequired

The key's keyId handle, from the list response. Never the secret key value.

Example: 9f8c1a2b3d4e5f60
Body

Send only the fields you want to change. Omitted fields stay as they are. An empty body or an unknown field returns 400.

namestring · max: 200Optional

New display name. Renaming needs no plan feature.

scopesstring[] · nullableOptional

Replaces the key's scopes. null makes the key full access (the caller must have full access). [] leaves a valid key with no abilities. A list sets exactly those scopes; section names and role: presets expand as on create. The new scopes must be a subset of the caller's. Refused with 409 on a protected key. Requires Advanced API Keys.

Example: ["model:infer","project:read"]
protectedbooleanOptional

Send true to protect the key. false returns 403: you can only unprotect a key in the dashboard.

disabledbooleanOptional

true disables the key, false re-enables it. Disabling a protected key, or a key that backs a Dedicated Deployment, returns 409. Requires Advanced API Keys.

rotationDueAtstring · nullableOptional

Rotation due date as an ISO date or date-time (UTC), strictly in the future (ex: 2027-10-22). The owners get one reminder email in the 15 days before it. null clears it. The key's current date is accepted even when it is already past. Requires Advanced API Keys.

ownersstring[] · max: 50Optional

Replaces the members reminded before the due date. Each id must be a member who can roll the key (see List Owner Candidates). An empty list reminds everyone who can roll the key. Requires Advanced API Keys.

Responses
200

Successful response.

application/json
patch/{workspace}/api-keys/{keyId}
PATCH /{workspace}/api-keys/{keyId} HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 22

{
  "name": "renamed-key"
}
{
  "apiKey": {
    "keyId": "9f8c1a2b3d4e5f60",
    "name": "production-server",
    "prefix": "abcd",
    "scopes": [
      "model:infer"
    ],
    "folderIds": [],
    "default": false,
    "protected": true,
    "disabled": false,
    "created_on": "2026-06-19T18:24:01.000Z",
    "rotationDueAt": "2027-06-19T12:00:00.000Z",
    "owners": [
      "user_abc123"
    ],
    "created_by": "user_abc123",
    "customMetadata": {
      "env": "prod"
    }
  }
}

Revoke an API Key

Revokes a key permanently. Applications that use it fail to authenticate right away.

A key that backs a Dedicated Deployment cannot be revoked. Give the deployment another key first, or roll the key instead. Nothing else blocks the call, so check the dashboard's dependency warning and your own consumers first. Audit Logs record the revoke with the dependencies the key had at the time. They do not record the key's inference or read traffic, so they cannot tell you who still uses it.

Revoke an API key

delete

Revokes the key permanently. Anything that uses it fails to authenticate at once. Requires api-key:revoke.

Authorizations
AuthorizationstringRequired

Roboflow API key or OAuth access token.

Path parameters
workspacestringRequired

Workspace URL slug.

keyIdstringRequired

The key's keyId handle, from the list response. Never the secret key value.

Example: 9f8c1a2b3d4e5f60
Responses
200

Successful response.

application/json
statusstring · enumRequiredPossible values:
keyIdstringRequired

The keyId you sent.

delete/{workspace}/api-keys/{keyId}
DELETE /{workspace}/api-keys/{keyId} HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "status": "revoked",
  "keyId": "9f8c1a2b3d4e5f60"
}

Roll an API Key

Revokes the key and creates its replacement in one call. Dedicated Deployments that run on the old key move to the new one. See Rotate API Keys for when to roll and what to check first.

If a deployment cannot be moved, the call fails with The API key was not rolled (409, 423 or 502) and the old key stays live. A replacement with the same name may have been created and kept active, so list the keys before you retry.

The replacement gets a new keyId, and nothing links it to the old key afterwards. Store keyId and revokedKeyId from the response if you need to trace the rotation. The old key stops working as soon as the call returns.

Roll an API key

post

Revokes the key and creates its replacement in one call, and returns the new secret once in key. The replacement keeps the key's name, scopes, folders, metadata and disabled state, and Dedicated Deployments on the key move to it. Requires both api-key:revoke and api-key:create, and the caller must hold at least the key's scopes and folders.

Authorizations
AuthorizationstringRequired

Roboflow API key or OAuth access token.

Path parameters
workspacestringRequired

Workspace URL slug.

keyIdstringRequired

The key's keyId handle, from the list response. Never the secret key value.

Example: 9f8c1a2b3d4e5f60
Body

Optional rotation schedule for the replacement. Send no body to carry the old key's schedule over. Both fields require Advanced API Keys.

rotationDueAtstring · nullableOptional

The replacement's rotation due date (ISO date or date-time, UTC, in the future), or null for none. Omitted, the replacement is due the same number of days after the roll as the old key was after its creation, up to one year. A key without a date stays without one.

ownersstring[] · max: 50Optional

The replacement's owners. Omitted, the old key's owners carry over. An empty list reminds everyone who can roll the key.

Responses
200

Successful response.

application/json
keyIdstringRequired

The replacement's new handle. Nothing links it to the old key afterwards, so store both ids if you need to trace the rotation.

keystringRequired

The replacement's secret value. Returned only in this response.

namestringRequired

Display name, kept from the old key.

scopesstring[] · nullableRequired

Scopes, kept from the old key. null for full access.

folderIdsstring[]Required

Folders, kept from the old key.

protectedbooleanRequired

Always false: a protected key cannot be rolled.

disabledbooleanRequired

True when the old key was disabled. A disabled key rolls to a disabled key.

rotationDueAtstring · nullableRequired

The replacement's rotation due date, or null.

ownersstring[]Required

The replacement's owners.

revokedKeyIdstringRequired

The keyId of the key that was revoked.

post/{workspace}/api-keys/{keyId}/roll
POST /{workspace}/api-keys/{keyId}/roll HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 55

{
  "rotationDueAt": "2027-10-22",
  "owners": [
    "user_abc123"
  ]
}
{
  "keyId": "0a1b2c3d4e5f6071",
  "key": "NewSecretValue0123456789",
  "name": "production-server",
  "scopes": [
    "model:infer"
  ],
  "folderIds": [],
  "protected": false,
  "disabled": false,
  "rotationDueAt": "2027-10-22T12:00:00.000Z",
  "owners": [
    "user_abc123"
  ],
  "revokedKeyId": "9f8c1a2b3d4e5f60"
}

List Owner Candidates

Lists the members who can roll a key. Only these members can be a key's owners on create, update or roll. Call it before you set owners, so the rotation reminder reaches someone who can act on it.

List members who can own an API key

get

Lists the members who can roll a key, which are the only members you can set as its owners. Requires api-key:create or api-key:update, and Advanced API Keys. You must be able to grant the key's folders.

Authorizations
AuthorizationstringRequired

Roboflow API key or OAuth access token.

Path parameters
workspacestringRequired

Workspace URL slug.

Query parameters
keyIdstringOptional

The keyId of an existing key. Do not send with folderIds.

Example: 9f8c1a2b3d4e5f60
folderIdsstringOptional

Folder ids for a key you are about to create, comma-separated or repeated. Do not send with keyId. Send neither for a key that reaches every folder, which needs a caller who can see every folder.

Example: folderA,folderB
Responses
200

Successful response.

application/json
get/{workspace}/api-keys/owner-candidates
GET /{workspace}/api-keys/owner-candidates HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "members": [
    {
      "uid": "user_abc123",
      "email": "ada@example.com",
      "name": "Ada"
    }
  ]
}

Protecting a Key

A protected key cannot be disabled, revoked or rolled from the API, the CLI, the MCP server or the dashboard, and its scopes cannot change, until someone unprotects it. Use it to stop an automated agent from taking down a production key by mistake.

  • Protect: send { "protected": true } to Update an API Key.

  • Unprotect: only in the dashboard. The API, CLI and MCP server cannot unprotect a key, so a compromised or careless agent cannot remove the protection and then revoke the key.

The Publishable Key

Every workspace has a publishable key of the form rf_<workspaceId>. It is:

  • Not a secret: you can put it in browser code (ex: inferencejs).

  • Limited to inference and model downloads: it cannot manage data, train, or manage keys.

  • Permanent: it comes from the workspace ID, so you cannot create, rotate or revoke it.

The list and create responses include it as publishableKey, or you can read it on its own:

Get the workspace publishable API key

get

Returns the workspace publishable key. Requires workspace:read. A folder-scoped key gets 404: read publishableKey from the list or create response instead.

Authorizations
AuthorizationstringRequired

Roboflow API key or OAuth access token.

Path parameters
workspacestringRequired

Workspace URL slug.

Responses
200

Successful response.

application/json
publishableKeystringRequired

rf_ followed by the workspace id. Not a secret: it can only run inference and download models.

get/{workspace}/api-keys/publishable
GET /{workspace}/api-keys/publishable HTTP/1.1
Host: api.roboflow.com
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
  "publishableKey": "rf_5f3Tq8k2ZbW1aXyZ"
}

Use the publishable key for browser and edge inference, and a scoped private key for server work. Anyone with the publishable key can run inference with and download the workspace's models. That is the intended trade-off.

Privilege Subset Rules

A key you create or update can never have more abilities than the credential that creates it:

  • With a scoped private key, the new key's scopes must be a subset of the calling key's scopes, and its folderIds a subset of the calling key's folders. An unscoped (full-access) key can grant anything.

  • With an OAuth token acting for a user, the requested scopes are also checked against that user's role. You can only grant abilities your role allows.

  • A key for all folders (no folderIds) needs a user who can see every folder. Workspace owners without All Folder Access must list the folders the key can reach. This also applies when you create a key in the web app.

Requests that go past what the caller can grant return 403.

Errors

Each endpoint above lists its error statuses. Two things apply to all of them:

  • A credential that lacks the route's scope gets 404, not 403, so Roboflow does not reveal whether the resource exists. A 403 means the caller can manage keys but asked for more than it has, or the plan lacks Advanced API Keys.

  • There are two error body shapes. Most errors return a string, {"error": "Some message"}. The authentication layer returns an object, {"error": {"message": "...", "type": "...", "hint": "..."}}, for a missing or invalid key (401) and for a missing scope or wrong workspace (404). Handle both.

See Errors and Status Codes for the general error format.

CLI

The roboflow api-key command group lets you manage your workspace's API keys from the terminal. It wraps the API key REST endpoints and uses the workspace and credentials from your CLI config (see Install and Set Up the CLI).

The full secret value is shown only when you create or roll a key. Capture it immediately: list and get never reveal it again. The roll command and the rotation flags on create and update need roboflow 1.7.3 or later.

Command
Description

list

List the workspace's API keys.

get

Show details for one key.

create

Create a new key (prints the secret once).

update

Update a key's name, scopes, metadata or rotation schedule.

protect

Mark a key as protected.

disable

Disable or re-enable a key.

revoke

Permanently revoke a key.

roll

Revoke a key and create its replacement (prints the new secret once).

publishable

Print the workspace publishable key.

Add --json (a global flag, before the command) to get machine-readable output for scripting, e.g. roboflow --json api-key list.

List keys

Get one key

Keys are addressed by their keyId (the non-secret handle shown in list):

Create a key

The secret is printed once. To capture it in a script, use --json and pipe to jq:

Update a key

--scope replaces the key's existing scopes with exactly the set you pass, --metadata replaces the key's metadata, and --owner replaces its owners. --clear-owners leaves the list empty, so everyone who can roll the key is reminded. Send --name on its own to rename without touching the rest.

Protect / unprotect a key

A protected key cannot be disabled, revoked or rolled via the CLI, API, or MCP. Unprotecting can only be done in the dashboard. There is intentionally no unprotect command, so an automated workflow cannot remove the safety and revoke a production key in one step.

Disable / re-enable a key

Disabled keys are rejected by the API but can be re-enabled. A protected key cannot be disabled.

Revoke a key

Revoking is permanent. A protected key cannot be revoked from the CLI: unprotect it in the dashboard first. A key that backs a Dedicated Deployment cannot be revoked until the deployment gets another key.

Roll a key

Rolling revokes the key and creates its replacement in one step. The replacement keeps the old key's name, scopes, folders and metadata, and the old value stops working immediately. If a Dedicated Deployment cannot be moved to the replacement, the command fails with "The API key was not rolled", the old key stays live, and a replacement may already exist, so run list before retrying. Omit --rotation-due-at and --owner to carry the old key's schedule over. Capture the new secret from the output, or with --json:

A protected key cannot be rolled from the CLI: unprotect it in the dashboard first. A key can be rolled once. Afterwards its keyId is no longer found, and the replacement's keyId in list carries no link back to it, so record both ids from the roll output. See Rotate API Keys for the full cutover procedure.

Get the publishable key

The publishable key (rf_<workspaceId>) is non-secret and safe to embed in browser / inferencejs code. It is inference-only and cannot be created or revoked. See The Publishable Key for details.

MCP Server

Connect your AI agent to the MCP Server and it can manage API keys with these tools:

Tool
Description

api_keys_list

List all API keys for the workspace.

api_keys_get

Get metadata for a single key.

api_keys_get_publishable

Get the workspace's publishable key.

api_keys_create

Create a new API key.

api_keys_update

Update a key's name, scopes, metadata or rotation schedule.

api_keys_protect

Mark a key as protected.

api_keys_disable

Disable or re-enable a key without revoking it.

api_keys_revoke

Permanently revoke a key.

api_keys_roll

Revoke a key and create its replacement in one step. Returns the new secret once.

api_keys_owner_candidates

List the members who can roll a key, so an agent only sets owners the reminder can reach.

The MCP Server cannot unprotect a key. A protected key stays protected until a person unprotects it in the dashboard.

api_keys_create and api_keys_roll return the new secret to the agent, so it ends up in that agent's conversation and logs. Treat those transcripts as sensitive, or create keys from the dashboard instead.

Last updated

Was this helpful?