Skip to main content
Version: Dev

Roles and Permissions

Roles control what a member can see and do in the dashboard and the AISIX Cloud Admin API. A role is a list of rules. Each rule grants actions on some resource types, optionally limited to some environments and to some objects inside them.

Members hold roles directly, and teams hold roles that every member of the team receives. A member can hold several roles. What they add up to is the member's effective permission, which the member can check on the My permissions page.

Fine-grained, rule-based roles are available in AISIX Enterprise and AISIX Cloud starting with control plane 1.11.0.

Roles govern who can configure the gateway through the control plane. API key settings separately determine which models and tools a key can call and which budgets apply to its traffic.

For worked examples, such as letting regular users see only their own keys or isolating departments that share environments, see Typical Access Scenarios.

How Permissions Work​

A rule has up to four parts:

  • Resource types: one or more types, such as models or api_keys. One rule covers either environment resources or organization resources, never both. Use a second rule for the other group.
  • Actions: read, create, update, and delete.
  • Environments: on environment resources only. The rule applies in all environments, in specific environments, or in the environments that carry every listed tag.
  • Objects: optional. Without it, the rule covers every object of its types. With it, the rule covers specific objects, the objects that carry every listed tag, or, for API keys and usage only, the keys assigned to the member or to their teams.

This rule lets its holder read the API keys assigned to them or to their teams in one environment, together with the usage those keys produce:

{
"resources": ["api_keys", "usage"],
"actions": ["read"],
"environments": {"ids": ["6b1c2c1e-0000-4000-8000-000000000002"]},
"selector": {"assigned_to": ["self", "my_teams"]}
}

Rules, roles, and role assignments add up: a member can do what any rule of any role they hold allows. Nothing denies, so a role can only add access. A member who holds no role has no access.

Actions​

The action of a request follows its HTTP method: GET is read, POST is create, PUT and PATCH are update, and DELETE is delete. A POST that acts on an existing object, such as rotating an API key, approving an MCP server, or running a test panel, is an update of that object.

Some types have fewer actions. For example, usage can only be read, and playground can only be used, which counts as create. A rule may list an action that one of its types lacks; that action is simply not granted for that type. A rule whose actions apply to none of its types is rejected.

Environments​

A rule on environment resources must say where it applies:

ValueApplies to
"all"Every environment, including environments created later.
{"ids": [...]}The listed environments.
{"tags": {...}}The environments that carry every listed tag pair.

Environment tags are the Access tags on the environment's create and edit forms. A rule by environment tag follows the tags: tagging a new environment stage=test brings it under every rule that selects stage=test.

Rules on organization resources, such as provider keys or teams, have no environments.

A rule on environment resources does not let its holder see the environment itself. The environment list and the environment switcher show only the environments a member can read through a rule on environments. Add a rule that reads the environments the member works in. Otherwise the member reaches those resources only through the Admin API. The role form warns about this case.

Object Scope​

Without an object scope, a rule covers every object of its types in its environments. Models, API keys, and usage, and on the organization level environments, provider keys, MCP servers, A2A agents, and teams, can be narrowed further:

SelectorPicksAvailable on
{"ids": [...]}The listed objects.Every type that takes a selector.
{"tags": {...}}The objects that carry every listed tag pair.Every type that takes a selector.
{"assigned_to": [...]}The API keys assigned as listed. Any listed relation matching is enough.api_keys and usage.

The assigned_to relations are:

  • self: keys whose member is the caller.
  • my_teams: keys bound to one of the caller's teams and to no member. A teammate's personal key is not included.
  • led_teams: every key bound to a team the caller leads, whatever its member.

For usage, the selector picks the API key that made the request. The key's current tags and assignment decide, so when a key gets new tags or moves to another team, all its past usage moves with it.

An ids selector and an environment restriction on the same rule both apply: the rule covers the listed objects only when they are in its environments.

Objects carry tags as follows:

  • API keys and teams use their cost attribution tags.
  • Environments, models, provider keys, MCP servers, and A2A agents have Access tags. They use the organization's declared tag keys and value rules, are not sent to the gateway, and do not take part in cost attribution.

A tag key must be declared before a rule can use it.

Create and Update Under an Object Scope​

For read, update, and delete, the object scope picks existing objects. For create, it constrains the new object instead:

  • With a tag selector, the new object must carry every listed tag.
  • With assigned_to: self, the new key's member must be the caller.
  • With assigned_to: my_teams, the new key must be bound to one of the caller's teams and to no member.
  • With assigned_to: led_teams, the new key must be bound to a team the caller leads.

A create that breaks the constraint returns 400. A new object has no ID yet, so a rule cannot combine create with an ids selector. Put create in a rule of its own.

