A comma-separated list of rule targets to filter by.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
500
Internal Error
yes
Create an organization repository ruleset
POST /orgs/{org}/rulesets
Create a repository ruleset for an organization.
Parameters
Name
In
Required
Description
org
path
yes
The organization name. The name is not case sensitive.
Responses
Status
Description
Has JSON body
201
Response
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
500
Internal Error
yes
List organization rule suites
GET /orgs/{org}/rulesets/rule-suites
Lists suites of rule evaluations at the organization level.
Parameters
Name
In
Required
Description
org
path
yes
The organization name. The name is not case sensitive.
ref
query
no
The name of the ref. Cannot contain wildcard characters. Optionally prefix with refs/heads/ to limit to branches or refs/tags/ to limit to tags. Omit the prefix to search across all refs. When specified, only rule evaluations triggered for this ref will be returned.
repository_name
query
no
The name of the repository to filter on.
time_period
query
no
The time period to filter by.
actor_name
query
no
The handle for the GitHub user account to filter on. When specified, only rule evaluations triggered by this actor will be returned.
rule_suite_result
query
no
The rule suite results to filter on. When specified, only suites with this result will be returned.
evaluate_status
query
no
The evaluate status to filter on. When specified, only rule suites resulting from rulesets with the specified evaluate status will be returned.
GET /orgs/{org}/rulesets/rule-suites/{rule_suite_id}
Gets information about a suite of rule evaluations from within an organization.
Parameters
Name
In
Required
Description
org
path
yes
The organization name. The name is not case sensitive.
rule_suite_id
path
yes
The unique identifier of the rule suite result.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
500
Internal Error
yes
Get an organization repository ruleset
GET /orgs/{org}/rulesets/{ruleset_id}
Get a repository ruleset for an organization.
Parameters
Name
In
Required
Description
org
path
yes
The organization name. The name is not case sensitive.
ruleset_id
path
yes
The ID of the ruleset.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
500
Internal Error
yes
Update an organization repository ruleset
PUT /orgs/{org}/rulesets/{ruleset_id}
Update a ruleset for an organization.
Parameters
Name
In
Required
Description
org
path
yes
The organization name. The name is not case sensitive.
ruleset_id
path
yes
The ID of the ruleset.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
500
Internal Error
yes
Delete an organization repository ruleset
DELETE /orgs/{org}/rulesets/{ruleset_id}
Delete a ruleset for an organization.
Parameters
Name
In
Required
Description
org
path
yes
The organization name. The name is not case sensitive.
ruleset_id
path
yes
The ID of the ruleset.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
500
Internal Error
yes
Get a repository
GET /repos/{owner}/{repo}
The parent and source objects are present when the repository is a fork. parent is the repository this repository was forked from, source is the ultimate source for the network.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
307
Temporary Redirect
yes
403
Forbidden
yes
422
Validation failed, or the endpoint has been spammed.
yes
404
Resource not found
yes
Delete a repository
DELETE /repos/{owner}/{repo}
Deleting a repository requires admin access.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
Response
no
403
If an organization owner has configured the organization to prevent members from deleting organization-owned repositories, a member will get this response:
yes
307
Temporary Redirect
yes
404
Resource not found
yes
409
Conflict
yes
List repository activities
GET /repos/{owner}/{repo}/activity
Lists a detailed history of changes to a repository, such as pushes, merges, force pushes, and branch changes, and associates these changes with commits and users.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
This deletes a single autolink reference by ID that was configured for the given repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
autolink_id
path
yes
The unique identifier of the autolink.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
Check if Dependabot security updates are enabled for a repository
GET /repos/{owner}/{repo}/automated-security-fixes
Shows whether Dependabot security updates are enabled, disabled or paused for a repository. The authenticated user must have admin read access to the repository. For more information, see "Configuring Dependabot security updates".
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response if Dependabot is enabled
yes
404
Not Found if Dependabot is not enabled for the repository
no
Enable Dependabot security updates
PUT /repos/{owner}/{repo}/automated-security-fixes
Enables Dependabot security updates for a repository. The authenticated user must have admin access to the repository. For more information, see "Configuring Dependabot security updates".
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Disables Dependabot security updates for a repository. The authenticated user must have admin access to the repository. For more information, see "Configuring Dependabot security updates".
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
Response
no
List branches
GET /repos/{owner}/{repo}/branches
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
protected
query
no
Setting to true returns only branches protected by branch protections or rulesets. When set to false, only unprotected branches are returned. Omitting this parameter returns all branches.
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
301
Moved permanently
yes
404
Resource not found
yes
Get branch protection
GET /repos/{owner}/{repo}/branches/{branch}/protection
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Update branch protection
PUT /repos/{owner}/{repo}/branches/{branch}/protection
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
403
Forbidden
yes
422
Validation failed, or the endpoint has been spammed.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
204
Response
no
403
Forbidden
yes
Get admin branch protection
GET /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
Set admin branch protection
POST /repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
Get pull request review protection
GET /repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
Get commit signature protection
GET /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Create commit signature protection
POST /repos/{owner}/{repo}/branches/{branch}/protection/required_signatures
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
Get status checks protection
GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
204
Response
no
Get all status check contexts
GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Add status check contexts
POST /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
403
Forbidden
yes
404
Resource not found
yes
Set status check contexts
PUT /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
Get access restrictions
GET /repos/{owner}/{repo}/branches/{branch}/protection/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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
204
Response
no
Get apps with access to the protected branch
GET /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 in the GitHub Help documentation.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Add app access restrictions
POST /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 in the GitHub Help documentation.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
Set app access restrictions
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 in the GitHub Help documentation.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
Get teams with access to the protected branch
GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Add team access restrictions
POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
Set team access restrictions
PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
Get users with access to the protected branch
GET /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Add user access restrictions
POST /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
Set user access restrictions
PUT /repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
Rename a branch
POST /repos/{owner}/{repo}/branches/{branch}/rename
Renames a branch in a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Responses
Status
Description
Has JSON body
201
Response
yes
403
Forbidden
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
List CODEOWNERS errors
GET /repos/{owner}/{repo}/codeowners/errors
List any syntax errors that are detected in the CODEOWNERS
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
ref
query
no
A branch, tag or commit name used to determine which version of the CODEOWNERS file to use. Default: the repository's default branch (e.g. main)
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
no
List repository collaborators
GET /repos/{owner}/{repo}/collaborators
For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
affiliation
query
no
Filter collaborators returned by their affiliation. outside means all outside collaborators of an organization-owned repository. direct means all collaborators with permissions to an organization-owned repository, regardless of organization membership status. all means all collaborators the authenticated user can see.
permission
query
no
Filter collaborators by the permissions they have on the repository. If not specified, all collaborators will be returned.
GET /repos/{owner}/{repo}/collaborators/{username}
For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
username
path
yes
The handle for the GitHub user account.
Responses
Status
Description
Has JSON body
204
Response if user is a collaborator
no
404
Not Found if user is not a collaborator
no
Add a repository collaborator
PUT /repos/{owner}/{repo}/collaborators/{username}
Add a user to a repository with a specified level of access. If the repository is owned by an organization, this API does not add the user to the organization - a user that has repository access without being an organization member is called an "outside collaborator" (if they are not an Enterprise Managed User) or a "repository collaborator" if they are an Enterprise Managed User. These users are exempt from some organization policies - see "Adding outside collaborators to repositories" to learn more about these collaborator types.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
username
path
yes
The handle for the GitHub user account.
Responses
Status
Description
Has JSON body
201
Response when a new invitation is created
yes
204
Response when:
- an existing collaborator is added as a collaborator
- an organization member is added as an individual collaborator
- an existing team member (whose team is also a repository collaborator) is added as an individual collaborator
no
422
Response when:
- validation failed, or the endpoint has been spammed
- an Enterprise Managed User (EMU) account was invited to a repository in an enterprise with personal user accounts
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
comment_id
path
yes
The unique identifier of the comment.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
List commits
GET /repos/{owner}/{repo}/commits
Signature verification object
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
sha
query
no
SHA or branch to start listing commits from. Default: the repository’s default branch (usually main).
path
query
no
Only commits containing this file path will be returned.
author
query
no
GitHub username or email address to use to filter by commit author.
committer
query
no
GitHub username or email address to use to filter by commit committer.
since
query
no
Only show results that were last updated after the given time. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Due to limitations of Git, timestamps must be between 1970-01-01 and 2099-12-31 (inclusive) or unexpected results may be returned.
until
query
no
Only commits before this date will be returned. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. Due to limitations of Git, timestamps must be between 1970-01-01 and 2099-12-31 (inclusive) or unexpected results may be returned.
GET /repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head
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.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
commit_sha
path
yes
The SHA of the commit.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
409
Conflict
yes
List commit comments
GET /repos/{owner}/{repo}/commits/{commit_sha}/comments
Lists the comments for a specified commit.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
POST /repos/{owner}/{repo}/commits/{commit_sha}/comments
Create a comment for a commit using its :commit_sha.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
commit_sha
path
yes
The SHA of the commit.
Responses
Status
Description
Has JSON body
201
Response
yes
403
Forbidden
yes
422
Validation failed, or the endpoint has been spammed.
yes
List pull requests associated with a commit
GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls
Lists the merged pull request that introduced the commit to the repository. If the commit is not present in the default branch, it will return merged and open pull requests associated with the commit.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
The commit reference. Can be a commit SHA, branch name (heads/BRANCH_NAME), or tag name (tags/TAG_NAME). For more information, see "Git References" in the Git documentation.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
404
Resource not found
yes
500
Internal Error
yes
503
Service unavailable
yes
409
Conflict
yes
Get the combined status for a specific reference
GET /repos/{owner}/{repo}/commits/{ref}/status
Users with pull access in a repository can access a combined view of commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
ref
path
yes
The commit reference. Can be a commit SHA, branch name (heads/BRANCH_NAME), or tag name (tags/TAG_NAME). For more information, see "Git References" in the Git documentation.
Users with pull access in a repository can view commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. Statuses are returned in reverse chronological order. The first status in the list will be the latest one.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
ref
path
yes
The commit reference. Can be a commit SHA, branch name (heads/BRANCH_NAME), or tag name (tags/TAG_NAME). For more information, see "Git References" in the Git documentation.
Returns all community profile metrics for a repository. The repository cannot be a fork.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
Compare two commits
GET /repos/{owner}/{repo}/compare/{basehead}
Compares two commits against one another. You can compare refs (branches or tags) and commit SHAs in the same repository, or you can compare refs and commit SHAs that exist in different repositories within the same repository network, including fork branches. For more information about how to view a repository's network, see "Understanding connections between repositories."
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
The base branch and head branch to compare. This parameter expects the format BASE...HEAD. Both must be branch names in repo. To compare with a branch that exists in a different repository in the same network as repo, the basehead parameter expects the format USERNAME:BASE...USERNAME:HEAD.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
500
Internal Error
yes
503
Service unavailable
yes
Get repository content
GET /repos/{owner}/{repo}/contents/{path}
Gets the contents of a file or directory in a repository. Specify the file path or directory with the path parameter. If you omit the path parameter, you will receive the contents of the repository's root directory.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
path
path
yes
path parameter
ref
query
no
The name of the commit/branch/tag. Default: the repository’s default branch.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
403
Forbidden
yes
302
Found
no
304
Not modified
no
Create or update file contents
PUT /repos/{owner}/{repo}/contents/{path}
Creates a new file or replaces an existing file in a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
path
path
yes
path parameter
Responses
Status
Description
Has JSON body
200
Response
yes
201
Response
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
409
Conflict
yes
Delete a file
DELETE /repos/{owner}/{repo}/contents/{path}
Deletes a file in a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
path
path
yes
path parameter
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
404
Resource not found
yes
409
Conflict
yes
503
Service unavailable
yes
List repository contributors
GET /repos/{owner}/{repo}/contributors
Lists contributors to the specified repository and sorts them by the number of commits per contributor in descending order. This endpoint may return information that is a few hours old because the GitHub REST API caches contributor data to improve performance.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
anon
query
no
Set to 1 or true to include anonymous contributors in results.
If the repository only has one deployment, you can delete the deployment regardless of its status. If the repository has more than one deployment, you can only delete inactive deployments. This ensures that repositories with multiple deployments will always have an active deployment.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
deployment_id
path
yes
deployment_id parameter
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
List deployment statuses
GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
Users with pull access can view deployment statuses for a deployment:
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
Users with push access can create deployment statuses for a given deployment.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
deployment_id
path
yes
deployment_id parameter
Responses
Status
Description
Has JSON body
201
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
Get a deployment status
GET /repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id}
Users with pull access can view a deployment status for a deployment:
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
deployment_id
path
yes
deployment_id parameter
status_id
path
yes
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Create a repository dispatch event
POST /repos/{owner}/{repo}/dispatches
You can use this endpoint to trigger a webhook event called repository_dispatch when you want activity that happens outside of GitHub to trigger a GitHub Actions workflow or GitHub App webhook. You must configure your GitHub Actions workflow or GitHub App to run when the repository_dispatch event occurs. For an example repository_dispatch webhook payload, see "RepositoryDispatchEvent."
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
List environments
GET /repos/{owner}/{repo}/environments
Lists the environments for a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
GET /repos/{owner}/{repo}/environments/{environment_name}
Anyone with read access to the repository can use this endpoint.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
environment_name
path
yes
The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.
Responses
Status
Description
Has JSON body
200
Response
yes
Create or update an environment
PUT /repos/{owner}/{repo}/environments/{environment_name}
Create or update an environment with protection rules, such as required reviewers. For more information about environment protection rules, see "Environments."
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
environment_name
path
yes
The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation error when the environment name is invalid or when protected_branches and custom_branch_policies in deployment_branch_policy are set to the same value
Deletes a deployment branch or tag policy for an environment.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
environment_name
path
yes
The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.
branch_policy_id
path
yes
The unique identifier of the branch policy.
Responses
Status
Description
Has JSON body
204
Response
no
Get all deployment protection rules for an environment
GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules
Gets all custom deployment protection rules that are enabled for an environment. Anyone with read access to the repository can use this endpoint. For more information about environments, see "Using environments for deployment."
Parameters
Name
In
Required
Description
environment_name
path
yes
The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
owner
path
yes
The account owner of the repository. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
List of deployment protection rules
yes
Create a custom deployment protection rule on an environment
POST /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules
Enable a custom deployment protection rule for an environment.
Parameters
Name
In
Required
Description
environment_name
path
yes
The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
owner
path
yes
The account owner of the repository. The name is not case sensitive.
Responses
Status
Description
Has JSON body
201
The enabled custom deployment protection rule
yes
List custom deployment rule integrations available for an environment
GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/apps
Gets all custom deployment protection rule integrations that are available for an environment.
Parameters
Name
In
Required
Description
environment_name
path
yes
The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
owner
path
yes
The account owner of the repository. The name is not case sensitive.
A list of custom deployment rule integrations available for this environment.
yes
Get a custom deployment protection rule
GET /repos/{owner}/{repo}/environments/{environment_name}/deployment_protection_rules/{protection_rule_id}
Gets an enabled custom deployment protection rule for an environment. Anyone with read access to the repository can use this endpoint. For more information about environments, see "Using environments for deployment."
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
environment_name
path
yes
The name of the environment. The name must be URL encoded. For example, any slashes in the name must be replaced with %2F.
protection_rule_id
path
yes
The unique identifier of the protection rule.
Responses
Status
Description
Has JSON body
200
Response
yes
Disable a custom protection rule for an environment
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Update a repository webhook
PATCH /repos/{owner}/{repo}/hooks/{hook_id}
Updates a webhook configured in a repository. If you previously had a secret set, you must provide the same secret or set a new secret or the secret will be removed. If you are only updating individual webhook config properties, use "Update a webhook configuration for a repository."
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
404
Resource not found
yes
Delete a repository webhook
DELETE /repos/{owner}/{repo}/hooks/{hook_id}
Delete a webhook for an organization.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
Get a webhook configuration for a repository
GET /repos/{owner}/{repo}/hooks/{hook_id}/config
Returns the webhook configuration for a repository. To get more information about the webhook, including the active state and events, use "Get a repository webhook."
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
Updates the webhook configuration for a repository. To update more information about the webhook, including the active state and events, use "Update a repository webhook."
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
Responses
Status
Description
Has JSON body
200
Response
yes
List deliveries for a repository webhook
GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries
Returns a list of webhook deliveries for a webhook configured in a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the link header for the next and previous page cursors.
status
query
no
Returns webhook deliveries filtered by delivery outcome classification based on status_code range. A status of success returns deliveries with a status_code in the 200-399 range (inclusive). A status of failure returns deliveries with a status_code in the 400-599 range (inclusive).
Responses
Status
Description
Has JSON body
200
Response
yes
400
Bad Request
yes
422
Validation failed, or the endpoint has been spammed.
yes
Get a delivery for a repository webhook
GET /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}
Returns a delivery for a webhook configured in a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
delivery_id
path
yes
Responses
Status
Description
Has JSON body
200
Response
yes
400
Bad Request
yes
422
Validation failed, or the endpoint has been spammed.
yes
Redeliver a delivery for a repository webhook
POST /repos/{owner}/{repo}/hooks/{hook_id}/deliveries/{delivery_id}/attempts
Redeliver a webhook delivery for a webhook configured in a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
delivery_id
path
yes
Responses
Status
Description
Has JSON body
202
Accepted
yes
400
Bad Request
yes
422
Validation failed, or the endpoint has been spammed.
yes
Ping a repository webhook
POST /repos/{owner}/{repo}/hooks/{hook_id}/pings
This will trigger a ping event to be sent to the hook.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
Test the push repository webhook
POST /repos/{owner}/{repo}/hooks/{hook_id}/tests
This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
hook_id
path
yes
The unique identifier of the hook. You can find this value in the X-GitHub-Hook-ID header of a webhook delivery.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
Check if immutable releases are enabled for a repository
GET /repos/{owner}/{repo}/immutable-releases
Shows whether immutable releases are enabled or disabled. Also identifies whether immutability is being
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response if immutable releases are enabled
yes
404
Not Found if immutable releases are not enabled for the repository
no
Enable immutable releases
PUT /repos/{owner}/{repo}/immutable-releases
Enables immutable releases for a repository. The authenticated user must have admin access to the repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
A header with no content is returned.
no
409
Conflict
yes
Disable immutable releases
DELETE /repos/{owner}/{repo}/immutable-releases
Disables immutable releases for a repository. The authenticated user must have admin access to the repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
A header with no content is returned.
no
409
Conflict
yes
List repository invitations
GET /repos/{owner}/{repo}/invitations
When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
You can request that your site be built from the latest revision on the default branch. This has the same effect as pushing a commit to your default branch, but does not require an additional commit. Manually triggering page builds can be helpful when diagnosing build warnings and failures.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
201
Response
yes
Get latest Pages build
GET /repos/{owner}/{repo}/pages/builds/latest
Gets information about the single most recent build of a GitHub Pages site.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
Get GitHub Pages build
GET /repos/{owner}/{repo}/pages/builds/{build_id}
Gets information about a GitHub Pages build.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
build_id
path
yes
Responses
Status
Description
Has JSON body
200
Response
yes
Create a GitHub Pages deployment
POST /repos/{owner}/{repo}/pages/deployments
Create a GitHub Pages deployment for a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
400
Bad Request
yes
422
Validation failed, or the endpoint has been spammed.
yes
404
Resource not found
yes
Get the status of a GitHub Pages deployment
GET /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}
Gets the current status of a GitHub Pages deployment.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
pages_deployment_id
path
yes
The ID of the Pages deployment. You can also give the commit SHA of the deployment.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Cancel a GitHub Pages deployment
POST /repos/{owner}/{repo}/pages/deployments/{pages_deployment_id}/cancel
Cancels a GitHub Pages deployment.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
pages_deployment_id
path
yes
The ID of the Pages deployment. You can also give the commit SHA of the deployment.
Responses
Status
Description
Has JSON body
204
A header with no content is returned.
no
404
Resource not found
yes
Get a DNS health check for GitHub Pages
GET /repos/{owner}/{repo}/pages/health
Gets a health check of the DNS settings for the CNAME record configured for a repository's GitHub Pages.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
202
Empty response
yes
400
Custom domains are not available for GitHub Pages
no
422
There isn't a CNAME for this page
no
404
Resource not found
yes
Check if private vulnerability reporting is enabled for a repository
GET /repos/{owner}/{repo}/private-vulnerability-reporting
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Private vulnerability reporting status
yes
422
Bad Request
yes
Enable private vulnerability reporting for a repository
PUT /repos/{owner}/{repo}/private-vulnerability-reporting
Enables private vulnerability reporting for a repository. The authenticated user must have admin access to the repository. For more information, see "Privately reporting a security vulnerability."
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
A header with no content is returned.
no
422
Bad Request
yes
Disable private vulnerability reporting for a repository
Disables private vulnerability reporting for a repository. The authenticated user must have admin access to the repository. For more information, see "Privately reporting a security vulnerability".
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
A header with no content is returned.
no
422
Bad Request
yes
Get all custom property values for a repository
GET /repos/{owner}/{repo}/properties/values
Gets all custom property values that are set for a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
403
Forbidden
yes
404
Resource not found
yes
Create or update custom property values for a repository
PATCH /repos/{owner}/{repo}/properties/values
Create new or update existing custom property values for a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
No Content when custom property values are successfully created or updated
no
403
Forbidden
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
Get a repository README
GET /repos/{owner}/{repo}/readme
Gets the preferred README for a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
ref
query
no
The name of the commit/branch/tag. Default: the repository’s default branch.
Responses
Status
Description
Has JSON body
200
Response
yes
304
Not modified
no
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
Get a repository README for a directory
GET /repos/{owner}/{repo}/readme/{dir}
Gets the README from a repository directory.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
dir
path
yes
The alternate path to look for a README file
ref
query
no
The name of the commit/branch/tag. Default: the repository’s default branch.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
List releases
GET /repos/{owner}/{repo}/releases
This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the Repository Tags API.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
asset_id
path
yes
The unique identifier of the asset.
Responses
Status
Description
Has JSON body
204
Response
no
404
Resource not found
yes
Generate release notes content for a release
POST /repos/{owner}/{repo}/releases/generate-notes
Generate a name and body describing a release. The body content will be markdown formatted and contain information like the changes since last release and users who contributed. The generated release notes are not saved anywhere. They are intended to be generated and used when creating a new release.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Name and body of generated release notes
yes
404
Resource not found
yes
Get the latest release
GET /repos/{owner}/{repo}/releases/latest
View the latest published full release for the repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Get a release by tag name
GET /repos/{owner}/{repo}/releases/tags/{tag}
Get a published release with the specified tag.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
tag
path
yes
tag parameter
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
Get a release
GET /repos/{owner}/{repo}/releases/{release_id}
Gets a public release with the specified release ID.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
release_id
path
yes
The unique identifier of the release.
Responses
Status
Description
Has JSON body
200
Note: This returns an upload_url key corresponding to the endpoint for uploading release assets. This key is a hypermedia resource. For more information, see "Getting started with the REST API."
yes
401
Unauthorized
no
Update a release
PATCH /repos/{owner}/{repo}/releases/{release_id}
Users with push access to the repository can edit a release.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
release_id
path
yes
The unique identifier of the release.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Not Found if the discussion category name is invalid
POST /repos/{owner}/{repo}/releases/{release_id}/assets
This endpoint makes use of a Hypermedia relation to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the upload_url returned in
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
release_id
path
yes
The unique identifier of the release.
name
query
yes
label
query
no
Responses
Status
Description
Has JSON body
201
Response for successful upload
yes
422
Response if you upload an asset with the same filename as another uploaded asset
no
Get rules for a branch
GET /repos/{owner}/{repo}/rules/branches/{branch}
Returns all active rules that apply to the specified branch. The branch does not need to exist; rules that would apply
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
branch
path
yes
The name of the branch. Cannot contain wildcard characters. To use wildcard characters in branch names, use the GraphQL API.
Include rulesets configured at higher levels that apply to this repository
targets
query
no
A comma-separated list of rule targets to filter by.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
500
Internal Error
yes
Create a repository ruleset
POST /repos/{owner}/{repo}/rulesets
Create a ruleset for a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
201
Response
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
500
Internal Error
yes
List repository rule suites
GET /repos/{owner}/{repo}/rulesets/rule-suites
Lists suites of rule evaluations at the repository level.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
ref
query
no
The name of the ref. Cannot contain wildcard characters. Optionally prefix with refs/heads/ to limit to branches or refs/tags/ to limit to tags. Omit the prefix to search across all refs. When specified, only rule evaluations triggered for this ref will be returned.
time_period
query
no
The time period to filter by.
actor_name
query
no
The handle for the GitHub user account to filter on. When specified, only rule evaluations triggered by this actor will be returned.
rule_suite_result
query
no
The rule suite results to filter on. When specified, only suites with this result will be returned.
evaluate_status
query
no
The evaluate status to filter on. When specified, only rule suites resulting from rulesets with the specified evaluate status will be returned.
GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history/{version_id}
Get a version of a repository ruleset.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
ruleset_id
path
yes
The ID of the ruleset.
version_id
path
yes
The ID of the version
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
500
Internal Error
yes
Get the weekly commit activity
GET /repos/{owner}/{repo}/stats/code_frequency
Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Returns a weekly aggregate of the number of additions and deletions pushed to a repository.
yes
202
Accepted
yes
204
A header with no content is returned.
no
422
Repository contains more than 10,000 commits
no
Get the last year of commit activity
GET /repos/{owner}/{repo}/stats/commit_activity
Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
202
Accepted
yes
204
A header with no content is returned.
no
Get all contributor commit activity
GET /repos/{owner}/{repo}/stats/contributors
Returns the total number of commits authored by the contributor. In addition, the response includes a Weekly Hash (weeks array) with the following information:
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
202
Accepted
yes
204
A header with no content is returned.
no
Get the weekly commit count
GET /repos/{owner}/{repo}/stats/participation
Returns the total commit counts for the owner and total commit counts in all. all is everyone combined, including the owner in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract owner from all.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
The array order is oldest week (index 0) to most recent week.
yes
404
Resource not found
yes
Get the hourly commit count for each day
GET /repos/{owner}/{repo}/stats/punch_card
Each array contains the day number, hour number, and number of commits:
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
For example, [2, 14, 25] indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits.
yes
204
A header with no content is returned.
no
Create a commit status
POST /repos/{owner}/{repo}/statuses/{sha}
Users with push access in a repository can create commit statuses for a given SHA.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
sha
path
yes
Responses
Status
Description
Has JSON body
201
Response
yes
List repository tags
GET /repos/{owner}/{repo}/tags
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
404
Resource not found
yes
422
Validation failed, or the endpoint has been spammed.
yes
Get repository clones
GET /repos/{owner}/{repo}/traffic/clones
Get the total number of clones and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
per
query
no
The time frame to display results for.
Responses
Status
Description
Has JSON body
200
Response
yes
403
Forbidden
yes
Get top referral paths
GET /repos/{owner}/{repo}/traffic/popular/paths
Get the top 10 popular contents over the last 14 days.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
403
Forbidden
yes
Get top referral sources
GET /repos/{owner}/{repo}/traffic/popular/referrers
Get the top 10 referrers over the last 14 days.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
200
Response
yes
403
Forbidden
yes
Get page views
GET /repos/{owner}/{repo}/traffic/views
Get the total number of views and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
per
query
no
The time frame to display results for.
Responses
Status
Description
Has JSON body
200
Response
yes
403
Forbidden
yes
Transfer a repository
POST /repos/{owner}/{repo}/transfer
A transfer request will need to be accepted by the new owner when transferring a personal repository to another user. The response will contain the original owner, and the transfer will continue asynchronously. For more details on the requirements to transfer personal and organization-owned repositories, see about repository transfers.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
202
Response
yes
Check if vulnerability alerts are enabled for a repository
GET /repos/{owner}/{repo}/vulnerability-alerts
Shows whether dependency alerts are enabled or disabled for a repository. The authenticated user must have admin read access to the repository. For more information, see "About security alerts for vulnerable dependencies".
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
Response if repository is enabled with vulnerability alerts
no
404
Not Found if repository is not enabled with vulnerability alerts
no
Enable vulnerability alerts
PUT /repos/{owner}/{repo}/vulnerability-alerts
Enables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "About security alerts for vulnerable dependencies".
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
Response
no
Disable vulnerability alerts
DELETE /repos/{owner}/{repo}/vulnerability-alerts
Disables dependency alerts and the dependency graph for a repository.
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
204
Response
no
Download a repository archive (zip)
GET /repos/{owner}/{repo}/zipball/{ref}
Gets a redirect URL to download a zip archive for a repository. If you omit :ref, the repository’s default branch (usually
Parameters
Name
In
Required
Description
owner
path
yes
The account owner of the repository. The name is not case sensitive.
repo
path
yes
The name of the repository without the .git extension. The name is not case sensitive.
ref
path
yes
Responses
Status
Description
Has JSON body
302
Response
no
Create a repository using a template
POST /repos/{template_owner}/{template_repo}/generate
Creates a new repository using a repository template. Use the template_owner and template_repo route parameters to specify the repository to use as the template. If the repository is not public, the authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the Get a repository endpoint and check that the is_template key is true.
Parameters
Name
In
Required
Description
template_owner
path
yes
The account owner of the template repository. The name is not case sensitive.
template_repo
path
yes
The name of the template repository without the .git extension. The name is not case sensitive.
Responses
Status
Description
Has JSON body
201
Response
yes
List public repositories
GET /repositories
Lists all public repositories in the order that they were created.
Parameters
Name
In
Required
Description
since
query
no
A repository ID. Only return repositories with an ID greater than this ID.
Responses
Status
Description
Has JSON body
200
Response
yes
422
Validation failed, or the endpoint has been spammed.
yes
304
Not modified
no
List repositories for the authenticated user
GET /user/repos
Lists repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access.
Parameters
Name
In
Required
Description
visibility
query
no
Limit results to repositories with the specified visibility.
affiliation
query
no
Comma-separated list of values. Can include:
type
query
no
Limit results to repositories of the specified type. Will cause a 422 error if used in the same request as visibility or affiliation.
sort
query
no
The property to sort the results by.
direction
query
no
The order to sort by. Default: asc when using full_name, otherwise desc.