Update policy
Update a single policy in place without resending the environment's full policy list. The policy keeps its id and its position in the evaluation order, and all other policies are untouched.
Omitted fields keep their stored values; at least one updatable field must be provided. Setting match to null removes all match expressions so the policy applies to every request. Providing one of keyauth, ratelimit, firewall or openapi replaces the policy's rule entirely, including switching its type; at most one may be set.
Policy ids are regenerated whenever gateway.setPolicies replaces the list, so fetch current ids via gateway.listPolicies first.
Required Permissions
Your root key must have one of the following permissions:
- environment.*.update_policy (for any environment)
- environment.<environment_id>.update_policy (for a specific environment)
Request body
Example request
{
"project": "proj_1234abcd",
"app": "proj_1234abcd",
"environment": "proj_1234abcd",
"policyId": "pol_9d2Fk1LmQ",
"match": [
{
"path": {
"path": {
"prefix": "/api/"
}
}
}
],
"keyauth": {
"keyspaces": [
"ks_1234abcd"
]
},
"ratelimit": {
"limit": 100,
"windowMs": 60000,
"identifier": {
"remoteIp": {}
}
},
"firewall": {
"action": "ACTION_DENY"
},
"openapi": {}
}Response
Successfully updated the policy.
Example response
{
"meta": {
"requestId": "req_123"
}
}