8 minutes

Automate admin work with management keys

Create a management key for a script that sets up workspaces, members, budgets, and keys, and plan its rotation.

When your team grows, setting up each new group by hand gets slow: create a workspace, add its people, set its budgets, and issue its keys. A management key lets a script do that work. It can’t call models. It only manages your account.

Organization admins create management keys on the Management API keys page. A management key covers every workspace in the account, so treat it like an admin password.

With a management key in the Authorization header, a script can:

  • Create and update workspaces, and add or remove their members.
  • Set each workspace’s budgets.
  • Create, update, and delete API keys under /api/v1/keys.
  • Manage guardrails, BYOK provider keys, and organization settings.
Shell
curl https://openrouter.ai/api/v1/workspaces \
  -H "Authorization: Bearer $OPENROUTER_MANAGEMENT_KEY"

You can use the same key with the OpenRouter Terraform provider to manage workspaces, API keys, guardrails, and BYOK keys as code.

Check your understanding

Each time your company signs a new customer, you want a script to create a workspace for them, set a monthly budget, and issue the API key their integration uses. Which key does the script use?

Set an expiration on every management key. A leaked one can create and delete keys across your whole account, and a key with no expiration works until someone deletes it. The expiration can’t be changed later, so put rotation on the calendar: create the new key, update the script, then delete the old one. After the date passes, every call returns 401 with API key expired.

Apply it

Your setup script has run on a management key for a year, and the engineer who created it is leaving. What do you do?

Takeaway

Management keys let scripts set up workspaces, members, budgets, and API keys. They can’t call models. Only organization admins create them, and every one should have an expiration with rotation planned before it passes.