repos

Get rules for a branch

Changed on

Returns all active rules that apply to the specified branch. The branch does not need to exist; rules that would apply to a branch with that name will be returned. All active rules that apply will be returned, regardless of the level at which they are configured (e.g. repository or organization). Rules in rulesets with "evaluate" or "disabled" enforcement statuses are not returned.

get/repos/{owner}/{repo}/rules/branches/{branch}

Request

  • Base URL: https://api.github.com
  • URL: https://api.github.com/repos/{owner}/{repo}/rules/branches/{branch}
  • Auth: none declared

Path parameters

ownerstring required

The account owner of the repository. The name is not case sensitive.

repostring required

The name of the repository without the .git extension. The name is not case sensitive.

branchstring required

The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.

Query parameters

per_pageinteger

The number of results per page (max 100). For more information, see "Using pagination in the REST API."

pageinteger

The page number of the results to fetch. For more information, see "Using pagination in the REST API."

Response

Response

Changes

  • 2026-03-10af34d5ad85d3Revision changes
    • breaking

      added subschema #18 subschema #19 subschema #20 to the response property oneOf list for the response status

    • info

      removed subschema #18 from the response property oneOf list for the response status