Skip to main content
scope_denied means the credential was accepted but is not allowed to call this route. Read this page when a key that works on one route is refused on another.

What happened

Routes: every protected route under /v1/. Each route needs a scope, and the credential does not hold it. The message names the missing scope in its wire form, for example runs_write. The message says “session” for API keys too; the meaning is the same. Where the scopes come from:
  • An API key holds exactly the scopes chosen when it was created. They never change.
  • A console session holds the scopes of your role in the organization.
On POST /v1/runs the scope is checked after the body is parsed. A malformed body gets invalid_body first.

How to fix

  1. Read the scope name in the message.
  2. For an API key: create a new key that includes that scope, deploy it, then revoke the old key. A key’s scopes cannot be edited. You can only grant scopes you hold yourself.
  3. For a console session: the scopes come from your role. Use an account whose role holds the scope. Buying credit, for example, needs billing_write, which owners, admins and the billing role hold.
  4. Keep keys narrow. A service that only sends runs needs runs_write and runs_read, nothing more.

Example

Creating a replacement key with the missing scope. The call needs keys_write, and you must hold every scope you request.