Organization API keys and scopes

An organization API key lets a system call the Cesura API on behalf of your organization, without a person signing in. Each key holds one or more scopes, and each scope opens one API and nothing else.

Scopes

Scope Label on the API Keys page What it allows
llm_credentials.read Read the AI key's status Read your OpenRouter key's limit and state. See Read your OpenRouter key's status.
license.read Read the license counts Read your license usage, never a student. See Read your license usage.
budgets.read read course budgets under one node Read one part of the budget tree and what it spent. See The budget tree API.
budgets.categories.write manage budget categories Create, change, move, and delete nodes in the budget tree.
spaces.licenses.write Issue space licenses Issue licenses for your organization's spaces. This guide does not cover it.

The labels are quoted as the page shows them.

Combine scopes on one key

You can check several scopes on one key. One scope is the exception:

  • llm_credentials.read must be the key's only scope, and the key must expire within 1 year. The API refuses a key that combines it with another scope, or that never expires. Checking it on the API Keys page clears the other scopes.

So a dashboard that shows the OpenRouter key, the license, and the budget tree needs two keys: one with llm_credentials.read, and one with the other scopes it uses.

Limit a budgets key to one node

When you check budgets.read, the dialog asks which node the key is Limited to. The key then reads that node and everything under it, and nothing else. A key with budgets.read must have a node, and a key without budgets.read cannot have one. The API refuses either with BUDGET_KEY_NODE_REQUIRED.

The Create API Key dialog with Name, Expiration, and Scopes. budgets.read and budgets.categories.write are checked, and Limited to shows a node.

The node limits writes too. A key with both budgets.read and budgets.categories.write changes only nodes under its node. A key with budgets.categories.write alone has no node, so it can change the whole tree but reads no spend. See The budget tree API.

Expiration

Choose 7 days, 30 days, 90 days, 1 year, or Never. An expired key gets 401 INVALID_ORG_API_KEY. Plan to create the next key before the current one expires, and switch your integration over before you revoke the old one.

Send the key

Send the key in the Authorization header of every request:

Authorization: Bearer sk_org_live_...

Every endpoint takes your organization's ID in its path. It must be the key's own organization: any other ID gets 404 ORGANIZATION_NOT_FOUND, before Cesura checks the scope.

See and revoke keys

The API Keys page lists each key's Name, Prefix, Scopes, Created, Last used, and Expires. Use Last used to find keys nobody uses any more. Revoking a key takes effect at once and cannot be undone.

An organization can hold 20 active keys. Creating another gets 400 MAX_ORG_API_KEYS_EXCEEDED: revoke a key you no longer use first.

Errors when a key is refused

Status code Cause
401 ORG_API_KEY_REQUIRED The request has no organization key.
401 INVALID_ORG_API_KEY The key is wrong, revoked, or expired.
401 ORG_KEY_NOT_ALLOWED The endpoint does not take organization keys, for example the budget owners endpoints.
403 INSUFFICIENT_SCOPE The key does not hold the scope the endpoint needs. details.required names it.
404 ORGANIZATION_NOT_FOUND The organization ID in the path is not the key's organization.
503 API_KEY_AUTH_UNAVAILABLE Cesura could not check the key. Retry later.

For the error body and how to handle it, see Errors.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.