Skip to main content
Version: Dev

Admin Tokens

Admin tokens let automation call the AISIX Cloud Admin API in AISIX Enterprise or AISIX Cloud without a browser session.

They are intended for organization-level workflows such as CI pipelines, infrastructure automation, or internal tools that manage control-plane resources. They are not caller API keys for gateway traffic or upstream provider keys for model access.

An admin token belongs to one organization. The control plane uses that organization binding when it authenticates the request, so API calls do not need a separate organization header.

In AISIX Enterprise, one Admin API operation does not accept an admin token: importOrganizationData (POST /data_import) takes a signed-in dashboard session instead. See Organization Backup and Restore.

Create an Admin Token​

Only members holding the Owner role can create or revoke admin tokens, whatever their other roles grant. The built-in Admin role does not include it, and no custom role can grant it. For anyone else, New token and the revoke action on each token are disabled, and hovering over them says that only the Owner role can mint or revoke admin tokens. Members whose roles read admin_tokens, such as the built-in Member, can still list the tokens.

  1. Open Admin tokens.
  2. Select New token.
  3. Enter a unique name.
  4. Choose an expiration period, or select Never.
  5. Select one or more scopes.
  6. Create the token and copy the plaintext value before leaving the one-time view.

Generated admin tokens use the aisix_pat_ prefix. After displaying the plaintext value once, the control plane stores only its SHA-256 digest. If you lose the plaintext value, revoke the token and create a replacement.

Choose Scopes​

Admin tokens support the following scopes:

ScopeAccess
readRead-only access to AISIX Cloud Admin API routes.
writeRead and write access to AISIX Cloud Admin API routes.
scimAccess only to the SCIM directory sync endpoints under /scim/v2.

Use read for inventory or reporting jobs. Use write only when automation needs to create, update, or delete control-plane resources.

SCIM tokens follow a separate creation flow: generate them in Settings, on the Authentication tab, under Directory sync (SCIM). The scim scope cannot be combined with other scopes, and these tokens are rejected on non-SCIM routes. This limits the identity provider credential to directory provisioning.

Use an Admin Token​

Set the AISIX Cloud Admin API base URL and send the token in the Authorization header as a bearer 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"

curl -sS "${AISIX_CP}/environments" \
-H "Authorization: Bearer ${AISIX_TOKEN}"

Use the AISIX Enterprise / Cloud Admin API for routes covered by the public OpenAPI specification. Workflow guides may also provide task-specific examples. For example, Members shows how to create a member for API key ownership in AISIX Enterprise.

Errors use the envelope {"error": {"code": "...", "message": "..."}}. Treat these status codes as follows:

StatusMeaningAction
401The token is missing, invalid, revoked, or expired.Use a valid token.
403The token's scopes or roles do not allow the request.Use a token that is allowed to make the request.
503 SERVICE_UNAVAILABLEThe control plane could not read what authentication or authorization needs, such as the token, the membership, or the caller's roles, for example during a database stall. The response has no Retry-After header.The request did not run. Send it again. Do not treat it as a credential or permission failure.
503 CP_UPGRADINGThe control plane is being upgraded, and the replica that answered has been replaced by a newer one. The response carries Retry-After.The request did not run. Send it again unchanged after the time Retry-After gives.

Rotate or Revoke Tokens​

To rotate an admin token, create a replacement, update the automation that uses it, verify that the automation succeeds, and then revoke the old token.

Revocation takes effect immediately. Requests that use the revoked token receive authentication errors.

A read or write token acts with its holder's current membership and every role the holder currently holds, directly or through a team. The token's scope still limits it: a read token cannot change anything, whatever its holder's roles allow. A SCIM token does not depend on its issuer: it keeps working after the issuer is demoted or leaves the organization, until an owner revokes it. The admin token list reports the issuer's current standing for each token in created_by_status: owner, not_owner (still a member but no longer an owner, including a member the identity provider deactivated), or left (no longer a member). The Admin tokens page marks an active SCIM token whose issuer is no longer an owner with Issuer is no longer an owner or Issuer left the organization. Replace such a token as described in Replace a Token Whose Issuer Is No Longer an Owner.

Next Steps​

After creating an admin token with the write scope, continue with Connect a Gateway to attach the runtime that will receive environment resources and serve AI traffic.

To configure organization access instead, continue with Members. For identity-provider provisioning, see SCIM Directory Sync.