GET
/repos/{owner}/{repo}/rulesetsList repository rulesets
Lists all rulesets that apply to a repository. Use includes_parents to include rulesets configured at higher levels and targets to filter by rule target. Use page and per_page to paginate the results.
- RetriesRetries up to 2×, 500ms backoff, 30s timeout.
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 rulesets to return per page, up to 100. Defaults to 30 when omitted.
pageintegeroptional
The page number of results to retrieve. 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 rulesets, including each ruleset's identifier, name, source, enforcement level, target, bypass actors, 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 specified repository cannot be found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
500Returned when an internal server error occurs.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
Error handling
A 404 is returned when the repository cannot be found. A 500 is returned when the service encounters an internal error. per_page must not exceed 100, and targets must be a comma-separated list of rule targets when supplied.