v56

latestOpenAPI 3.0.3MITraw.githubusercontent.com2026-08-011,4581,08113.3 MB
repos

Add app access restrictions

Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see GitHub's products in the GitHub Help documentation.

Grants the specified apps push access for this branch. Only GitHub Apps that are installed on the repository and that have been granted write access to the repository contents can be added as authorized actors on a protected branch.

post/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps

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.

Request body

appsstring[] required

The GitHub Apps that have push access to this branch. Use the slugified version of the app name. Note: The list of users, apps, and teams in total is limited to 100 items.

Example request

{
  "apps": [
    "my-app"
  ]
}

Response

Response

idinteger required

Unique identifier of the GitHub app

slugstring

The slug name of the GitHub app

node_idstring required
client_idstring
namestring required

The name of the GitHub app

descriptionstring nullable required
external_urlstring uri required
html_urlstring uri required
created_atstring date-time required
updated_atstring date-time required
eventsstring[] required

The list of events for the GitHub app. Note that the installation_target, security_advisory, and meta events are not included because they are global events and not specific to an installation.

installations_countinteger

The number of installations associated with the GitHub app. Only returned when the integration is requesting details about itself.

Example response

[
  {
    "id": 37,
    "slug": "probot-owners",
    "node_id": "MDExOkludGVncmF0aW9uMQ==",
    "client_id": "\"Iv1.25b5d1e65ffc4022\"",
    "owner": {
      "login": "octocat",
      "id": 1,
      "node_id": "MDQ6VXNlcjE=",
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "gravatar_id": "41d064eb2195891e12d0413f63227ea7",
      "url": "https://api.github.com/users/octocat",
      "html_url": "https://github.com/octocat",
      "followers_url": "https://api.github.com/users/octocat/followers",
      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "repos_url": "https://api.github.com/users/octocat/repos",
      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "type": "User",
      "starred_at": "\"2020-07-09T00:17:55Z\"",
      "user_view_type": "public"
    },
    "name": "Probot Owners",
    "description": "The description of the app.",
    "external_url": "https://example.com",
    "html_url": "https://github.com/apps/super-ci",
    "created_at": "2017-07-08T16:18:44-04:00",
    "updated_at": "2017-07-08T16:18:44-04:00",
    "permissions": {
      "issues": "read",
      "deployments": "write"
    },
    "events": [
      "label",
      "deployment"
    ],
    "installations_count": 5
  }
]