# Set app access restrictions

From **GitHub v3 REST API**.

`PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps`

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](https://docs.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation.

Replaces the list of apps that have push access to this branch. This removes all apps that previously had push access and grants push access to the new list of apps. Only installed GitHub Apps with `write` access to the `contents` permission can be added as authorized actors on a protected branch.

| Type    | Description                                                                                                                                                |
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `array` | The GitHub Apps that have push access to this branch. Use the app's `slug`. **Note**: The list of users, apps, and teams in total is limited to 100 items. |

## Parameters

### `owner`

- Location: path
- Required: true
- Type: `string`

### `repo`

- Location: path
- Required: true
- Type: `string`

### `branch`

- Location: path
- Required: true
- Type: `string`

The name of the branch.

## Request body

- Required: false
### `application/json`

```json
{"oneOf":[{"example":{"apps":["my-app"]},"properties":{"apps":{"description":"apps parameter","items":{"type":"string"},"type":"array"}},"required":["apps"],"type":"object"},{"items":{"type":"string"},"type":"array"}]}
```

## Responses

### `200`

Response

### `application/json`

- Type: `array`

```json
[
  {
    "created_at": "2017-07-08T16:18:44-04:00",
    "description": "",
    "events": [
      "push",
      "pull_request"
    ],
    "external_url": "https://example.com",
    "html_url": "https://github.com/apps/octoapp",
    "id": 1,
    "name": "Octocat App",
    "node_id": "MDExOkludGVncmF0aW9uMQ==",
    "owner": {
      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
      "events_url": "https://api.github.com/orgs/github/events",
      "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}",
      "gravatar_id": "",
      "html_url": "https://github.com/octocat",
      "id": 1,
      "login": "github",
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
      "organizations_url": "https://api.github.com/users/octocat/orgs",
      "received_events_url": "https://api.github.com/users/octocat/received_events",
      "repos_url": "https://api.github.com/orgs/github/repos",
      "site_admin": true,
      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
      "type": "User",
      "url": "https://api.github.com/orgs/github"
    },
    "permissions": {
      "contents": "read",
      "issues": "write",
      "metadata": "read",
      "single_file": "write"
    },
    "slug": "octoapp",
    "updated_at": "2017-07-08T16:18:44-04:00"
  }
]
```

```json
{"items":{"$ref":"#/components/schemas/integration"},"type":"array"}
```

### `422`

Validation failed

### `application/json`

- Type: `object`

Validation Error

```json
{"description":"Validation Error","properties":{"documentation_url":{"type":"string"},"errors":{"items":{"properties":{"code":{"type":"string"},"field":{"type":"string"},"index":{"type":"integer"},"message":{"type":"string"},"resource":{"type":"string"},"value":{"oneOf":[{"nullable":true,"type":"string"},{"nullable":true,"type":"integer"},{"items":{"type":"string"},"nullable":true,"type":"array"}]}},"required":["code"],"type":"object"},"type":"array"},"message":{"type":"string"}},"required":["message","documentation_url"],"title":"Validation Error","type":"object"}
```

## Request examples

### cURL

```shell
curl --request PUT \
  --url {protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps \
  --header 'content-type: application/json' \
  --data 'string'
```
