For the complete documentation index, see llms.txt. This page is also available as Markdown.

Rules

List repo protection rules

get
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Path parameters
repo_identifierstringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

querystringOptional

The substring by which the repository protection rules are filtered.

orderstring · enumOptional

The order of the output.

Default: ascPossible values:
sortstring · enumOptional

The field by which the protection rules are sorted.

Default: created_atPossible values:
pageinteger · min: 1Optional

The page to return.

Default: 1
limitinteger · min: 1 · max: 100Optional

The maximum number of results to return.

Default: 30
inheritedbooleanOptional

The result should inherit entities from parent spaces.

Default: false
Responses
200

OK

application/json
createdintegerOptional
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
scopeintegerOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
updatedintegerOptional
get/repos/{repo_identifier}/rules
GET /code/api/v1/repos/{repo_identifier}/rules?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Accept: */*
[
  {
    "created": 1,
    "created_by": {
      "created": 1,
      "display_name": "text",
      "email": "text",
      "id": 1,
      "type": "service",
      "uid": "text",
      "updated": 1
    },
    "definition": {
      "bypass": {
        "repo_owners": true,
        "user_group_ids": [
          1
        ],
        "user_ids": [
          1
        ]
      },
      "lifecycle": {
        "create_forbidden": true,
        "delete_forbidden": true,
        "update_forbidden": true,
        "update_force_forbidden": true
      },
      "pullreq": {
        "approvals": {
          "require_code_owners": true,
          "require_latest_commit": true,
          "require_minimum_count": 1,
          "require_minimum_default_reviewer_count": 1,
          "require_no_change_request": true
        },
        "comments": {
          "require_resolve_all": true
        },
        "commits": {
          "require_target_is_ancestor": true
        },
        "merge": {
          "block": true,
          "delete_branch": true,
          "require_bypass_message": true,
          "strategies_allowed": [
            "fast-forward"
          ]
        },
        "merge_queue": {
          "checks_concurrency": 1,
          "group_size": 1,
          "max_check_duration_seconds": 1,
          "status_checks": {
            "require_identifiers": [
              "text"
            ]
          }
        },
        "reviewers": {
          "default_reviewer_ids": [
            1
          ],
          "default_user_group_reviewer_ids": [
            1
          ],
          "request_code_owners": true
        },
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      }
    },
    "description": "text",
    "identifier": "text",
    "pattern": {
      "default": true,
      "exclude": [
        "text"
      ],
      "include": [
        "text"
      ]
    },
    "repo_target": {
      "exclude": {
        "ids": [
          1
        ],
        "patterns": [
          "text"
        ]
      },
      "include": {
        "ids": [
          1
        ],
        "patterns": [
          "text"
        ]
      }
    },
    "repositories": {
      "ANY_ADDITIONAL_PROPERTY": {
        "default_branch": "text",
        "fork_id": 1,
        "id": 1,
        "identifier": "text",
        "parent_id": 1,
        "path": "text",
        "type": "text"
      }
    },
    "scope": 1,
    "state": "active",
    "type": "branch",
    "updated": 1,
    "user_groups": {
      "ANY_ADDITIONAL_PROPERTY": {
        "description": "text",
        "id": 1,
        "identifier": "text",
        "name": "text",
        "scope": 1
      }
    },
    "users": {
      "ANY_ADDITIONAL_PROPERTY": {
        "created": 1,
        "display_name": "text",
        "email": "text",
        "id": 1,
        "type": "service",
        "uid": "text",
        "updated": 1
      }
    }
  }
]

Add repo protection rule

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Path parameters
repo_identifierstringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

Body
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
uidstringOptionalDeprecated
Responses
201

Created

application/json
createdintegerOptional
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
scopeintegerOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
updatedintegerOptional
post/repos/{repo_identifier}/rules
POST /code/api/v1/repos/{repo_identifier}/rules?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 1108

{
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "state": "active",
  "type": "branch"
}
{
  "created": 1,
  "created_by": {
    "created": 1,
    "display_name": "text",
    "email": "text",
    "id": 1,
    "type": "service",
    "uid": "text",
    "updated": 1
  },
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "repositories": {
    "ANY_ADDITIONAL_PROPERTY": {
      "default_branch": "text",
      "fork_id": 1,
      "id": 1,
      "identifier": "text",
      "parent_id": 1,
      "path": "text",
      "type": "text"
    }
  },
  "scope": 1,
  "state": "active",
  "type": "branch",
  "updated": 1,
  "user_groups": {
    "ANY_ADDITIONAL_PROPERTY": {
      "description": "text",
      "id": 1,
      "identifier": "text",
      "name": "text",
      "scope": 1
    }
  },
  "users": {
    "ANY_ADDITIONAL_PROPERTY": {
      "created": 1,
      "display_name": "text",
      "email": "text",
      "id": 1,
      "type": "service",
      "uid": "text",
      "updated": 1
    }
  }
}

Get repo protection rule

get
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Path parameters
repo_identifierstringRequired
rule_identifierstringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

Responses
200

OK

application/json
createdintegerOptional
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
scopeintegerOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
updatedintegerOptional
get/repos/{repo_identifier}/rules/{rule_identifier}
GET /code/api/v1/repos/{repo_identifier}/rules/{rule_identifier}?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Accept: */*
{
  "created": 1,
  "created_by": {
    "created": 1,
    "display_name": "text",
    "email": "text",
    "id": 1,
    "type": "service",
    "uid": "text",
    "updated": 1
  },
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "repositories": {
    "ANY_ADDITIONAL_PROPERTY": {
      "default_branch": "text",
      "fork_id": 1,
      "id": 1,
      "identifier": "text",
      "parent_id": 1,
      "path": "text",
      "type": "text"
    }
  },
  "scope": 1,
  "state": "active",
  "type": "branch",
  "updated": 1,
  "user_groups": {
    "ANY_ADDITIONAL_PROPERTY": {
      "description": "text",
      "id": 1,
      "identifier": "text",
      "name": "text",
      "scope": 1
    }
  },
  "users": {
    "ANY_ADDITIONAL_PROPERTY": {
      "created": 1,
      "display_name": "text",
      "email": "text",
      "id": 1,
      "type": "service",
      "uid": "text",
      "updated": 1
    }
  }
}

