Get Rate Limit Policy by ID
GET /environments/{env_id}/rate_limits/{rate_limit_id}
GET /environments/{env_id}/rate_limits/{rate_limit_id}Interactive 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.
uuidRate limit policy ID within the environment.
uuidResponse Body
application/json
application/json
application/json
application/json
curl -X GET "$AISIX_CP/environments/$ENV_ID/rate_limits/$RATE_LIMIT_ID" \ -H "Authorization: Bearer $AISIX_TOKEN"OK
{
"rate_limit_policy": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"env_id": "3f917d0d-4dff-42f3-97c4-6a5455dfe8c2",
"name": "string",
"scope": "api_key",
"scope_ref": "fd2cd345-6167-46ad-9a1c-db888c907bfa",
"window": "second",
"max_requests": 0,
"max_tokens": 0,
"schedules": [
{
"timezone": "string",
"days_of_week": [
"mon"
],
"dates": [
"string"
],
"start_time": "string",
"end_time": "string"
}
],
"conditions": [
{
"dimension": "team",
"operator": "==",
"negate": true,
"value": "string",
"logic": "and",
"children": [
{}
]
}
],
"group_by": [
"team"
],
"limits": {
"rps": 1,
"rpm": 1,
"rph": 1,
"rpd": 1,
"tpm": 1,
"tpd": 1,
"concurrency": 1
},
"action": "reject",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
},
"warnings": [
{
"code": "field_ignored",
"field": "string",
"min_dp_version": "string",
"affected_dp_count": 0,
"affected_dp_versions": [
"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}/rate_limits/{rate_limit_id}
Get Rate Limit Policy by ID
Return one rate-limit policy. The policy must belong to the environment in the request path.
Parameters
env_id(path, string, required): Environment ID that scopes the request.rate_limit_id(path, string, required): Rate limit policy ID within the environment.
Responses
200: OKrate_limit_policy(object, required): A rate limit rule the gateway enforces per request. Requests over the limit are rejected with HTTP429at the gateway.
A policy is exactly one of two forms, fixed at creation. The
classic form targets one subject via scope + scope_ref
with window + max_requests / max_tokens. The
conditional form matches requests with a conditions tree,
splits counters by group_by, and caps with the 7-field
limits; its classic fields read as null. The conditional
fields are only present on conditional-form policies.
-
rate_limit_policy.id(string, required): Rate limit policy ID. -
rate_limit_policy.env_id(string, required): Environment ID that owns this policy. -
rate_limit_policy.name(string, required): Human-readable policy name. -
rate_limit_policy.scope(object, required): -
allOf variant 1
-
rate_limit_policy.scope_ref(string, required): ID of the resource the policy applies to, matchingscope: a caller API key ID, model ID, team ID, or member ID.team_memberpolicies reference a team ID. Fixed at creation.nullon conditional-form policies. -
rate_limit_policy.window(object, required): -
allOf variant 1
-
rate_limit_policy.max_requests(integer, required): Maximum number of requests allowed per window.nullwhen the policy has no request cap. -
rate_limit_policy.max_tokens(integer, required): Maximum total tokens consumed per window.nullwhen the policy has no token cap. -
rate_limit_policy.schedules(array, required): Recurring suspension windows: while the current time falls in any listed window the gateway skips this policy, and enforcement resumes automatically afterwards. Empty when the policy is always enforced. Present on both policy forms. -
rate_limit_policy.schedules[].timezone(string, required): IANA timezone the wall-clock fields are interpreted in (e.g.Asia/Shanghai). -
rate_limit_policy.schedules[].days_of_week(array, optional): Weekly selector: the window opens on each listed day. Mutually exclusive withdates. -
rate_limit_policy.schedules[].dates(array, optional): Explicit calendar dates (YYYY-MM-DD, intimezone) the window opens on — for holidays and other irregular days. Mutually exclusive withdays_of_week. -
rate_limit_policy.schedules[].start_time(string, required): Window start,HH:MMwall clock (inclusive). -
rate_limit_policy.schedules[].end_time(string, required): Window end,HH:MMwall clock (exclusive);24:00means end of day. Must differ fromstart_time; an end before the start crosses into the following day. -
oneOf variant 1
-
oneOf variant 2
-
rate_limit_policy.conditions(array, optional): Condition node tree the request must satisfy (top-level nodes combine as AND; an empty list matches every request in the environment). Conditional form only. -
rate_limit_policy.conditions[].dimension(string, optional): Request dimension a condition leaf matches on. Identity dimensions carry resource UUIDs (team,member,api_key,model) and admit the equality/set operators; the string dimensionsmodel_name(model display name) andprovideradditionally admit the regex operators.
model and model_name match the dispatched model and — when
the caller addressed a routing group, semantic router, or
ensemble — the addressed parent as well. Either identity
satisfies a positive operator (==/in/regex): a group's own
id selects every request routed through it, and a member's id
selects that member whether called directly or through a
group. ~= is true only when BOTH identities differ
(preserving a ~= b = !(a == b)), and negate inverts the
combined leaf result — so a negated in excludes a
request when either identity is listed, and negate + ~=
matches when either identity equals the value.
-
rate_limit_policy.conditions[].operator(string, optional): Condition operator, mirroring lua-resty-expr tokens.==/~=compare equal/not-equal,intests list membership,~~/~*are case-sensitive/insensitive regexes (string dimensions only).has, the numeric comparisons andipmatchare reserved for future dimensions and rejected on every current one. -
rate_limit_policy.conditions[].negate(boolean, optional): Invert the leaf (lua-resty-expr!, e.g.negate+in= "not in") or the group (!AND/!OR). A request missing the leaf's dimension matches neither the condition nor its negation. -
rate_limit_policy.conditions[].value(object, optional): Comparison value:intakes 1–64 strings, every other operator a single string. Identity dimensions take resource UUIDs;model_nametakes display-name strings or (for~~/~*) a regex of at most 256 characters;providertakes provider catalog ids. -
oneOf variant 1
-
oneOf variant 2
-
rate_limit_policy.conditions[].logic(string, optional): Group combinator — lua-resty-exprAND/OR. -
rate_limit_policy.conditions[].children(array, optional): Nested condition nodes (group shape only). -
rate_limit_policy.group_by(array, optional): Dimensions the counters split on; empty = one shared bucket for every matched request. Conditional form only. -
rate_limit_policy.limits(object, optional): Conditional-form limits — the same 7-field shape as the inline model / API-key rate limits. At least one field must be set. -
rate_limit_policy.limits.rps(integer, optional): Requests per second. -
rate_limit_policy.limits.rpm(integer, optional): Requests per minute. -
rate_limit_policy.limits.rph(integer, optional): Requests per hour. -
rate_limit_policy.limits.rpd(integer, optional): Requests per day. -
rate_limit_policy.limits.tpm(integer, optional): Total tokens per minute. -
rate_limit_policy.limits.tpd(integer, optional): Total tokens per day. -
rate_limit_policy.limits.concurrency(integer, optional): Maximum concurrent in-flight requests. Capped at the data plane's 32-bit counter range. -
rate_limit_policy.action(string, optional): What the policy does past its limits. Onlyreject(HTTP 429) is available; the field reserves the enum for future actions. -
rate_limit_policy.created_at(string, required): Time when the policy was created. -
rate_limit_policy.updated_at(string, required): Time when the policy was last updated. -
warnings(array, optional): Present on save operations when some data plane nodes in the environment run a gateway version that will not execute part of the saved policy. Never present on reads. -
warnings[].code(string, required): How affected nodes treat the saved resource.field_ignored: the resource stays in service on those nodes but the named field has no effect there — beware when the field is restrictive, since the restriction is silently not enforced.row_rejected: those nodes refuse the whole resource, so it stops serving there entirely (or, if a previously accepted version exists, they keep serving the old values). -
warnings[].field(string, required): Dot-separated path of the field that triggered the warning, as delivered to gateway nodes. -
warnings[].min_dp_version(string, required): Oldest gateway version that fully executes the field. The literal valueunreleasedmeans no released gateway version executes it yet. -
warnings[].affected_dp_count(integer, required): Number of currently registered nodes in the environment running an older gateway version thanmin_dp_version. -
warnings[].affected_dp_versions(array, required): Distinct gateway versions reported by the affected nodes, capped at five entries. Nodes that report no version appear asunknown. -
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}/rate_limits/{rate_limit_id}, response 400 above. -
404: Resource not found. Response fields (application/json): identical toGET /environments/{env_id}/rate_limits/{rate_limit_id}, response 400 above.
cURL
curl -X GET '$AISIX_CP/environments/{env_id}/rate_limits/{rate_limit_id}' -H 'Authorization: Bearer $AISIX_TOKEN'