API7 Docs

Get Effective Permissions

GET /environments/{env_id}/api_keys/{api_key_id}/effective_permissions

GET /environments/{env_id}/api_keys/{api_key_id}/effective_permissions

Interactive request editor loads with JavaScript.

Authorization

BearerAdminToken
AuthorizationBearer <token>

Organization-scoped admin token. Read operations require a valid token, and write operations require a token with write permission.

In: header

Path Parameters

env_id*string

Environment ID that scopes the request.

Formatuuid
api_key_id*string

Caller API key ID within the environment.

Formatuuid

Response Body

application/json

application/json

application/json

application/json

curl -X GET "$AISIX_CP/environments/$ENV_ID/api_keys/$API_KEY_ID/effective_permissions" \  -H "Authorization: Bearer $AISIX_TOKEN"

OK

{
  "effective_permissions": {
    "mcp": {
      "layers": [
        {
          "source": "env_policy",
          "policy_id": "ee9b03e0-6495-427a-85a5-34444d24ae04"
        }
      ],
      "all_tools": true,
      "allow": [
        {
          "pattern": "string",
          "source": "env_policy"
        }
      ],
      "deny": [
        {
          "pattern": "string",
          "source": "env_policy"
        }
      ]
    }
  }
}
Complete operation details and schema variants

GET /environments/{env_id}/api_keys/{api_key_id}/effective_permissions

Get Effective Permissions

Resolve the MCP tool access a caller API key ends up with once the environment layer, the key team's layer, and the key's own mcp_access block are intersected. Every allow and deny pattern in the answer carries its source, and layers names the layers that constrain the key — an empty list means none is configured, which is why such a key has no MCP access. The resolution is pattern-level: it reports the granted server__tool patterns, not an expansion into concrete tool names. Where two layers carry patterns that overlap without one covering the other (for example github__* against *__search), the intersection is approximated as no grant here, while the gateway still combines them per tool at request time.

Parameters

  • env_id (path, string, required): Environment ID that scopes the request.
  • api_key_id (path, string, required): Caller API key ID within the environment.

Responses

  • 200: OK

  • effective_permissions (object, required): Permissions after resolving environment, team, and key policy layers.

  • effective_permissions.mcp (object, required):

  • effective_permissions.mcp.layers (array, required): The layers that constrain this key, in resolution order. An empty array means no layer is configured anywhere, which is why the key has no MCP tool access — access is granted explicitly.

  • effective_permissions.mcp.layers[].source (string, required): Which layer this entry describes.

  • effective_permissions.mcp.layers[].policy_id (string, optional): Policy providing the layer. Present for the two policy layers, absent for the key's own.

  • effective_permissions.mcp.all_tools (boolean, required): Whether the allow side of the effective grant covers every tool (before deny patterns are subtracted).

  • effective_permissions.mcp.allow (array, required): Patterns forming the allow side of the effective grant, each with its source. Empty when the key has no MCP tool access or when all_tools is true.

  • effective_permissions.mcp.allow[].pattern (string, required): Namespaced server__tool pattern (*, server__*, or an exact server__tool).

  • effective_permissions.mcp.allow[].source (string, required): Level that contributed the pattern.

  • effective_permissions.mcp.deny (array, required): Patterns subtracted from the grant, each with its source. Deny always wins over allow.

  • effective_permissions.mcp.deny[].pattern (string, required): Namespaced server__tool pattern (*, server__*, or an exact server__tool).

  • effective_permissions.mcp.deny[].source (string, required): Level that contributed the pattern.

  • 400: Request body or parameters failed validation.

  • error (object, required): Error details.

  • error.code (string, required): Machine-readable identifier. Examples: UNAUTHENTICATED, INVALID_REQUEST, MASTER_KEY_UNSET, INTERNAL.

  • error.message (string, required): Human-readable explanation; safe to surface to operators.

  • 401: Missing or invalid bearer. Response fields (application/json): identical to GET /environments/{env_id}/api_keys/{api_key_id}/effective_permissions, response 400 above.

  • 404: Resource not found. Response fields (application/json): identical to GET /environments/{env_id}/api_keys/{api_key_id}/effective_permissions, response 400 above.

cURL

curl -X GET '$AISIX_CP/environments/{env_id}/api_keys/{api_key_id}/effective_permissions' -H 'Authorization: Bearer $AISIX_TOKEN'