Sample - GitHub REST API
GET/orgs/{org}/rulesets

Get all organization repository rulesets

Get all the repository rulesets for an organization.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

4 parameters
orgstringrequired
The organization name. The name is not case sensitive.
per_pageintegeroptional
The number of results per page (max 100). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
Default:30
pageintegeroptional
The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)."
Default:1
targetsstringoptional
A comma-separated list of rule targets to filter by. If provided, only rulesets that apply to the specified targets will be returned. For example, `branch,tag,push`.

3 status codes
200Response
idintegerrequired
The ID of the ruleset
namestringrequired
The name of the ruleset
targetstringoptional
The target of the ruleset
Allowed:branchtagpushrepository
source_typestringoptional
The type of the source of the ruleset
Allowed:RepositoryOrganizationEnterprise
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).
Allowed:disabledactiveevaluate
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.
Allowed:alwayspull_requests_onlyneverexempt
node_idstringoptional
_linksobjectoptional
conditionsobjectoptional
Parameters for a repository ruleset ref name condition
rulesarray<RepositoryRule>optional
created_atstringoptional
updated_atstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
500Internal Error
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 404 is returned: Resource not found. A 500 is returned: Internal Error.