An update must leave the object in scope. The object has to be in scope both before and after the change, so a member who can edit models tagged dept=payments cannot remove that tag, and a member who manages their own keys cannot hand one to someone else.

Resource Types​

The table lists every type a rule can name, with the label the dashboard shows. GET /roles returns the same list in its resources field, with each type's scope, actions, and selectors.

TypeDashboard labelActionsSelectors
Environment resources
modelsModelsread, create, update, deleteids, tags
api_keysAPI keysread, create, update, deleteids, tags, assigned_to
usageUsagereadids, tags, assigned_to
guardrailsGuardrailsread, create, update, deletenone
cache_policiesCache policiesread, create, update, deletenone
rate_limitsRate limitsread, create, update, deletenone
observability_exportersObservability exportersread, create, update, deletenone
passthrough_routesPassthrough routesread, create, update, deletenone
oidc_providersOIDC providersread, create, update, deletenone
claim_mappingsClaim mappingsread, create, update, deletenone
mcp_policyMCP policyread, update, deletenone
gateway_certificatesGateway certificatescreatenone
dp_nodesData plane instancesreadnone
playgroundPlaygroundcreatenone
Organization resources
environmentsEnvironmentsread, create, update, deleteids, tags
provider_keysProvider keysread, create, update, deleteids, tags
mcp_serversMCP serversread, create, update, deleteids, tags
a2a_agentsA2A agentsread, create, update, deleteids, tags
teamsTeamsread, create, update, deleteids, tags
mcp_server_credentialsMCP server connectionsread, deletenone
mcp_server_submissionsMCP server submissionscreate, updatenone
team_mcp_entitlementsTeam MCP entitlementsread, updatenone
budgetsBudgetsread, create, update, deletenone
model_pricingModel pricingread, update, deletenone
auditAudit logreadnone
data_exportData exportreadnone
notification_channelsNotification channelsread, create, update, deletenone
membersMembersread, create, update, deletenone
role_assignmentsRole assignmentscreate, deletenone
member_passwordsSet-password linkscreatenone
tag_keysTag keysread, create, update, deletenone
admin_tokensAdmin tokensread, create, deletenone
billingBillingread, updatenone
organizationOrganization settingsread, update, deletenone
ssoSSOread, update, deletenone
rolesRolesread, create, update, deletenone

AISIX Enterprise has no billing type, and AISIX Cloud has no data_export type. Set-password links exist only in AISIX Enterprise.

A few types need a closer look:

  • teams update includes changing a team's members, and every member of a team holds the team's roles. See Who Can Change Access.
  • api_keys read includes a key's budget status.
  • budgets covers budgets, budget state, and budget alerts. Reading the budget annotations on Cost Analysis groups also takes budgets read.
  • admin_tokens create and delete, minting and revoking admin tokens, are for the owner role only. No custom role can grant them: saving a role that lists them returns 400 with the error code INVALID_REQUEST, and the role editor shows them disabled and says why. A custom role can hold admin_tokens read.
  • members delete covers both removing a member and revoking an invitation. Removing a member also needs the owner role, while revoking an invitation does not, so a custom role can still hold members delete.
  • Some operations need a built-in role on top of the permission. They are listed under Built-in Roles.

Built-in Roles​

Every organization has four built-in roles. They cannot be edited or deleted, but Clone on the Roles page starts a custom role from their rules.

RoleGrants
Owner (owner)Every action on every type, and the owner-only operations below.
Admin (admin)Every action on every type except role_assignments and the owner-only admin_tokens create and delete. This includes defining roles and issuing set-password links.
Member (member)read on every type that can be read except the audit log, data export, notification channels, MCP server connections, and SSO, in all environments.
Restricted Member (restricted_member)read on api_keys and usage in all environments, limited to the keys assigned to the member, to their teams, and to the teams they lead. Nothing else.

Restricted Member is the default for new members: an invitation that names no role, a directly created member whose roles are left at the default, a new organization's SCIM default role, and a new SSO connection's default role. A Restricted Member cannot read environments, so their environment switcher is empty and the dashboard asks them to contact an administrator. Give them another role, such as one that reads environments, to let them browse their keys in the dashboard. Without one, they see the usage of their keys across environments on Cost Analysis; the Usage page also needs environments read.

Some operations take a built-in role in addition to the permission:

  • Only an owner can remove a member, mint or revoke admin tokens, change the SSO connection, delete the organization, manage its domains, change the password and two-factor policies, download a full data export, add or remove the owner role, and issue a set-password link for an owner.
  • Only a built-in owner or admin can change the SCIM settings, and invite someone with the admin role or a custom role.
  • At least one owner must remain. Single sign-on and directory sync never grant owner, and a team cannot hold it.

