List policies
Retrieve an environment's gateway policies in evaluation order: the
gateway evaluates them top to bottom and the first rejection
short-circuits the request.
The full policy list is returned in a single response.
Required Permissions
Your root key must have one of the following permissions:
environment.*.read_policies(for any environment)environment.<environment_id>.read_policies(for a specific environment)
Authorization
Body
application/jsonIdentifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$
Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$
Identifies a resource by either its unique ID or its slug.
Accepts a prefixed ID (such as 'proj_' or 'app_') or a slug.
Length: 3–255Pattern: ^[a-zA-Z0-9_-]+$
Responses
requestId is particularly important when troubleshooting issues with the Unkey support team.Show child attributesHide child attributes
Items: max 50
Show child attributesHide child attributes
gateway.setPolicies call, so treat it as stable only until the environment's policies are next replaced.Optional request matchers. The policy applies only to requests matching
all expressions; omitted when the policy applies to every request.
Items: max 10
Show child attributesHide child attributes
Show child attributesHide child attributes
exact, prefix or regex must be set.Show child attributesHide child attributes
Matches when the input satisfies this RE2 regular expression. Invalid
patterns are rejected when the policy is created.
Length: 1–1024
Show child attributesHide child attributes
Items: min 1
Matches a named request field (header or query parameter). Exactly one of
present or value must be set.
Show child attributesHide child attributes
Length: 1–256
exact, prefix or regex must be set.Show child attributesHide child attributes
Matches when the input satisfies this RE2 regular expression. Invalid
patterns are rejected when the policy is created.
Length: 1–1024
Matches a named request field (header or query parameter). Exactly one of
present or value must be set.
Show child attributesHide child attributes
Length: 1–256
exact, prefix or regex must be set.Show child attributesHide child attributes
Matches when the input satisfies this RE2 regular expression. Invalid
patterns are rejected when the policy is created.
Length: 1–1024
Show child attributesHide child attributes
Keyspaces to verify keys against, referenced by id. All keyspaces must
belong to your workspace.
Items: 1–5
Where to look for the key on incoming requests, tried in order. Defaults
to the Authorization Bearer header when omitted.
Show child attributesHide child attributes
Authorization Bearer header.Optional permission query the verified key must satisfy, e.g.
documents.read AND documents.write.
Length: max 1000
Items: max 10
Show child attributesHide child attributes
Name of a rate limit configured on the key or its identity, or the name
of the inline override defined by limit and duration.
Length: 1–256
Inline override: maximum number of operations per window. Must be set
together with duration.
Range: >= 1
Inline override: window duration in milliseconds. Must be set together
with limit.
Range: >= 1
Usage credits a matching request deducts from the verified key. Defaults
to 1. Set to 0 to verify the key without spending credits, or to a higher
value to charge more per request. Keys with unlimited usage are
unaffected.
Range: >= 0
Rate limits matching requests. Set identifiers with 1 to 5 sources.
The deprecated identifier field is accepted in place of a one-entry
identifiers list; set exactly one of the two.
Show child attributesHide child attributes
How requests are grouped for rate limiting. Exactly one of remoteIp,
header, authenticatedSubject, path or principalField must be set.
Show child attributesHide child attributes
Show child attributesHide child attributes
Length: 1–256
Ordered list of sources that form a compound rate limit key. The
gateway resolves each source for each request. Each unique
combination of resolved values has its own counter. All counters use
the same limit and window. Example: [authenticatedSubject, path]
limits each subject separately on each path.
Items: 1–5
Show child attributesHide child attributes
Show child attributesHide child attributes
Length: 1–256
Show child attributesHide child attributes
Validates matching requests against the app's uploaded OpenAPI spec. Has no
configuration of its own. If no spec has been uploaded for the deployment,
the policy is a no-op and requests pass through unvalidated.
Adds request data to the log entries of matching requests. The gateway
always records a basic log entry for every request: method, host, path,
status, and latency. Each capture setting is a separate opt-in: request
headers, response headers, request body, response body, and query data.
The policy's match expressions select the requests. A policy without
match expressions matches every request. If more than one enabled
logging policy matches a request, the gateway combines their settings.
The gateway always redacts the Authorization header and configured key
locations before it stores headers or query data.
Show child attributesHide child attributes
Capture request headers, the user agent, and the client IP. The user
agent and client IP are included because they identify the client.
Default: false
Capture the query string and query parameters. Query data is a
separate opt-in because URLs can contain secrets, for example
?api_key=....
Default: false
requestId is particularly important when troubleshooting issues with the Unkey support team.Show child attributesHide child attributes
Show child attributesHide child attributes
400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), and 500 (Internal Server Error).Show child attributesHide child attributes
JSON path indicating exactly where in the request the error occurred. This helps pinpoint the problematic field or parameter. Examples include:
- 'body.name' (field in request body)
- 'body.items[3].tags' (nested array element)
- 'path.apiId' (path parameter)
- 'query.limit' (query parameter)
Use this location to identify exactly which part of your request needs correction.
requestId is particularly important when troubleshooting issues with the Unkey support team.Show child attributesHide child attributes
Show child attributesHide child attributes
400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), and 500 (Internal Server Error).requestId is particularly important when troubleshooting issues with the Unkey support team.Show child attributesHide child attributes
Show child attributesHide child attributes
400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), and 500 (Internal Server Error).requestId is particularly important when troubleshooting issues with the Unkey support team.Show child attributesHide child attributes
Show child attributesHide child attributes
400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), and 500 (Internal Server Error).requestId is particularly important when troubleshooting issues with the Unkey support team.Show child attributesHide child attributes
Show child attributesHide child attributes
400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), and 500 (Internal Server Error).requestId is particularly important when troubleshooting issues with the Unkey support team.Show child attributesHide child attributes
Show child attributesHide child attributes
400 (Bad Request), 401 (Unauthorized), 403 (Forbidden), 404 (Not Found), 409 (Conflict), and 500 (Internal Server Error).