Skip to main content
OpenRouter provides endpoints to programmatically manage your API keys, enabling key creation and management for applications that need to distribute or rotate keys automatically.

Creating a Management API Key

To use the key management API, you first need to create a Management API key:
  1. Go to the Management API Keys page
  2. Click “Create New Key”
  3. Enter a name and choose an expiration
  4. Copy the key when it is shown. You will not be able to see it again
Management keys cannot be used to make API calls to OpenRouter’s completion endpoints - they are exclusively for administrative operations. A management key’s scope and permissions are fixed when it is created. To change either, create a new key and delete the old one.

Expiration

We recommend setting an expiration date on every management key. A leaked management key could create, edit and delete the API keys in your account other than those provisioned by a Connect client, and one with no expiration stays valid until you delete it.
  • The expiration is fixed when the key is created and cannot be changed afterwards. To extend access, create a new key and delete the old one.
  • Once a key’s expiration passes, every request that uses it fails with 401 Unauthorized and the message API key expired. Expired keys still appear on the Management API Keys page until you delete them.
Automations that call the key management API with an expiring management key must be given a new key before the old one expires, or they will start receiving 401 API key expired responses. Schedule rotation ahead of the expiration date shown next to the key.

Scope

A management key is scoped either to the whole organization or to one workspace.

Organization-scoped keys

Organization-scoped keys cover administrative actions across all of the account’s workspaces. For organizations, only Organization Admins can create them, on the Management API Keys page.

Workspace-scoped keys

Workspace-scoped keys act only on their own workspace. To create one:
  1. Open the workspace, go to Keys and select the Management keys tab. Workspace Admins of that workspace can create keys here; Organization Admins can create them in any workspace.
  2. Click “New management key”. The dialog shows which workspace the key is scoped to.
  3. Enter a name, choose an expiration and an access level.
  4. Copy the key when it is shown.
A Workspace Admin can create, list and delete management keys for their own workspace only. They cannot create organization-scoped keys or keys for another workspace. A workspace-scoped key can call only the routes below, and only for its own workspace. When a route takes an optional workspace_id, it defaults to the key’s own workspace. Naming another workspace, or a resource that belongs to one, is refused. Every other route in Routes That Require a Management Key needs an organization-scoped key and returns 403 Forbidden to a workspace-scoped key. This includes listing, creating and deleting workspaces, setting and deleting workspace budgets, credits, organization settings and members, SCIM, private endpoints and providers, external users and datasets.

Workspace members

  • Programmatic Management: Endpoints for managing workspace members (POST /api/v1/workspaces/{id}/members/add), keys, and budgets require a Management API key. Members added via the API automatically inherit their organization role (Org Admins become Workspace Admins; Org Members become Workspace Members).
  • Dashboard UI: Within the OpenRouter dashboard, Workspace Admins can add members on the workspace Members page without requiring a Management API key. Assigning workspace roles there additionally requires a Pro or Enterprise plan.

Permissions

Organizations choose a management key’s access level when creating it, under Access level:
  • Read/write keys can call every management route their scope allows.
  • Read only keys can call every read (GET, and read-only queries such as POST /api/v1/analytics/query) that a read/write key of the same scope can call, and nothing else. Any request that would create, change or delete something returns 403 Forbidden. One exception: GET /api/v1/guardrails/policies/assignments/members/{member_id} and GET /api/v1/guardrails/policies/assignments/api-keys/{hash} need a read/write key, because reading an assignment creates it if it doesn’t exist yet.
Use read-only keys for monitoring, reporting and auditing: listing API keys and their usage, reading activity and analytics, checking guardrails, budgets and BYOK credentials, and listing workspaces and their members.
cURL

Errors

Use Cases

Common scenarios for programmatic key management include:
  • SaaS Applications: Automatically create unique API keys for each customer instance
  • Key Rotation: Regularly rotate API keys for security compliance
  • Usage Monitoring: Track key usage and automatically disable keys that exceed limits (with optional daily/weekly/monthly limit resets)

Example Usage

All key management endpoints are under /api/v1/keys and require a Management API key in the Authorization header.

Response Format

API responses return JSON objects containing key information:
When creating a new key, the response will include the key string itself. Read more in the API reference.

Organization Settings

A management key created in an organization can also read and update that organization’s settings at /api/v1/organization/settings. The organization is the one the key belongs to; it cannot be chosen per request. Currently exposed setting:
  • is_filtered_model_catalog_enabled (default false): the same switch as Settings → Privacy → “Filter the model catalog for API keys”. When enabled, GET /api/v1/models called with one of the organization’s API keys returns only the models that key can use (the /api/v1/models/user catalog), and the signed-in dashboard shows the same list. Requests without a key still receive the public catalog. Which models remain visible is decided by the active workspace’s guardrails and provider preferences; enabling the switch does not change those.
cURL
Both calls return the persisted settings:
Management keys created in a personal account receive 404 Not Found from these routes.

Routes That Require a Management Key

The following documented routes reject regular API keys and must be called with a Management API key.

Analytics

API Keys

BYOK

Credits

External Users

Generations

Guardrail Policies

Guardrails

Observability

Organization

Presets

Private Endpoints

Private Providers

SCIM

Workspaces