---
title: "create a new protection rule"
method: POST
path: "/w/{workspace}/workspaces/protection_rules"
tags: ["workspace"]
---

# create a new protection rule

`POST /w/{workspace}/workspaces/protection_rules`

## Path parameters

- `workspace` string, required

## Request body

- object
  - `name` string, required — Unique name for the protection rule
  - `rules` ProtectionRuleKind[], required — Configuration of protection restrictions
  - `bypass_groups` string[], required — Groups that can bypass this ruleset
  - `bypass_users` string[], required — Users that can bypass this ruleset

## Response `200`

protection rule created successfully

## Other responses

- `400` — rule with this name already exists

## Changes

> 176 revisions in range; 19 could not be searched.

- **2026-08-06** `966123aa8b8b` — 1 info
  - added the new `RestrictPublicRunSharing` enum value to the request property `rules/items/`

[Change history](https://skmtc.dev/windmill/apis/windmill-api/changes/w/:workspace/workspaces/protection_rules/post.md)

---

[API](https://skmtc.dev/windmill/apis/windmill-api.md) · [All operations](https://skmtc.dev/windmill/apis/windmill-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/windmill/windmill-api/revisions/7b281701c340/schema)