Delete repo protection rule

delete
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Path parameters
repo_identifierstringRequired
rule_identifierstringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

Responses
204

No Content

No content

delete/repos/{repo_identifier}/rules/{rule_identifier}
DELETE /code/api/v1/repos/{repo_identifier}/rules/{rule_identifier}?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Accept: */*

No content

Update repo protection rule

patch
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Path parameters
repo_identifierstringRequired
rule_identifierstringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

Body
definitionone ofOptional
or
or
descriptionstring · nullableOptional
identifierstring · nullableOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
uidstring · nullableOptionalDeprecated
Responses
200

OK

application/json
createdintegerOptional
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
scopeintegerOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
updatedintegerOptional
patch/repos/{repo_identifier}/rules/{rule_identifier}
PATCH /code/api/v1/repos/{repo_identifier}/rules/{rule_identifier}?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 1108

{
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "state": "active",
  "type": "branch"
}
{
  "created": 1,
  "created_by": {
    "created": 1,
    "display_name": "text",
    "email": "text",
    "id": 1,
    "type": "service",
    "uid": "text",
    "updated": 1
  },
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "repositories": {
    "ANY_ADDITIONAL_PROPERTY": {
      "default_branch": "text",
      "fork_id": 1,
      "id": 1,
      "identifier": "text",
      "parent_id": 1,
      "path": "text",
      "type": "text"
    }
  },
  "scope": 1,
  "state": "active",
  "type": "branch",
  "updated": 1,
  "user_groups": {
    "ANY_ADDITIONAL_PROPERTY": {
      "description": "text",
      "id": 1,
      "identifier": "text",
      "name": "text",
      "scope": 1
    }
  },
  "users": {
    "ANY_ADDITIONAL_PROPERTY": {
      "created": 1,
      "display_name": "text",
      "email": "text",
      "id": 1,
      "type": "service",
      "uid": "text",
      "updated": 1
    }
  }
}

List acc/org/proj protection rules

get
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

querystringOptional

The substring by which the repository protection rules are filtered.

orderstring · enumOptional

The order of the output.

Default: ascPossible values:
sortstring · enumOptional

The field by which the protection rules are sorted.

Default: created_atPossible values:
pageinteger · min: 1Optional

The page to return.

Default: 1
limitinteger · min: 1 · max: 100Optional

The maximum number of results to return.

Default: 30
inheritedbooleanOptional

The result should inherit entities from parent spaces.

Default: false
Responses
200

OK

application/json
createdintegerOptional
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
scopeintegerOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
updatedintegerOptional
get/rules
GET /code/api/v1/rules?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Accept: */*
[
  {
    "created": 1,
    "created_by": {
      "created": 1,
      "display_name": "text",
      "email": "text",
      "id": 1,
      "type": "service",
      "uid": "text",
      "updated": 1
    },
    "definition": {
      "bypass": {
        "repo_owners": true,
        "user_group_ids": [
          1
        ],
        "user_ids": [
          1
        ]
      },
      "lifecycle": {
        "create_forbidden": true,
        "delete_forbidden": true,
        "update_forbidden": true,
        "update_force_forbidden": true
      },
      "pullreq": {
        "approvals": {
          "require_code_owners": true,
          "require_latest_commit": true,
          "require_minimum_count": 1,
          "require_minimum_default_reviewer_count": 1,
          "require_no_change_request": true
        },
        "comments": {
          "require_resolve_all": true
        },
        "commits": {
          "require_target_is_ancestor": true
        },
        "merge": {
          "block": true,
          "delete_branch": true,
          "require_bypass_message": true,
          "strategies_allowed": [
            "fast-forward"
          ]
        },
        "merge_queue": {
          "checks_concurrency": 1,
          "group_size": 1,
          "max_check_duration_seconds": 1,
          "status_checks": {
            "require_identifiers": [
              "text"
            ]
          }
        },
        "reviewers": {
          "default_reviewer_ids": [
            1
          ],
          "default_user_group_reviewer_ids": [
            1
          ],
          "request_code_owners": true
        },
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      }
    },
    "description": "text",
    "identifier": "text",
    "pattern": {
      "default": true,
      "exclude": [
        "text"
      ],
      "include": [
        "text"
      ]
    },
    "repo_target": {
      "exclude": {
        "ids": [
          1
        ],
        "patterns": [
          "text"
        ]
      },
      "include": {
        "ids": [
          1
        ],
        "patterns": [
          "text"
        ]
      }
    },
    "repositories": {
      "ANY_ADDITIONAL_PROPERTY": {
        "default_branch": "text",
        "fork_id": 1,
        "id": 1,
        "identifier": "text",
        "parent_id": 1,
        "path": "text",
        "type": "text"
      }
    },
    "scope": 1,
    "state": "active",
    "type": "branch",
    "updated": 1,
    "user_groups": {
      "ANY_ADDITIONAL_PROPERTY": {
        "description": "text",
        "id": 1,
        "identifier": "text",
        "name": "text",
        "scope": 1
      }
    },
    "users": {
      "ANY_ADDITIONAL_PROPERTY": {
        "created": 1,
        "display_name": "text",
        "email": "text",
        "id": 1,
        "type": "service",
        "uid": "text",
        "updated": 1
      }
    }
  }
]

