Skip to main content

set-policies

Atomically replace an environment's gateway policies
1 min read

Replace an environment's complete ordered policy list. An empty list removes every policy. The operation is atomic and accepts at most 50 policies.

Usage#

Flags#

--projectstringrequired#
Project ID or slug.
--appstringrequired#
Application ID or slug.
--environmentstringrequired#
Environment ID or slug.
--policiesJSON stringrequired#
The complete policy list in evaluation order. Each policy requires name and enabled, and exactly one of keyauth, ratelimit, firewall, openapi, or logging.
Show JSON schema
namestringrequired#
Dashboard name.
enabledbooleanrequired#
Whether evaluation is enabled.
matcharray#
Optional path, method, header, or query parameter match expressions.
keyauthobject#
Keyspaces, locations, permission query, and rate limits.
ratelimitobject#
Limit, windowMs, and identifiers.
firewallobject#
Firewall action.
openapiobject#
OpenAPI validation configuration.
loggingobject#
Logging configuration.

Global Flags#

FlagTypeDescription
--root-keystringOverride root key ($UNKEY_ROOT_KEY)
--api-urlstringOverride API base URL (default: https://api.unkey.com)
--configstringPath to config file (default: ~/.unkey/config.toml)
--outputstringOutput format, use json for raw JSON
--bodystringSend this JSON string as the request body. You cannot combine it with request-building flags.

Examples#

See the API reference.