List Guardrail Attachments
GET /environments/{env_id}/guardrails/{guardrail_id}/attachments
GET /environments/{env_id}/guardrails/{guardrail_id}/attachmentsInteractive request editor loads with JavaScript.
Authorization
BearerAdminToken Organization-scoped admin token. Read operations require a valid token, and write operations require a token with write permission.
In: header
Path Parameters
Environment ID that scopes the request.
uuidGuardrail ID within the environment.
uuidResponse Body
application/json
application/json
application/json
application/json
curl -X GET "$AISIX_CP/environments/$ENV_ID/guardrails/$GUARDRAIL_ID/attachments" \ -H "Authorization: Bearer $AISIX_TOKEN"OK
{
"data": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"guardrail_id": "5ea4ad06-0022-46ca-b5a6-3795e32e6aa8",
"env_id": "3f917d0d-4dff-42f3-97c4-6a5455dfe8c2",
"scope_type": "env",
"scope_id": "5d3fe357-12dd-4f62-b004-6d1fb3b8454f",
"priority": 0,
"enabled": true,
"created_at": "string"
}
]
}Request body or parameters failed validation.
{
"error": {
"code": "string",
"message": "string"
}
}Missing or invalid bearer.
{
"error": {
"code": "UNAUTHENTICATED",
"message": "no org context"
}
}Resource not found.
{
"error": {
"code": "NOT_FOUND",
"message": "provider key not found"
}
}Complete operation details and schema variants
GET /environments/{env_id}/guardrails/{guardrail_id}/attachments
List Guardrail Attachments
Return the scope attachments for one guardrail. Each attachment determines whether the guardrail applies to an environment, model, caller API key, or team.
Parameters
env_id(path, string, required): Environment ID that scopes the request.guardrail_id(path, string, required): Guardrail ID within the environment.
Responses
-
200: OK -
data(array, required): Scope attachments for the guardrail. -
data[].id(string, required): Guardrail attachment ID. -
data[].guardrail_id(string, required): Guardrail definition selected by this attachment. -
data[].env_id(string, required): Environment that owns the guardrail and attachment. -
data[].scope_type(string, required): The resource dimension an attachment binds to.model,mcp_server, andpassthrough_routeselect dimensions a request carries only one of: an MCP tool call resolves no model, a model request routes to no MCP server, and passthrough-route traffic resolves neither. Amodel-scoped guardrail therefore never inspects MCP or passthrough traffic, anmcp_server-scoped one never inspects model traffic, and apassthrough_route-scoped one inspects only the traffic of that route. -
data[].scope_id(string, optional): ID of the model, MCP server, caller API key, or team selected byscope_type. Null for an environment-scoped attachment. -
data[].priority(integer, optional): Precedence when the same guardrail matches through more than one attachment. Higher numbers win; equal priorities prefer api_key, then team, then model or mcp_server, then env scope. Model and MCP-server scopes share a rank because no single request can match both. -
data[].enabled(boolean, required): Whether the gateway considers this attachment during scope resolution. -
data[].created_at(string, optional): RFC3339 time when the attachment was created. -
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 toGET /environments/{env_id}/guardrails/{guardrail_id}/attachments, response 400 above. -
404: Resource not found. Response fields (application/json): identical toGET /environments/{env_id}/guardrails/{guardrail_id}/attachments, response 400 above.
cURL
curl -X GET '$AISIX_CP/environments/{env_id}/guardrails/{guardrail_id}/attachments' -H 'Authorization: Bearer $AISIX_TOKEN'