Add acc/org/proj protection rule

post
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

Body
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
uidstringOptionalDeprecated
Responses
201

Created

application/json
createdintegerOptional
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
scopeintegerOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
updatedintegerOptional
post/rules
POST /code/api/v1/rules?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 1108

{
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "state": "active",
  "type": "branch"
}
{
  "created": 1,
  "created_by": {
    "created": 1,
    "display_name": "text",
    "email": "text",
    "id": 1,
    "type": "service",
    "uid": "text",
    "updated": 1
  },
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "repositories": {
    "ANY_ADDITIONAL_PROPERTY": {
      "default_branch": "text",
      "fork_id": 1,
      "id": 1,
      "identifier": "text",
      "parent_id": 1,
      "path": "text",
      "type": "text"
    }
  },
  "scope": 1,
  "state": "active",
  "type": "branch",
  "updated": 1,
  "user_groups": {
    "ANY_ADDITIONAL_PROPERTY": {
      "description": "text",
      "id": 1,
      "identifier": "text",
      "name": "text",
      "scope": 1
    }
  },
  "users": {
    "ANY_ADDITIONAL_PROPERTY": {
      "created": 1,
      "display_name": "text",
      "email": "text",
      "id": 1,
      "type": "service",
      "uid": "text",
      "updated": 1
    }
  }
}

Get acc/org/proj protection rule

get
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Path parameters
rule_identifierstringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

Responses
200

OK

