GET
/repos/{owner}/{repo}/rulesetsList repository rulesets
Lists the rulesets for a repository. Use includes_parents to include rulesets configured at higher levels and targets to filter by a comma-separated list of rule targets.
ownerstringrequired
The account owner of the repository; the name is not case sensitive.
repostringrequired
The repository name without the `.git` extension; the name is not case sensitive.
per_pageintegeroptional
The number of results per page, up to 100. Defaults to 30 when omitted.
pageintegeroptional
The page number of results to fetch. Defaults to 1 when omitted.
includes_parentsbooleanoptional
Whether to include rulesets configured at higher levels that apply to the repository. Defaults to true when omitted.
targetsstringoptional
A comma-separated list of rule targets to filter by, such as `branch`, `tag`, or `push`.
200Returns an array of repository ruleset objects, including each ruleset's name, target, source, enforcement level, conditions, rules, and timestamps.
idintegerrequired
The ID of the ruleset
namestringrequired
The name of the ruleset
targetstringoptional
The target of the ruleset
source_typestringoptional
The type of the source of the ruleset
sourcestringrequired
The name of the source
enforcementstringrequired
The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page (`evaluate` is only available with GitHub Enterprise).
bypass_actorsarray<RepositoryRulesetBypassActor>optional
The actors that can bypass the rules in this ruleset
current_user_can_bypassstringoptional
The bypass type of the user making the API request for this ruleset. This field is only returned when
querying the repository-level endpoint.
node_idstringoptional
_linksobjectoptional
conditionsobjectoptional
Parameters for a repository ruleset ref name condition
rulesarray<RepositoryRule>optional
created_atstringoptional
updated_atstringoptional
404Returned when the repository resource is not found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
500Returned when an internal error occurs.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
Error handling
A 404 is returned when the repository resource is not found. A 500 is returned when an internal error occurs. The owner and repo path parameters must identify the repository; targets, when provided, filters results to the specified comma-separated rule targets.