Skip to main content

update-policy

Update one gateway policy in place
1 min read

Update one policy while preserving its ID, evaluation position, and all omitted fields. Supply the fields to update in a single policy JSON object. At least one update field is required, and at most one rule field may be supplied.

Usage#

Flags#

--projectstringrequired#
Project ID or slug.
--appstringrequired#
Application ID or slug.
--environmentstringrequired#
Environment ID or slug.
--policy-idstringrequired#
Current policy ID from gateway.listPolicies.
--policyJSON stringrequired#

Policy fields to update. Supported fields are name, enabled, match, keyauth, ratelimit, firewall, openapi, and logging. Omitted fields remain unchanged. Set match to null or an empty array to clear all match expressions. Include at most one rule field.

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.