Search + K

Command Palette

Search for a command to run...

Sign In

Add app access restrictions

POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps
Copy endpoint
https://api.github.com

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.

Parameters

path Path Parameters

Name Type
owner required

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

string
repo required

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

string
branch required

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

string

Request Body

application/json required
{ apps: string[]; }

Responses

200 application/json

Response

type Integration = {
id: number;
slug?: string;
node_id: string;
client_id?: string;
owner: SimpleUser

A GitHub user.

interface SimpleUser {
name?: string | null;
email?: string | null;
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string;
user_view_type?: string;
}
| Enterprise

An enterprise on GitHub.

interface Enterprise {
description?: string | null;
html_url: string;
website_url?: string | null;
id: number;
node_id: string;
name: string;
slug: string;
created_at: string | null;
updated_at: string | null;
avatar_url: string;
}
;
name: string;
description: string | null;
external_url: string;
html_url: string;
created_at: string;
updated_at: string;
permissions: {
issues?: string;
checks?: string;
metadata?: string;
contents?: string;
deployments?: string;
[key: string]: string;
}
;
events: string[];
installations_count?: number;
}
| null
[]

Client Errors

422 application/json

Validation failed, or the endpoint has been spammed.

interface ValidationError {
message: string;
documentation_url: string;
errors?: {
resource?: string;
field?: string;
message?: string;
code: string;
index?: number;
value?: string[] | string | number | null;
}
[]
;
}