> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/api-reference/software-delivery-agent-apis/code-repository/rules.md).

# Rules

## GET /repos/{repo\_identifier}/rules

> List repo protection rules

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"OpenapiRule":{"properties":{"created":{"type":"integer"},"created_by":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"repositories":{"additionalProperties":{"$ref":"#/components/schemas/TypesRepositoryCore"},"nullable":true,"type":"object"},"scope":{"type":"integer"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"updated":{"type":"integer"},"user_groups":{"additionalProperties":{"$ref":"#/components/schemas/TypesUserGroupInfo"},"nullable":true,"type":"object"},"users":{"additionalProperties":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"nullable":true,"type":"object"}},"type":"object"},"TypesPrincipalInfo":{"nullable":true,"properties":{"created":{"type":"integer"},"display_name":{"type":"string"},"email":{"type":"string"},"id":{"type":"integer"},"type":{"$ref":"#/components/schemas/EnumPrincipalType"},"uid":{"type":"string"},"updated":{"type":"integer"}},"type":"object"},"EnumPrincipalType":{"enum":["service","serviceaccount","user"],"type":"string"},"OpenapiRuleDefinition":{"oneOf":[{"$ref":"#/components/schemas/ProtectionBranch"},{"$ref":"#/components/schemas/ProtectionTag"},{"$ref":"#/components/schemas/ProtectionPush"}],"type":"object"},"ProtectionBranch":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefBranchLifecycle"},"pullreq":{"$ref":"#/components/schemas/ProtectionDefPullReq"}},"type":"object"},"ProtectionDefBypass":{"properties":{"repo_owners":{"type":"boolean"},"user_group_ids":{"items":{"type":"integer"},"type":"array"},"user_ids":{"items":{"type":"integer"},"type":"array"}},"type":"object"},"ProtectionDefBranchLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionDefPullReq":{"properties":{"approvals":{"$ref":"#/components/schemas/ProtectionDefApprovals"},"comments":{"$ref":"#/components/schemas/ProtectionDefComments"},"commits":{"$ref":"#/components/schemas/ProtectionDefCommits"},"merge":{"$ref":"#/components/schemas/ProtectionDefMerge"},"merge_queue":{"$ref":"#/components/schemas/ProtectionDefMergeQueue"},"reviewers":{"$ref":"#/components/schemas/ProtectionDefReviewers"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefApprovals":{"properties":{"require_code_owners":{"type":"boolean"},"require_latest_commit":{"type":"boolean"},"require_minimum_count":{"type":"integer"},"require_minimum_default_reviewer_count":{"type":"integer"},"require_no_change_request":{"type":"boolean"}},"type":"object"},"ProtectionDefComments":{"properties":{"require_resolve_all":{"type":"boolean"}},"type":"object"},"ProtectionDefCommits":{"properties":{"require_target_is_ancestor":{"type":"boolean"}},"type":"object"},"ProtectionDefMerge":{"properties":{"block":{"type":"boolean"},"delete_branch":{"type":"boolean"},"require_bypass_message":{"type":"boolean"},"strategies_allowed":{"items":{"$ref":"#/components/schemas/EnumMergeMethod"},"type":"array"}},"type":"object"},"EnumMergeMethod":{"enum":["fast-forward","merge","rebase","squash"],"type":"string"},"ProtectionDefMergeQueue":{"properties":{"checks_concurrency":{"type":"integer"},"group_size":{"type":"integer"},"max_check_duration_seconds":{"type":"integer"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefStatusChecks":{"properties":{"require_identifiers":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionDefReviewers":{"properties":{"default_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"default_user_group_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"request_code_owners":{"type":"boolean"}},"type":"object"},"ProtectionTag":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefTagLifecycle"}},"type":"object"},"ProtectionDefTagLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionPush":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"push":{"$ref":"#/components/schemas/ProtectionDefPush"}},"type":"object"},"ProtectionDefPush":{"properties":{"file_size_limit":{"type":"integer"},"principal_committer_match":{"type":"boolean"},"secret_scanning_enabled":{"type":"boolean"}},"type":"object"},"ProtectionPattern":{"nullable":true,"properties":{"default":{"type":"boolean"},"exclude":{"items":{"type":"string"},"type":"array"},"include":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionRepoTarget":{"nullable":true,"properties":{"exclude":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"},"include":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"}},"type":"object"},"ProtectionRepoTargetFilter":{"properties":{"ids":{"items":{"type":"integer"},"type":"array"},"patterns":{"items":{"type":"string"},"type":"array"}},"type":"object"},"TypesRepositoryCore":{"properties":{"default_branch":{"type":"string"},"fork_id":{"type":"integer"},"id":{"type":"integer"},"identifier":{"type":"string"},"parent_id":{"type":"integer"},"path":{"type":"string"},"type":{"$ref":"#/components/schemas/EnumRepoType"}},"type":"object"},"EnumRepoType":{"type":"string"},"EnumRuleState":{"enum":["active","disabled","monitor"],"nullable":true,"type":"string"},"OpenapiRuleType":{"enum":["branch","tag","push"],"type":"string"},"TypesUserGroupInfo":{"properties":{"description":{"type":"string"},"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"scope":{"type":"integer"}},"type":"object"},"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/repos/{repo_identifier}/rules":{"get":{"operationId":"repoRuleList","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"description":"The substring by which the repository protection rules are filtered.","in":"query","name":"query","required":false,"schema":{"type":"string"}},{"description":"The order of the output.","in":"query","name":"order","required":false,"schema":{"default":"asc","enum":["asc","desc"],"type":"string"}},{"description":"The field by which the protection rules are sorted.","in":"query","name":"sort","required":false,"schema":{"default":"created_at","enum":["created_at","identifier","uid","updated_at"],"type":"string"}},{"description":"The types of rules to include.","explode":true,"in":"query","name":"type","required":false,"schema":{"items":{"enum":["branch","tag","push"],"type":"string"},"type":"array"},"style":"form"},{"description":"The page to return.","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"The maximum number of results to return.","in":"query","name":"limit","required":false,"schema":{"default":30,"maximum":100,"minimum":1,"type":"integer"}},{"description":"The result should inherit entities from parent spaces.","in":"query","name":"inherited","required":false,"schema":{"default":false,"type":"boolean"}},{"in":"path","name":"repo_identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/OpenapiRule"},"type":"array"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"List repo protection rules","tags":["rules"]}}}}
```

## POST /repos/{repo\_identifier}/rules

> Add repo protection rule

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"OpenapiRuleDefinition":{"oneOf":[{"$ref":"#/components/schemas/ProtectionBranch"},{"$ref":"#/components/schemas/ProtectionTag"},{"$ref":"#/components/schemas/ProtectionPush"}],"type":"object"},"ProtectionBranch":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefBranchLifecycle"},"pullreq":{"$ref":"#/components/schemas/ProtectionDefPullReq"}},"type":"object"},"ProtectionDefBypass":{"properties":{"repo_owners":{"type":"boolean"},"user_group_ids":{"items":{"type":"integer"},"type":"array"},"user_ids":{"items":{"type":"integer"},"type":"array"}},"type":"object"},"ProtectionDefBranchLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionDefPullReq":{"properties":{"approvals":{"$ref":"#/components/schemas/ProtectionDefApprovals"},"comments":{"$ref":"#/components/schemas/ProtectionDefComments"},"commits":{"$ref":"#/components/schemas/ProtectionDefCommits"},"merge":{"$ref":"#/components/schemas/ProtectionDefMerge"},"merge_queue":{"$ref":"#/components/schemas/ProtectionDefMergeQueue"},"reviewers":{"$ref":"#/components/schemas/ProtectionDefReviewers"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefApprovals":{"properties":{"require_code_owners":{"type":"boolean"},"require_latest_commit":{"type":"boolean"},"require_minimum_count":{"type":"integer"},"require_minimum_default_reviewer_count":{"type":"integer"},"require_no_change_request":{"type":"boolean"}},"type":"object"},"ProtectionDefComments":{"properties":{"require_resolve_all":{"type":"boolean"}},"type":"object"},"ProtectionDefCommits":{"properties":{"require_target_is_ancestor":{"type":"boolean"}},"type":"object"},"ProtectionDefMerge":{"properties":{"block":{"type":"boolean"},"delete_branch":{"type":"boolean"},"require_bypass_message":{"type":"boolean"},"strategies_allowed":{"items":{"$ref":"#/components/schemas/EnumMergeMethod"},"type":"array"}},"type":"object"},"EnumMergeMethod":{"enum":["fast-forward","merge","rebase","squash"],"type":"string"},"ProtectionDefMergeQueue":{"properties":{"checks_concurrency":{"type":"integer"},"group_size":{"type":"integer"},"max_check_duration_seconds":{"type":"integer"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefStatusChecks":{"properties":{"require_identifiers":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionDefReviewers":{"properties":{"default_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"default_user_group_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"request_code_owners":{"type":"boolean"}},"type":"object"},"ProtectionTag":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefTagLifecycle"}},"type":"object"},"ProtectionDefTagLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionPush":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"push":{"$ref":"#/components/schemas/ProtectionDefPush"}},"type":"object"},"ProtectionDefPush":{"properties":{"file_size_limit":{"type":"integer"},"principal_committer_match":{"type":"boolean"},"secret_scanning_enabled":{"type":"boolean"}},"type":"object"},"ProtectionPattern":{"nullable":true,"properties":{"default":{"type":"boolean"},"exclude":{"items":{"type":"string"},"type":"array"},"include":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionRepoTarget":{"nullable":true,"properties":{"exclude":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"},"include":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"}},"type":"object"},"ProtectionRepoTargetFilter":{"properties":{"ids":{"items":{"type":"integer"},"type":"array"},"patterns":{"items":{"type":"string"},"type":"array"}},"type":"object"},"EnumRuleState":{"enum":["active","disabled","monitor"],"nullable":true,"type":"string"},"OpenapiRuleType":{"enum":["branch","tag","push"],"type":"string"},"OpenapiRule":{"properties":{"created":{"type":"integer"},"created_by":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"repositories":{"additionalProperties":{"$ref":"#/components/schemas/TypesRepositoryCore"},"nullable":true,"type":"object"},"scope":{"type":"integer"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"updated":{"type":"integer"},"user_groups":{"additionalProperties":{"$ref":"#/components/schemas/TypesUserGroupInfo"},"nullable":true,"type":"object"},"users":{"additionalProperties":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"nullable":true,"type":"object"}},"type":"object"},"TypesPrincipalInfo":{"nullable":true,"properties":{"created":{"type":"integer"},"display_name":{"type":"string"},"email":{"type":"string"},"id":{"type":"integer"},"type":{"$ref":"#/components/schemas/EnumPrincipalType"},"uid":{"type":"string"},"updated":{"type":"integer"}},"type":"object"},"EnumPrincipalType":{"enum":["service","serviceaccount","user"],"type":"string"},"TypesRepositoryCore":{"properties":{"default_branch":{"type":"string"},"fork_id":{"type":"integer"},"id":{"type":"integer"},"identifier":{"type":"string"},"parent_id":{"type":"integer"},"path":{"type":"string"},"type":{"$ref":"#/components/schemas/EnumRepoType"}},"type":"object"},"EnumRepoType":{"type":"string"},"TypesUserGroupInfo":{"properties":{"description":{"type":"string"},"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"scope":{"type":"integer"}},"type":"object"},"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/repos/{repo_identifier}/rules":{"post":{"operationId":"repoRuleAdd","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"in":"path","name":"repo_identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"uid":{"deprecated":true,"type":"string"}},"type":"object"}}}},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenapiRule"}}},"description":"Created"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"Add repo protection rule","tags":["rules"]}}}}
```

## GET /repos/{repo\_identifier}/rules/{rule\_identifier}

> Get repo protection rule

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"OpenapiRule":{"properties":{"created":{"type":"integer"},"created_by":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"repositories":{"additionalProperties":{"$ref":"#/components/schemas/TypesRepositoryCore"},"nullable":true,"type":"object"},"scope":{"type":"integer"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"updated":{"type":"integer"},"user_groups":{"additionalProperties":{"$ref":"#/components/schemas/TypesUserGroupInfo"},"nullable":true,"type":"object"},"users":{"additionalProperties":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"nullable":true,"type":"object"}},"type":"object"},"TypesPrincipalInfo":{"nullable":true,"properties":{"created":{"type":"integer"},"display_name":{"type":"string"},"email":{"type":"string"},"id":{"type":"integer"},"type":{"$ref":"#/components/schemas/EnumPrincipalType"},"uid":{"type":"string"},"updated":{"type":"integer"}},"type":"object"},"EnumPrincipalType":{"enum":["service","serviceaccount","user"],"type":"string"},"OpenapiRuleDefinition":{"oneOf":[{"$ref":"#/components/schemas/ProtectionBranch"},{"$ref":"#/components/schemas/ProtectionTag"},{"$ref":"#/components/schemas/ProtectionPush"}],"type":"object"},"ProtectionBranch":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefBranchLifecycle"},"pullreq":{"$ref":"#/components/schemas/ProtectionDefPullReq"}},"type":"object"},"ProtectionDefBypass":{"properties":{"repo_owners":{"type":"boolean"},"user_group_ids":{"items":{"type":"integer"},"type":"array"},"user_ids":{"items":{"type":"integer"},"type":"array"}},"type":"object"},"ProtectionDefBranchLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionDefPullReq":{"properties":{"approvals":{"$ref":"#/components/schemas/ProtectionDefApprovals"},"comments":{"$ref":"#/components/schemas/ProtectionDefComments"},"commits":{"$ref":"#/components/schemas/ProtectionDefCommits"},"merge":{"$ref":"#/components/schemas/ProtectionDefMerge"},"merge_queue":{"$ref":"#/components/schemas/ProtectionDefMergeQueue"},"reviewers":{"$ref":"#/components/schemas/ProtectionDefReviewers"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefApprovals":{"properties":{"require_code_owners":{"type":"boolean"},"require_latest_commit":{"type":"boolean"},"require_minimum_count":{"type":"integer"},"require_minimum_default_reviewer_count":{"type":"integer"},"require_no_change_request":{"type":"boolean"}},"type":"object"},"ProtectionDefComments":{"properties":{"require_resolve_all":{"type":"boolean"}},"type":"object"},"ProtectionDefCommits":{"properties":{"require_target_is_ancestor":{"type":"boolean"}},"type":"object"},"ProtectionDefMerge":{"properties":{"block":{"type":"boolean"},"delete_branch":{"type":"boolean"},"require_bypass_message":{"type":"boolean"},"strategies_allowed":{"items":{"$ref":"#/components/schemas/EnumMergeMethod"},"type":"array"}},"type":"object"},"EnumMergeMethod":{"enum":["fast-forward","merge","rebase","squash"],"type":"string"},"ProtectionDefMergeQueue":{"properties":{"checks_concurrency":{"type":"integer"},"group_size":{"type":"integer"},"max_check_duration_seconds":{"type":"integer"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefStatusChecks":{"properties":{"require_identifiers":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionDefReviewers":{"properties":{"default_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"default_user_group_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"request_code_owners":{"type":"boolean"}},"type":"object"},"ProtectionTag":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefTagLifecycle"}},"type":"object"},"ProtectionDefTagLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionPush":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"push":{"$ref":"#/components/schemas/ProtectionDefPush"}},"type":"object"},"ProtectionDefPush":{"properties":{"file_size_limit":{"type":"integer"},"principal_committer_match":{"type":"boolean"},"secret_scanning_enabled":{"type":"boolean"}},"type":"object"},"ProtectionPattern":{"nullable":true,"properties":{"default":{"type":"boolean"},"exclude":{"items":{"type":"string"},"type":"array"},"include":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionRepoTarget":{"nullable":true,"properties":{"exclude":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"},"include":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"}},"type":"object"},"ProtectionRepoTargetFilter":{"properties":{"ids":{"items":{"type":"integer"},"type":"array"},"patterns":{"items":{"type":"string"},"type":"array"}},"type":"object"},"TypesRepositoryCore":{"properties":{"default_branch":{"type":"string"},"fork_id":{"type":"integer"},"id":{"type":"integer"},"identifier":{"type":"string"},"parent_id":{"type":"integer"},"path":{"type":"string"},"type":{"$ref":"#/components/schemas/EnumRepoType"}},"type":"object"},"EnumRepoType":{"type":"string"},"EnumRuleState":{"enum":["active","disabled","monitor"],"nullable":true,"type":"string"},"OpenapiRuleType":{"enum":["branch","tag","push"],"type":"string"},"TypesUserGroupInfo":{"properties":{"description":{"type":"string"},"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"scope":{"type":"integer"}},"type":"object"},"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/repos/{repo_identifier}/rules/{rule_identifier}":{"get":{"operationId":"repoRuleGet","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"in":"path","name":"repo_identifier","required":true,"schema":{"type":"string"}},{"in":"path","name":"rule_identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenapiRule"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"Get repo protection rule","tags":["rules"]}}}}
```

## DELETE /repos/{repo\_identifier}/rules/{rule\_identifier}

> Delete repo protection rule

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/repos/{repo_identifier}/rules/{rule_identifier}":{"delete":{"operationId":"repoRuleDelete","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"in":"path","name":"repo_identifier","required":true,"schema":{"type":"string"}},{"in":"path","name":"rule_identifier","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No Content"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"Delete repo protection rule","tags":["rules"]}}}}
```

## PATCH /repos/{repo\_identifier}/rules/{rule\_identifier}

> Update repo protection rule

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"OpenapiRuleDefinition":{"oneOf":[{"$ref":"#/components/schemas/ProtectionBranch"},{"$ref":"#/components/schemas/ProtectionTag"},{"$ref":"#/components/schemas/ProtectionPush"}],"type":"object"},"ProtectionBranch":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefBranchLifecycle"},"pullreq":{"$ref":"#/components/schemas/ProtectionDefPullReq"}},"type":"object"},"ProtectionDefBypass":{"properties":{"repo_owners":{"type":"boolean"},"user_group_ids":{"items":{"type":"integer"},"type":"array"},"user_ids":{"items":{"type":"integer"},"type":"array"}},"type":"object"},"ProtectionDefBranchLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionDefPullReq":{"properties":{"approvals":{"$ref":"#/components/schemas/ProtectionDefApprovals"},"comments":{"$ref":"#/components/schemas/ProtectionDefComments"},"commits":{"$ref":"#/components/schemas/ProtectionDefCommits"},"merge":{"$ref":"#/components/schemas/ProtectionDefMerge"},"merge_queue":{"$ref":"#/components/schemas/ProtectionDefMergeQueue"},"reviewers":{"$ref":"#/components/schemas/ProtectionDefReviewers"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefApprovals":{"properties":{"require_code_owners":{"type":"boolean"},"require_latest_commit":{"type":"boolean"},"require_minimum_count":{"type":"integer"},"require_minimum_default_reviewer_count":{"type":"integer"},"require_no_change_request":{"type":"boolean"}},"type":"object"},"ProtectionDefComments":{"properties":{"require_resolve_all":{"type":"boolean"}},"type":"object"},"ProtectionDefCommits":{"properties":{"require_target_is_ancestor":{"type":"boolean"}},"type":"object"},"ProtectionDefMerge":{"properties":{"block":{"type":"boolean"},"delete_branch":{"type":"boolean"},"require_bypass_message":{"type":"boolean"},"strategies_allowed":{"items":{"$ref":"#/components/schemas/EnumMergeMethod"},"type":"array"}},"type":"object"},"EnumMergeMethod":{"enum":["fast-forward","merge","rebase","squash"],"type":"string"},"ProtectionDefMergeQueue":{"properties":{"checks_concurrency":{"type":"integer"},"group_size":{"type":"integer"},"max_check_duration_seconds":{"type":"integer"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefStatusChecks":{"properties":{"require_identifiers":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionDefReviewers":{"properties":{"default_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"default_user_group_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"request_code_owners":{"type":"boolean"}},"type":"object"},"ProtectionTag":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefTagLifecycle"}},"type":"object"},"ProtectionDefTagLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionPush":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"push":{"$ref":"#/components/schemas/ProtectionDefPush"}},"type":"object"},"ProtectionDefPush":{"properties":{"file_size_limit":{"type":"integer"},"principal_committer_match":{"type":"boolean"},"secret_scanning_enabled":{"type":"boolean"}},"type":"object"},"ProtectionPattern":{"nullable":true,"properties":{"default":{"type":"boolean"},"exclude":{"items":{"type":"string"},"type":"array"},"include":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionRepoTarget":{"nullable":true,"properties":{"exclude":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"},"include":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"}},"type":"object"},"ProtectionRepoTargetFilter":{"properties":{"ids":{"items":{"type":"integer"},"type":"array"},"patterns":{"items":{"type":"string"},"type":"array"}},"type":"object"},"EnumRuleState":{"enum":["active","disabled","monitor"],"nullable":true,"type":"string"},"OpenapiRuleType":{"enum":["branch","tag","push"],"type":"string"},"OpenapiRule":{"properties":{"created":{"type":"integer"},"created_by":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"repositories":{"additionalProperties":{"$ref":"#/components/schemas/TypesRepositoryCore"},"nullable":true,"type":"object"},"scope":{"type":"integer"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"updated":{"type":"integer"},"user_groups":{"additionalProperties":{"$ref":"#/components/schemas/TypesUserGroupInfo"},"nullable":true,"type":"object"},"users":{"additionalProperties":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"nullable":true,"type":"object"}},"type":"object"},"TypesPrincipalInfo":{"nullable":true,"properties":{"created":{"type":"integer"},"display_name":{"type":"string"},"email":{"type":"string"},"id":{"type":"integer"},"type":{"$ref":"#/components/schemas/EnumPrincipalType"},"uid":{"type":"string"},"updated":{"type":"integer"}},"type":"object"},"EnumPrincipalType":{"enum":["service","serviceaccount","user"],"type":"string"},"TypesRepositoryCore":{"properties":{"default_branch":{"type":"string"},"fork_id":{"type":"integer"},"id":{"type":"integer"},"identifier":{"type":"string"},"parent_id":{"type":"integer"},"path":{"type":"string"},"type":{"$ref":"#/components/schemas/EnumRepoType"}},"type":"object"},"EnumRepoType":{"type":"string"},"TypesUserGroupInfo":{"properties":{"description":{"type":"string"},"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"scope":{"type":"integer"}},"type":"object"},"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/repos/{repo_identifier}/rules/{rule_identifier}":{"patch":{"operationId":"repoRuleUpdate","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"in":"path","name":"repo_identifier","required":true,"schema":{"type":"string"}},{"in":"path","name":"rule_identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"nullable":true,"type":"string"},"identifier":{"nullable":true,"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"uid":{"deprecated":true,"nullable":true,"type":"string"}},"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenapiRule"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"Update repo protection rule","tags":["rules"]}}}}
```

## GET /rules

> List acc/org/proj protection rules

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"OpenapiRule":{"properties":{"created":{"type":"integer"},"created_by":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"repositories":{"additionalProperties":{"$ref":"#/components/schemas/TypesRepositoryCore"},"nullable":true,"type":"object"},"scope":{"type":"integer"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"updated":{"type":"integer"},"user_groups":{"additionalProperties":{"$ref":"#/components/schemas/TypesUserGroupInfo"},"nullable":true,"type":"object"},"users":{"additionalProperties":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"nullable":true,"type":"object"}},"type":"object"},"TypesPrincipalInfo":{"nullable":true,"properties":{"created":{"type":"integer"},"display_name":{"type":"string"},"email":{"type":"string"},"id":{"type":"integer"},"type":{"$ref":"#/components/schemas/EnumPrincipalType"},"uid":{"type":"string"},"updated":{"type":"integer"}},"type":"object"},"EnumPrincipalType":{"enum":["service","serviceaccount","user"],"type":"string"},"OpenapiRuleDefinition":{"oneOf":[{"$ref":"#/components/schemas/ProtectionBranch"},{"$ref":"#/components/schemas/ProtectionTag"},{"$ref":"#/components/schemas/ProtectionPush"}],"type":"object"},"ProtectionBranch":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefBranchLifecycle"},"pullreq":{"$ref":"#/components/schemas/ProtectionDefPullReq"}},"type":"object"},"ProtectionDefBypass":{"properties":{"repo_owners":{"type":"boolean"},"user_group_ids":{"items":{"type":"integer"},"type":"array"},"user_ids":{"items":{"type":"integer"},"type":"array"}},"type":"object"},"ProtectionDefBranchLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionDefPullReq":{"properties":{"approvals":{"$ref":"#/components/schemas/ProtectionDefApprovals"},"comments":{"$ref":"#/components/schemas/ProtectionDefComments"},"commits":{"$ref":"#/components/schemas/ProtectionDefCommits"},"merge":{"$ref":"#/components/schemas/ProtectionDefMerge"},"merge_queue":{"$ref":"#/components/schemas/ProtectionDefMergeQueue"},"reviewers":{"$ref":"#/components/schemas/ProtectionDefReviewers"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefApprovals":{"properties":{"require_code_owners":{"type":"boolean"},"require_latest_commit":{"type":"boolean"},"require_minimum_count":{"type":"integer"},"require_minimum_default_reviewer_count":{"type":"integer"},"require_no_change_request":{"type":"boolean"}},"type":"object"},"ProtectionDefComments":{"properties":{"require_resolve_all":{"type":"boolean"}},"type":"object"},"ProtectionDefCommits":{"properties":{"require_target_is_ancestor":{"type":"boolean"}},"type":"object"},"ProtectionDefMerge":{"properties":{"block":{"type":"boolean"},"delete_branch":{"type":"boolean"},"require_bypass_message":{"type":"boolean"},"strategies_allowed":{"items":{"$ref":"#/components/schemas/EnumMergeMethod"},"type":"array"}},"type":"object"},"EnumMergeMethod":{"enum":["fast-forward","merge","rebase","squash"],"type":"string"},"ProtectionDefMergeQueue":{"properties":{"checks_concurrency":{"type":"integer"},"group_size":{"type":"integer"},"max_check_duration_seconds":{"type":"integer"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefStatusChecks":{"properties":{"require_identifiers":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionDefReviewers":{"properties":{"default_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"default_user_group_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"request_code_owners":{"type":"boolean"}},"type":"object"},"ProtectionTag":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefTagLifecycle"}},"type":"object"},"ProtectionDefTagLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionPush":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"push":{"$ref":"#/components/schemas/ProtectionDefPush"}},"type":"object"},"ProtectionDefPush":{"properties":{"file_size_limit":{"type":"integer"},"principal_committer_match":{"type":"boolean"},"secret_scanning_enabled":{"type":"boolean"}},"type":"object"},"ProtectionPattern":{"nullable":true,"properties":{"default":{"type":"boolean"},"exclude":{"items":{"type":"string"},"type":"array"},"include":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionRepoTarget":{"nullable":true,"properties":{"exclude":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"},"include":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"}},"type":"object"},"ProtectionRepoTargetFilter":{"properties":{"ids":{"items":{"type":"integer"},"type":"array"},"patterns":{"items":{"type":"string"},"type":"array"}},"type":"object"},"TypesRepositoryCore":{"properties":{"default_branch":{"type":"string"},"fork_id":{"type":"integer"},"id":{"type":"integer"},"identifier":{"type":"string"},"parent_id":{"type":"integer"},"path":{"type":"string"},"type":{"$ref":"#/components/schemas/EnumRepoType"}},"type":"object"},"EnumRepoType":{"type":"string"},"EnumRuleState":{"enum":["active","disabled","monitor"],"nullable":true,"type":"string"},"OpenapiRuleType":{"enum":["branch","tag","push"],"type":"string"},"TypesUserGroupInfo":{"properties":{"description":{"type":"string"},"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"scope":{"type":"integer"}},"type":"object"},"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/rules":{"get":{"operationId":"spaceRuleList","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"description":"The substring by which the repository protection rules are filtered.","in":"query","name":"query","required":false,"schema":{"type":"string"}},{"description":"The types of rules to include.","explode":true,"in":"query","name":"type","required":false,"schema":{"items":{"enum":["branch","tag","push"],"type":"string"},"type":"array"},"style":"form"},{"description":"The order of the output.","in":"query","name":"order","required":false,"schema":{"default":"asc","enum":["asc","desc"],"type":"string"}},{"description":"The field by which the protection rules are sorted.","in":"query","name":"sort","required":false,"schema":{"default":"created_at","enum":["created_at","identifier","uid","updated_at"],"type":"string"}},{"description":"The page to return.","in":"query","name":"page","required":false,"schema":{"default":1,"minimum":1,"type":"integer"}},{"description":"The maximum number of results to return.","in":"query","name":"limit","required":false,"schema":{"default":30,"maximum":100,"minimum":1,"type":"integer"}},{"description":"The result should inherit entities from parent spaces.","in":"query","name":"inherited","required":false,"schema":{"default":false,"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/OpenapiRule"},"type":"array"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"List acc/org/proj protection rules","tags":["rules"]}}}}
```

## POST /rules

> Add acc/org/proj protection rule

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"OpenapiRuleDefinition":{"oneOf":[{"$ref":"#/components/schemas/ProtectionBranch"},{"$ref":"#/components/schemas/ProtectionTag"},{"$ref":"#/components/schemas/ProtectionPush"}],"type":"object"},"ProtectionBranch":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefBranchLifecycle"},"pullreq":{"$ref":"#/components/schemas/ProtectionDefPullReq"}},"type":"object"},"ProtectionDefBypass":{"properties":{"repo_owners":{"type":"boolean"},"user_group_ids":{"items":{"type":"integer"},"type":"array"},"user_ids":{"items":{"type":"integer"},"type":"array"}},"type":"object"},"ProtectionDefBranchLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionDefPullReq":{"properties":{"approvals":{"$ref":"#/components/schemas/ProtectionDefApprovals"},"comments":{"$ref":"#/components/schemas/ProtectionDefComments"},"commits":{"$ref":"#/components/schemas/ProtectionDefCommits"},"merge":{"$ref":"#/components/schemas/ProtectionDefMerge"},"merge_queue":{"$ref":"#/components/schemas/ProtectionDefMergeQueue"},"reviewers":{"$ref":"#/components/schemas/ProtectionDefReviewers"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefApprovals":{"properties":{"require_code_owners":{"type":"boolean"},"require_latest_commit":{"type":"boolean"},"require_minimum_count":{"type":"integer"},"require_minimum_default_reviewer_count":{"type":"integer"},"require_no_change_request":{"type":"boolean"}},"type":"object"},"ProtectionDefComments":{"properties":{"require_resolve_all":{"type":"boolean"}},"type":"object"},"ProtectionDefCommits":{"properties":{"require_target_is_ancestor":{"type":"boolean"}},"type":"object"},"ProtectionDefMerge":{"properties":{"block":{"type":"boolean"},"delete_branch":{"type":"boolean"},"require_bypass_message":{"type":"boolean"},"strategies_allowed":{"items":{"$ref":"#/components/schemas/EnumMergeMethod"},"type":"array"}},"type":"object"},"EnumMergeMethod":{"enum":["fast-forward","merge","rebase","squash"],"type":"string"},"ProtectionDefMergeQueue":{"properties":{"checks_concurrency":{"type":"integer"},"group_size":{"type":"integer"},"max_check_duration_seconds":{"type":"integer"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefStatusChecks":{"properties":{"require_identifiers":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionDefReviewers":{"properties":{"default_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"default_user_group_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"request_code_owners":{"type":"boolean"}},"type":"object"},"ProtectionTag":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefTagLifecycle"}},"type":"object"},"ProtectionDefTagLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionPush":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"push":{"$ref":"#/components/schemas/ProtectionDefPush"}},"type":"object"},"ProtectionDefPush":{"properties":{"file_size_limit":{"type":"integer"},"principal_committer_match":{"type":"boolean"},"secret_scanning_enabled":{"type":"boolean"}},"type":"object"},"ProtectionPattern":{"nullable":true,"properties":{"default":{"type":"boolean"},"exclude":{"items":{"type":"string"},"type":"array"},"include":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionRepoTarget":{"nullable":true,"properties":{"exclude":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"},"include":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"}},"type":"object"},"ProtectionRepoTargetFilter":{"properties":{"ids":{"items":{"type":"integer"},"type":"array"},"patterns":{"items":{"type":"string"},"type":"array"}},"type":"object"},"EnumRuleState":{"enum":["active","disabled","monitor"],"nullable":true,"type":"string"},"OpenapiRuleType":{"enum":["branch","tag","push"],"type":"string"},"OpenapiRule":{"properties":{"created":{"type":"integer"},"created_by":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"repositories":{"additionalProperties":{"$ref":"#/components/schemas/TypesRepositoryCore"},"nullable":true,"type":"object"},"scope":{"type":"integer"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"updated":{"type":"integer"},"user_groups":{"additionalProperties":{"$ref":"#/components/schemas/TypesUserGroupInfo"},"nullable":true,"type":"object"},"users":{"additionalProperties":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"nullable":true,"type":"object"}},"type":"object"},"TypesPrincipalInfo":{"nullable":true,"properties":{"created":{"type":"integer"},"display_name":{"type":"string"},"email":{"type":"string"},"id":{"type":"integer"},"type":{"$ref":"#/components/schemas/EnumPrincipalType"},"uid":{"type":"string"},"updated":{"type":"integer"}},"type":"object"},"EnumPrincipalType":{"enum":["service","serviceaccount","user"],"type":"string"},"TypesRepositoryCore":{"properties":{"default_branch":{"type":"string"},"fork_id":{"type":"integer"},"id":{"type":"integer"},"identifier":{"type":"string"},"parent_id":{"type":"integer"},"path":{"type":"string"},"type":{"$ref":"#/components/schemas/EnumRepoType"}},"type":"object"},"EnumRepoType":{"type":"string"},"TypesUserGroupInfo":{"properties":{"description":{"type":"string"},"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"scope":{"type":"integer"}},"type":"object"},"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/rules":{"post":{"operationId":"spaceRuleAdd","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"uid":{"deprecated":true,"type":"string"}},"type":"object"}}}},"responses":{"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenapiRule"}}},"description":"Created"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"Add acc/org/proj protection rule","tags":["rules"]}}}}
```

## GET /rules/{rule\_identifier}

> Get acc/org/proj protection rule

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"OpenapiRule":{"properties":{"created":{"type":"integer"},"created_by":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"repositories":{"additionalProperties":{"$ref":"#/components/schemas/TypesRepositoryCore"},"nullable":true,"type":"object"},"scope":{"type":"integer"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"updated":{"type":"integer"},"user_groups":{"additionalProperties":{"$ref":"#/components/schemas/TypesUserGroupInfo"},"nullable":true,"type":"object"},"users":{"additionalProperties":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"nullable":true,"type":"object"}},"type":"object"},"TypesPrincipalInfo":{"nullable":true,"properties":{"created":{"type":"integer"},"display_name":{"type":"string"},"email":{"type":"string"},"id":{"type":"integer"},"type":{"$ref":"#/components/schemas/EnumPrincipalType"},"uid":{"type":"string"},"updated":{"type":"integer"}},"type":"object"},"EnumPrincipalType":{"enum":["service","serviceaccount","user"],"type":"string"},"OpenapiRuleDefinition":{"oneOf":[{"$ref":"#/components/schemas/ProtectionBranch"},{"$ref":"#/components/schemas/ProtectionTag"},{"$ref":"#/components/schemas/ProtectionPush"}],"type":"object"},"ProtectionBranch":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefBranchLifecycle"},"pullreq":{"$ref":"#/components/schemas/ProtectionDefPullReq"}},"type":"object"},"ProtectionDefBypass":{"properties":{"repo_owners":{"type":"boolean"},"user_group_ids":{"items":{"type":"integer"},"type":"array"},"user_ids":{"items":{"type":"integer"},"type":"array"}},"type":"object"},"ProtectionDefBranchLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionDefPullReq":{"properties":{"approvals":{"$ref":"#/components/schemas/ProtectionDefApprovals"},"comments":{"$ref":"#/components/schemas/ProtectionDefComments"},"commits":{"$ref":"#/components/schemas/ProtectionDefCommits"},"merge":{"$ref":"#/components/schemas/ProtectionDefMerge"},"merge_queue":{"$ref":"#/components/schemas/ProtectionDefMergeQueue"},"reviewers":{"$ref":"#/components/schemas/ProtectionDefReviewers"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefApprovals":{"properties":{"require_code_owners":{"type":"boolean"},"require_latest_commit":{"type":"boolean"},"require_minimum_count":{"type":"integer"},"require_minimum_default_reviewer_count":{"type":"integer"},"require_no_change_request":{"type":"boolean"}},"type":"object"},"ProtectionDefComments":{"properties":{"require_resolve_all":{"type":"boolean"}},"type":"object"},"ProtectionDefCommits":{"properties":{"require_target_is_ancestor":{"type":"boolean"}},"type":"object"},"ProtectionDefMerge":{"properties":{"block":{"type":"boolean"},"delete_branch":{"type":"boolean"},"require_bypass_message":{"type":"boolean"},"strategies_allowed":{"items":{"$ref":"#/components/schemas/EnumMergeMethod"},"type":"array"}},"type":"object"},"EnumMergeMethod":{"enum":["fast-forward","merge","rebase","squash"],"type":"string"},"ProtectionDefMergeQueue":{"properties":{"checks_concurrency":{"type":"integer"},"group_size":{"type":"integer"},"max_check_duration_seconds":{"type":"integer"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefStatusChecks":{"properties":{"require_identifiers":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionDefReviewers":{"properties":{"default_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"default_user_group_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"request_code_owners":{"type":"boolean"}},"type":"object"},"ProtectionTag":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefTagLifecycle"}},"type":"object"},"ProtectionDefTagLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionPush":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"push":{"$ref":"#/components/schemas/ProtectionDefPush"}},"type":"object"},"ProtectionDefPush":{"properties":{"file_size_limit":{"type":"integer"},"principal_committer_match":{"type":"boolean"},"secret_scanning_enabled":{"type":"boolean"}},"type":"object"},"ProtectionPattern":{"nullable":true,"properties":{"default":{"type":"boolean"},"exclude":{"items":{"type":"string"},"type":"array"},"include":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionRepoTarget":{"nullable":true,"properties":{"exclude":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"},"include":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"}},"type":"object"},"ProtectionRepoTargetFilter":{"properties":{"ids":{"items":{"type":"integer"},"type":"array"},"patterns":{"items":{"type":"string"},"type":"array"}},"type":"object"},"TypesRepositoryCore":{"properties":{"default_branch":{"type":"string"},"fork_id":{"type":"integer"},"id":{"type":"integer"},"identifier":{"type":"string"},"parent_id":{"type":"integer"},"path":{"type":"string"},"type":{"$ref":"#/components/schemas/EnumRepoType"}},"type":"object"},"EnumRepoType":{"type":"string"},"EnumRuleState":{"enum":["active","disabled","monitor"],"nullable":true,"type":"string"},"OpenapiRuleType":{"enum":["branch","tag","push"],"type":"string"},"TypesUserGroupInfo":{"properties":{"description":{"type":"string"},"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"scope":{"type":"integer"}},"type":"object"},"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/rules/{rule_identifier}":{"get":{"operationId":"spaceRuleGet","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"in":"path","name":"rule_identifier","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenapiRule"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"Get acc/org/proj protection rule","tags":["rules"]}}}}
```

## DELETE /rules/{rule\_identifier}

> Delete acc/org/proj protection rule

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/rules/{rule_identifier}":{"delete":{"operationId":"spaceRuleDelete","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"in":"path","name":"rule_identifier","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"No Content"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"Delete acc/org/proj protection rule","tags":["rules"]}}}}
```

## PATCH /rules/{rule\_identifier}

> Update acc/org/proj protection rule

```json
{"openapi":"3.0.0","info":{"title":"API Specification","version":"1.111.0"},"servers":[{"url":"gateway/code/api/v1"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}},"schemas":{"OpenapiRuleDefinition":{"oneOf":[{"$ref":"#/components/schemas/ProtectionBranch"},{"$ref":"#/components/schemas/ProtectionTag"},{"$ref":"#/components/schemas/ProtectionPush"}],"type":"object"},"ProtectionBranch":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefBranchLifecycle"},"pullreq":{"$ref":"#/components/schemas/ProtectionDefPullReq"}},"type":"object"},"ProtectionDefBypass":{"properties":{"repo_owners":{"type":"boolean"},"user_group_ids":{"items":{"type":"integer"},"type":"array"},"user_ids":{"items":{"type":"integer"},"type":"array"}},"type":"object"},"ProtectionDefBranchLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionDefPullReq":{"properties":{"approvals":{"$ref":"#/components/schemas/ProtectionDefApprovals"},"comments":{"$ref":"#/components/schemas/ProtectionDefComments"},"commits":{"$ref":"#/components/schemas/ProtectionDefCommits"},"merge":{"$ref":"#/components/schemas/ProtectionDefMerge"},"merge_queue":{"$ref":"#/components/schemas/ProtectionDefMergeQueue"},"reviewers":{"$ref":"#/components/schemas/ProtectionDefReviewers"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefApprovals":{"properties":{"require_code_owners":{"type":"boolean"},"require_latest_commit":{"type":"boolean"},"require_minimum_count":{"type":"integer"},"require_minimum_default_reviewer_count":{"type":"integer"},"require_no_change_request":{"type":"boolean"}},"type":"object"},"ProtectionDefComments":{"properties":{"require_resolve_all":{"type":"boolean"}},"type":"object"},"ProtectionDefCommits":{"properties":{"require_target_is_ancestor":{"type":"boolean"}},"type":"object"},"ProtectionDefMerge":{"properties":{"block":{"type":"boolean"},"delete_branch":{"type":"boolean"},"require_bypass_message":{"type":"boolean"},"strategies_allowed":{"items":{"$ref":"#/components/schemas/EnumMergeMethod"},"type":"array"}},"type":"object"},"EnumMergeMethod":{"enum":["fast-forward","merge","rebase","squash"],"type":"string"},"ProtectionDefMergeQueue":{"properties":{"checks_concurrency":{"type":"integer"},"group_size":{"type":"integer"},"max_check_duration_seconds":{"type":"integer"},"status_checks":{"$ref":"#/components/schemas/ProtectionDefStatusChecks"}},"type":"object"},"ProtectionDefStatusChecks":{"properties":{"require_identifiers":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionDefReviewers":{"properties":{"default_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"default_user_group_reviewer_ids":{"items":{"type":"integer"},"type":"array"},"request_code_owners":{"type":"boolean"}},"type":"object"},"ProtectionTag":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"lifecycle":{"$ref":"#/components/schemas/ProtectionDefTagLifecycle"}},"type":"object"},"ProtectionDefTagLifecycle":{"properties":{"create_forbidden":{"type":"boolean"},"delete_forbidden":{"type":"boolean"},"update_force_forbidden":{"type":"boolean"}},"type":"object"},"ProtectionPush":{"properties":{"bypass":{"$ref":"#/components/schemas/ProtectionDefBypass"},"push":{"$ref":"#/components/schemas/ProtectionDefPush"}},"type":"object"},"ProtectionDefPush":{"properties":{"file_size_limit":{"type":"integer"},"principal_committer_match":{"type":"boolean"},"secret_scanning_enabled":{"type":"boolean"}},"type":"object"},"ProtectionPattern":{"nullable":true,"properties":{"default":{"type":"boolean"},"exclude":{"items":{"type":"string"},"type":"array"},"include":{"items":{"type":"string"},"type":"array"}},"type":"object"},"ProtectionRepoTarget":{"nullable":true,"properties":{"exclude":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"},"include":{"$ref":"#/components/schemas/ProtectionRepoTargetFilter"}},"type":"object"},"ProtectionRepoTargetFilter":{"properties":{"ids":{"items":{"type":"integer"},"type":"array"},"patterns":{"items":{"type":"string"},"type":"array"}},"type":"object"},"EnumRuleState":{"enum":["active","disabled","monitor"],"nullable":true,"type":"string"},"OpenapiRuleType":{"enum":["branch","tag","push"],"type":"string"},"OpenapiRule":{"properties":{"created":{"type":"integer"},"created_by":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"type":"string"},"identifier":{"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"repositories":{"additionalProperties":{"$ref":"#/components/schemas/TypesRepositoryCore"},"nullable":true,"type":"object"},"scope":{"type":"integer"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"updated":{"type":"integer"},"user_groups":{"additionalProperties":{"$ref":"#/components/schemas/TypesUserGroupInfo"},"nullable":true,"type":"object"},"users":{"additionalProperties":{"$ref":"#/components/schemas/TypesPrincipalInfo"},"nullable":true,"type":"object"}},"type":"object"},"TypesPrincipalInfo":{"nullable":true,"properties":{"created":{"type":"integer"},"display_name":{"type":"string"},"email":{"type":"string"},"id":{"type":"integer"},"type":{"$ref":"#/components/schemas/EnumPrincipalType"},"uid":{"type":"string"},"updated":{"type":"integer"}},"type":"object"},"EnumPrincipalType":{"enum":["service","serviceaccount","user"],"type":"string"},"TypesRepositoryCore":{"properties":{"default_branch":{"type":"string"},"fork_id":{"type":"integer"},"id":{"type":"integer"},"identifier":{"type":"string"},"parent_id":{"type":"integer"},"path":{"type":"string"},"type":{"$ref":"#/components/schemas/EnumRepoType"}},"type":"object"},"EnumRepoType":{"type":"string"},"TypesUserGroupInfo":{"properties":{"description":{"type":"string"},"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"scope":{"type":"integer"}},"type":"object"},"UsererrorError":{"properties":{"message":{"type":"string"},"values":{"additionalProperties":{},"type":"object"}},"type":"object"}}},"paths":{"/rules/{rule_identifier}":{"patch":{"operationId":"spaceRuleUpdate","parameters":[{"description":"Account Identifier for the Entity.","in":"query","name":"accountIdentifier","required":true,"schema":{"type":"string"}},{"description":"Organization Identifier for the Entity.","in":"query","name":"orgIdentifier","required":false,"schema":{"type":"string"}},{"description":"Project Identifier for the Entity.","in":"query","name":"projectIdentifier","required":false,"schema":{"type":"string"}},{"in":"path","name":"rule_identifier","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"definition":{"$ref":"#/components/schemas/OpenapiRuleDefinition"},"description":{"nullable":true,"type":"string"},"identifier":{"nullable":true,"type":"string"},"pattern":{"$ref":"#/components/schemas/ProtectionPattern"},"repo_target":{"$ref":"#/components/schemas/ProtectionRepoTarget"},"state":{"$ref":"#/components/schemas/EnumRuleState"},"type":{"$ref":"#/components/schemas/OpenapiRuleType"},"uid":{"deprecated":true,"nullable":true,"type":"string"}},"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenapiRule"}}},"description":"OK"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Not Found"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsererrorError"}}},"description":"Internal Server Error"}},"summary":"Update acc/org/proj protection rule","tags":["rules"]}}}}
```