application/json
createdintegerOptional
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
scopeintegerOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
updatedintegerOptional
get/rules/{rule_identifier}
GET /code/api/v1/rules/{rule_identifier}?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Accept: */*
{
  "created": 1,
  "created_by": {
    "created": 1,
    "display_name": "text",
    "email": "text",
    "id": 1,
    "type": "service",
    "uid": "text",
    "updated": 1
  },
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "repositories": {
    "ANY_ADDITIONAL_PROPERTY": {
      "default_branch": "text",
      "fork_id": 1,
      "id": 1,
      "identifier": "text",
      "parent_id": 1,
      "path": "text",
      "type": "text"
    }
  },
  "scope": 1,
  "state": "active",
  "type": "branch",
  "updated": 1,
  "user_groups": {
    "ANY_ADDITIONAL_PROPERTY": {
      "description": "text",
      "id": 1,
      "identifier": "text",
      "name": "text",
      "scope": 1
    }
  },
  "users": {
    "ANY_ADDITIONAL_PROPERTY": {
      "created": 1,
      "display_name": "text",
      "email": "text",
      "id": 1,
      "type": "service",
      "uid": "text",
      "updated": 1
    }
  }
}

Delete acc/org/proj protection rule

delete
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Path parameters
rule_identifierstringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

Responses
204

No Content

No content

delete/rules/{rule_identifier}
DELETE /code/api/v1/rules/{rule_identifier}?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Accept: */*

No content

Update acc/org/proj protection rule

patch
Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
x-api-keystringRequired
Path parameters
rule_identifierstringRequired
Query parameters
accountIdentifierstringRequired

Account Identifier for the Entity.

orgIdentifierstringOptional

Organization Identifier for the Entity.

projectIdentifierstringOptional

Project Identifier for the Entity.

Body
definitionone ofOptional
or
or
descriptionstring · nullableOptional
identifierstring · nullableOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
uidstring · nullableOptionalDeprecated
Responses
200

OK

application/json
createdintegerOptional
definitionone ofOptional
or
or
descriptionstringOptional
identifierstringOptional
scopeintegerOptional
statestring · enum · nullableOptionalPossible values:
typestring · enumOptionalPossible values:
updatedintegerOptional
patch/rules/{rule_identifier}
PATCH /code/api/v1/rules/{rule_identifier}?accountIdentifier=text HTTP/1.1
Authorization: Bearer YOUR_SECRET_TOKEN
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 1108

{
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "state": "active",
  "type": "branch"
}
{
  "created": 1,
  "created_by": {
    "created": 1,
    "display_name": "text",
    "email": "text",
    "id": 1,
    "type": "service",
    "uid": "text",
    "updated": 1
  },
  "definition": {
    "bypass": {
      "repo_owners": true,
      "user_group_ids": [
        1
      ],
      "user_ids": [
        1
      ]
    },
    "lifecycle": {
      "create_forbidden": true,
      "delete_forbidden": true,
      "update_forbidden": true,
      "update_force_forbidden": true
    },
    "pullreq": {
      "approvals": {
        "require_code_owners": true,
        "require_latest_commit": true,
        "require_minimum_count": 1,
        "require_minimum_default_reviewer_count": 1,
        "require_no_change_request": true
      },
      "comments": {
        "require_resolve_all": true
      },
      "commits": {
        "require_target_is_ancestor": true
      },
      "merge": {
        "block": true,
        "delete_branch": true,
        "require_bypass_message": true,
        "strategies_allowed": [
          "fast-forward"
        ]
      },
      "merge_queue": {
        "checks_concurrency": 1,
        "group_size": 1,
        "max_check_duration_seconds": 1,
        "status_checks": {
          "require_identifiers": [
            "text"
          ]
        }
      },
      "reviewers": {
        "default_reviewer_ids": [
          1
        ],
        "default_user_group_reviewer_ids": [
          1
        ],
        "request_code_owners": true
      },
      "status_checks": {
        "require_identifiers": [
          "text"
        ]
      }
    }
  },
  "description": "text",
  "identifier": "text",
  "pattern": {
    "default": true,
    "exclude": [
      "text"
    ],
    "include": [
      "text"
    ]
  },
  "repo_target": {
    "exclude": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    },
    "include": {
      "ids": [
        1
      ],
      "patterns": [
        "text"
      ]
    }
  },
  "repositories": {
    "ANY_ADDITIONAL_PROPERTY": {
      "default_branch": "text",
      "fork_id": 1,
      "id": 1,
      "identifier": "text",
      "parent_id": 1,
      "path": "text",
      "type": "text"
    }
  },
  "scope": 1,
  "state": "active",
  "type": "branch",
  "updated": 1,
  "user_groups": {
    "ANY_ADDITIONAL_PROPERTY": {
      "description": "text",
      "id": 1,
      "identifier": "text",
      "name": "text",
      "scope": 1
    }
  },
  "users": {
    "ANY_ADDITIONAL_PROPERTY": {
      "created": 1,
      "display_name": "text",
      "email": "text",
      "id": 1,
      "type": "service",
      "uid": "text",
      "updated": 1
    }
  }
}

Last updated

Was this helpful?