API7 Docs

List Caller API Keys

GET /environments/{env_id}/api_keys

GET /environments/{env_id}/api_keys

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

Query Parameters

q?string

Case-insensitive substring search over the key display name.

page?integer

1-based page number. Requires page_size on the same request.

Range1 <= value <= 10000000
page_size?integer

Page size. Values above 200 are clamped to 200. Omit to return the full list.

Range1 <= value

Response Body

application/json

application/json

application/json

application/json

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

OK

{
  "data": [
    {
      "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
      "env_id": "3f917d0d-4dff-42f3-97c4-6a5455dfe8c2",
      "display_name": "string",
      "allowed_models": [
        "758d9dd9-ab4c-4ea7-99f0-f43c6c03d118"
      ],
      "allowed_agents": [
        "string"
      ],
      "allowed_routes": [
        "string"
      ],
      "mcp_access": {
        "allow": [
          "string"
        ],
        "deny": [
          "string"
        ]
      },
      "mcp_rate_limits": {
        "property1": {
          "rps": 1,
          "rpm": 1,
          "rph": 1,
          "rpd": 1,
          "concurrency": 1
        },
        "property2": {
          "rps": 1,
          "rpm": 1,
          "rph": 1,
          "rpd": 1,
          "concurrency": 1
        }
      },
      "rate_limit": {
        "rps": 1,
        "rpm": 1,
        "rph": 1,
        "rpd": 1,
        "tpm": 1,
        "tpd": 1,
        "concurrency": 1
      },
      "team_id": "810007d0-bec5-486c-b5d1-28fcd8a079ba",
      "user_id": "a169451c-8525-4352-b8ca-070dd449a1a5",
      "jwt_subject": "string",
      "jwt_provider": "string",
      "expires_at": "2019-08-24T14:15:22Z",
      "disabled": true,
      "status": "active",
      "created_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z"
    }
  ],
  "total": 0,
  "page": 0,
  "page_size": 0
}
Complete operation details and schema variants

GET /environments/{env_id}/api_keys

List Caller API Keys

List caller API keys in an environment. Pagination is opt-in: omit page_size to get the full key list in one response. page is only meaningful together with page_size and is rejected without it.

Parameters

  • env_id (path, string, required): Environment ID that scopes the request.

  • q (query, string, optional): Case-insensitive substring search over the key display name.

  • page (query, integer, optional): 1-based page number. Requires page_size on the same request.

  • page_size (query, integer, optional): Page size. Values above 200 are clamped to 200. Omit to return the full list.

Responses

  • 200: OK

  • data (array, required): Caller API keys visible in the environment.

  • data[].id (string, required): Caller API key ID.

  • data[].env_id (string, required): Environment ID that owns this caller API key.

  • data[].display_name (string, required): Human-readable caller API key name.

  • data[].allowed_models (array, required): UUIDs of model resources in the same environment this key may address. Empty array denies every model. Granting a routing group / semantic router / ensemble authorizes requests addressed to that entry; its members stay unaddressable unless granted themselves. Granting a wildcard entry (display name containing a single *) authorizes every request whose model name matches the pattern — including a name that also exists as a separately registered, ungranted exact model (the glob grants access; the exact entry still serves the request).

  • data[].allowed_agents (array, optional): A2A agents this key may reach, as agent-name patterns. * grants every agent and an exact agent name grants a single agent. Absent grants no A2A agent access; access is explicit. Present only when at least one pattern is set.

  • data[].allowed_routes (array, optional): Passthrough routes this key may use, as route-name patterns. * grants every route and an exact route name grants a single route. Absent grants no passthrough-route access; access is explicit. Present only when at least one pattern is set.

  • data[].mcp_access (object, optional): The key's own layer of the MCP tool ACL, intersected with the environment and team layers. Absent means the key adds no constraint of its own.

  • allOf variant 1

  • data[].mcp_access.allow (array, required): Namespaced server__tool patterns this key allows (*, server__*, or an exact server__tool). Each entry may use letters, digits, ., _, -, and *; other characters are rejected. An empty list leaves the key no MCP tool access; ["*"] narrows nothing, which is what a key that only means to subtract tools sends alongside deny.

  • data[].mcp_access.deny (array, optional): Namespaced server__tool patterns removed from the key's effective grant, matched the same way as allow. Deny always wins over any allow, on any layer.

  • data[].mcp_rate_limits (object, optional): Per-MCP-server limits for this key, keyed by MCP server name. Present only when at least one server is limited.

  • data[].mcp_rate_limits.*.rps (integer, optional): Tool calls per second.

  • data[].mcp_rate_limits.*.rpm (integer, optional): Tool calls per minute.

  • data[].mcp_rate_limits.*.rph (integer, optional): Tool calls per hour.

  • data[].mcp_rate_limits.*.rpd (integer, optional): Tool calls per day.

  • data[].mcp_rate_limits.*.concurrency (integer, optional): Maximum in-flight tool calls to this MCP server.

  • data[].rate_limit (object, optional): Per-key rate limit. null means no key-level limit.

  • allOf variant 1

  • data[].rate_limit.rps (integer, optional): Requests per second.

  • data[].rate_limit.rpm (integer, optional): Requests per minute.

  • data[].rate_limit.rph (integer, optional): Requests per hour.

  • data[].rate_limit.rpd (integer, optional): Requests per day.

  • data[].rate_limit.tpm (integer, optional): Tokens per minute.

  • data[].rate_limit.tpd (integer, optional): Tokens per day.

  • data[].rate_limit.concurrency (integer, optional): Maximum in-flight requests.

  • data[].team_id (string, optional): Team binding used for attribution and policy scope.

  • data[].user_id (string, optional): Organization member this key is attributed to — the membership id from GET /members, not that member's user_id.

  • data[].jwt_subject (string, optional): External identity bound to this key for JWT authentication. When a request presents a valid JWT from the OIDC provider named in jwt_provider, that provider's identity claim selects the key whose jwt_subject equals it, and the request runs with this key's permissions, rate limits, and budget. The jwt_provider and jwt_subject pair is unique within the environment.

  • data[].jwt_provider (string, optional): Name of the OIDC provider permitted to assert this key's jwt_subject. A token is only ever mapped to this key when issued by the named provider, so a second trusted provider cannot impersonate this identity. Set together with jwt_subject.

  • data[].expires_at (string, optional): Expiry deadline. Present only when set; absent for keys that never expire. Once the deadline passes, the gateway rejects the bearer with 401.

  • data[].disabled (boolean, required): Administratively disabled. A disabled key is rejected by the gateway with 401 until re-enabled; the underlying bearer is preserved.

  • data[].status (string, required): Derived lifecycle state: disabled wins over expired; a key is expired once expires_at has passed; otherwise active.

  • data[].created_at (string, required): Time when the caller API key was created.

  • data[].updated_at (string, required): Time when the caller API key was last updated.

  • total (integer, optional): Total number of matching caller API keys across all pages.

  • page (integer, optional): Current 1-based page.

  • page_size (integer, optional): Effective page size after clamping.

  • 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, response 400 above.

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

cURL

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