Create a Custom Role​

A custom role is an organization's own list of rules. Its name is permanent, because assignments reference it by name.

In the Dashboard​

  1. Open Roles and select New role. To start from a built-in role, select Clone on it instead.
  2. Enter a Name, a lowercase slug such as auditor, and an optional Description.
  3. Select Add rule, then fill in the rule card:
    1. Under Resource types, choose types from Environment resources or Organization resources.
    2. Under Actions, choose the actions. Only the actions the chosen types have are offered.
    3. For environment resources, choose All environments, Specific environments, or By environment tag under Environments.
    4. Under Objects, keep All objects, or choose Specific objects, By tag, or, for API keys and usage, By assignment with me, my teams, and teams I lead.
  4. Add more rules as needed, then select Create role.

The form checks the rules as you go. It refuses a rule that combines create with specific objects and asks you to split it. It reminds you that objects created through a tag or assignment rule must match it. It warns when a rule updates teams, and when the role grants environment resources but no environment read.

To change a custom role, open it and edit its rules on the Rules tab. The Holders tab lists the members and teams that hold it. Built-in roles open read-only.

With the Admin API​

Set the AISIX Cloud Admin API base URL and a write-scoped admin token:

# AISIX_CP includes /api and has no trailing slash.
# The local AISIX Enterprise quickstart uses http://localhost:8080/api.
export AISIX_CP="YOUR_AISIX_CONTROL_PLANE_API_URL"
export AISIX_TOKEN="YOUR_ADMIN_TOKEN"

Create a role with POST /roles. This one reads the audit trail and all usage:

curl -sS -X POST "${AISIX_CP}/roles" \
-H "Authorization: Bearer ${AISIX_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"name": "auditor",
"description": "Read-only audit and usage access",
"rules": [
{
"resources": ["audit"],
"actions": ["read"]
},
{
"resources": ["usage"],
"actions": ["read"],
"environments": "all"
},
{
"resources": ["environments"],
"actions": ["read"]
}
]
}'

A role holds up to 100 rules, and an ids list holds up to 1,000 IDs. The environments and tag keys a rule names must belong to the organization when you save it. Later, a deleted environment simply stops matching.

PATCH /roles/{role_name} changes the description or replaces the whole rules list. Rule changes apply to every holder and can take up to 30 seconds to reach every control-plane replica.

DELETE /roles/{role_name} deletes a custom role. It returns 409 ROLE_IN_USE while a member, a team, a pending invitation, the SCIM default role, or the SSO connection still uses the role. GET /roles/{role_name}/holders lists the members, with their assignment source, and the teams that hold it.

See the AISIX Enterprise / Cloud Admin API for schemas and error details.

Assign Roles​

Roles reach a member in two ways:

  • Directly. Each direct assignment records its source: Manual when it was made in the dashboard, through the Admin API, or by an accepted invitation; SSO when the SSO connection assigned it; SCIM when directory sync assigned its default role. SSO and SCIM assignments are locked and change only in the identity provider. See Assign Roles to a Member.
  • Through a team. Every member of a team holds the team's roles for as long as they are on it. See Give a Team Roles.

All these roles add up, whatever their source.

Who Can Change Access​

Three permissions change who holds what. Treat each of them as administrator-level access:

  • Defining roles (roles create, update, delete). Whoever edits a role definition can widen what every holder of the role can do, their own roles included. Only the built-in owner and admin roles can do it. A custom role can hold roles read, nothing more; the API rejects such a rule and the form explains why.
  • Assigning roles (role_assignments). Adding roles to and removing roles from members and teams. Holding it is equivalent to admin: its holder can grant any role except owner, admin included, to anyone, themselves included. Only the owner role also needs the owner role. Only owners hold it by default, and a custom role may include it.
  • Changing team members (teams update). Adding someone to a team gives them every role the team holds. A member who can update a team can therefore hand that team's roles to anyone, without holding role_assignments. Narrow teams update to teams that hold no roles you would not grant directly, for example with a tag selector, and the role form shows a warning for this case.

Issuing a set-password link lets its holder take the account over, so it is a separate permission, member_passwords. The admin and owner roles hold it, and a link for an owner also takes the owner role. Updating members does not include it.

Check Effective Permissions​

Every member can open My permissions, next to Settings in the navigation. It lists their roles, their teams with the ones they lead, and the merged rules. Each rule names where it comes from: a role assigned directly, with its source, or a role held through a team.

To check another member, open Members, and on the member's row select Effective permissions. Viewing another member's permissions takes read on both members and roles.

