Set policies
Replace an environment's gateway policies in a single atomic request. Policies run at the edge before requests reach your app: verify API keys, rate limit, block requests outright, or validate them against your OpenAPI spec.
Policies are an ordered list: the gateway evaluates them top to bottom and the first rejection short-circuits the request.
Each policy sets exactly one of keyauth, ratelimit, firewall or openapi, plus optional match expressions restricting which requests it applies to.
Every call is a full replace: the environment's policies become exactly the request list in the given order, and the server generates a fresh id for each one. An empty list removes all policies. The operation is atomic: if any policy is invalid, nothing is written.
Required Permissions
Your root key must have one of the following permissions:
- environment.*.set_policies (for any environment)
- environment.<environment_id>.set_policies (for a specific environment)
Request body
Example request
{
"project": "proj_1234abcd",
"app": "proj_1234abcd",
"environment": "proj_1234abcd",
"policies": [
{
"name": "Block internal paths",
"enabled": true,
"match": [
{
"path": {
"path": {
"prefix": "/internal/"
}
}
}
],
"firewall": {
"action": "ACTION_DENY"
}
}
]
}Response
Successfully set the policies.
Example response
{
"meta": {
"requestId": "req_123"
}
}