The Admin API returns the same data:

  • GET /members/me/permissions for the caller. Every member can call it.
  • GET /members/{member_id}/permissions for another member, using the membership id.

The response carries the merged rules, each with its sources, and the identity the assigned_to relations compare against: member_id and teams, each with lead.

What Scoping Changes​

When a role narrows access, the dashboard and the Admin API behave as follows.

Lists and Single Objects​

  • A list shows only the objects the caller can read, and total counts only those. Listing a type the caller cannot read at all returns 403.
  • An object outside the caller's scope returns 404, as if it did not exist. An object the caller can read but not change returns 403 for the change.
  • The environment switcher lists only readable environments. A member who can create environments but read none sees Create your first environment. Anyone else sees a message that they have no access to any environment yet and should contact an administrator, with a View my permissions link.

Pages You Cannot Fully Read​

Navigation items for pages the member cannot read are hidden. A page opened by URL anyway shows a no-access state that names the missing permission and links to My permissions. Parts of a page the member cannot read are hidden, or replaced in place by a note naming the missing permission. Actions the member lacks, such as create, edit, delete, or rotate, are disabled, and hovering over one names the missing permission. Getting started lists only the steps the member can read, and shows a welcome card when none remain. The Usage page reads usage environment by environment, so it needs environments read as well as usage read. A member who reads usage but no environment, such as a Restricted Member, uses Cost Analysis for their own usage across environments.

References to Other Objects​

When a change sets or changes a reference to another object, such as a model's provider key, an API key's allowed models, or a guardrail attached to a team, the caller must be able to read the target. Otherwise the change is refused with 400, as if the target did not exist. References that the change leaves alone are not checked again.

Two exceptions keep self-service working: a caller can always name themselves as an API key's member, and any team they belong to or lead as its team. This does not make those members or teams visible in the Members and Teams lists.

References by name or pattern follow the same rule. A new name that resolves to an object needs read on it, and a name that resolves to nothing is accepted as before. A * pattern, and allow_all_models: true on an API key, need read on the whole type, in that environment for an environment resource. A member who reads only some models therefore cannot turn on All models for a key. Deny lists only narrow access and are not checked.

Names of Objects You Cannot Read​

An object can reference something the caller cannot read, such as an API key whose allowed models the member cannot open. The dashboard then shows the target's name with a lock icon and a short ID. The name is not a link, and hovering over it says that you have no permission to view the object.

The names come from the refs field on read views. It lists every object the row references, as id and name grouped by type, whatever the caller's read permission. It is the only way such a name reaches the caller. A key with allow_all_models: true lists no models.

Usage and Request Logs​

Usage follows the API key that made the request:

  • A usage rule without an object scope reads the whole environment's usage.
  • A usage rule with an object scope reads the usage of the keys it picks. A Restricted Member, for example, sees the usage of their own keys and their teams' keys.
  • Reading models never extends usage.
  • Request logs show every field of the rows the caller can read. Nothing is masked.
  • Usage recorded without an API key is visible only to readers without an object scope. Usage of a key that was selected by ID and then deleted is no longer visible to scoped readers.
  • The organization-level Cost Analysis page combines every environment the caller can read usage in. The Usage page combines the environments among those that the caller can also read.

The Target model view of Cost Analysis has no per-key breakdown, so it needs usage read without an object scope in every environment the request covers: every environment its environment filter names, including one where you cannot read any usage, or, without a filter, every environment where you can read any usage. Other callers receive 403 with the error code USAGE_TARGET_VIEW_FORBIDDEN, and the dashboard suggests filtering to one environment where they can read all usage.

Budgets for Delegated Key Creation​

A member who can create API keys without an assignment constraint can create keys bound to no member and no team. Key, member, and team budgets do not bound those keys, because a new key starts without them. For such members, use organization, environment, or provider key budgets as the hard caps.

When self-service creation is limited to the member's own keys, with assigned_to: self or my_teams on create, every key they create counts toward their member budget or their team budget, so those budgets hold. With a tag selector on create, every new key carries the tag, so a tag budget holds too.

Upgrade from Single Roles​

Before 1.11.0, a member held one organization role plus optional environment access grants. Upgrading the control plane converts them with the same effect:

  • Each member's role becomes a role assignment.
  • Each environment access grant becomes a generated custom role named after the role and the environment, such as admin-production, assigned to the members who held the grant. Its description names the binding. It is a snapshot: later edits to the original role do not change it.
  • A custom role's write permission becomes create, update, and delete. On admin tokens, create and delete are dropped, because minting and revoking them already took the owner role.

Next Steps​

See Typical Access Scenarios for nine complete role setups. Continue with Members and Teams to assign roles, or SCIM Directory Sync when your identity provider should manage members and teams.