GitHub v3 REST API

Create a content attachment

Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the id and repository full_name of the content reference from the content_reference event to create an attachment.

The app must create a content attachment within six hours of the content reference URL being posted. See “Using content attachments” for details about content attachments.

You must use an installation access token to access this endpoint.

post
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/content_references/{content_reference_id}/attachments

Path Parameters

ownerstringrequired

The owner of the repository. Determined from the repository full_name of the content_reference event.

repostringrequired

The name of the repository. Determined from the repository full_name of the content_reference event.

content_reference_idintegerrequired

The id of the content_reference event.

Body

application/json
titlestringrequired

The title of the attachment

<= 1024 characters

Example:Title of the attachment

bodystringrequired

The body of the attachment

<= 262144 characters

Example:Body of the attachment

Response

application/json

Response

ContentReferenceAttachment

Content Reference attachments allow you to provide context around URLs posted in comments

idintegerrequired

The ID of the attachment

Example:21

titlestringrequired

The title of the attachment

<= 1024 characters

Example:Title of the attachment

bodystringrequired

The body of the attachment

<= 262144 characters

Example:Body of the attachment

node_idstring

The node_id of the content attachment

Example:MDE3OkNvbnRlbnRBdHRhY2htZW50MjE=

post/repos/{owner}/{repo}/content_references/{content_reference_id}/attachments

Body

{ "title": "Title of the attachment", "body": "Body of the attachment" }
 
application/json

Get a repository installation for the authenticated app

Enables an authenticated GitHub App to find the repository’s installation information. The installation’s account type will be either an organization or a user account, depending which account the repository belongs to.

You must use a JWT to access this endpoint.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/installation

Path Parameters

ownerstringrequired
repostringrequired

Response

application/json

Response

Installation

Installation

idintegerrequired

The ID of the installation.

Example:1

accountAny Of
required
Simple Userobject

Simple User

Show Child Parameters
repository_selectionstringrequired

Describe whether all repositories have been selected or there’s a selection involved

Allowed values:allselected

access_tokens_urlstring(uri)required

Example:https://api.github.com/installations/1/access_tokens

repositories_urlstring(uri)required

Example:https://api.github.com/installation/repositories

html_urlstring(uri)required

Example:https://github.com/organizations/github/settings/installations/1

app_idintegerrequired

Example:1

target_idintegerrequired

The ID of the user or organization this token is being scoped to.

target_typestringrequired

Example:Organization

permissionsobjectrequired

The permissions granted to the user-to-server access token.

Example:{"contents":"read","issues":"read","deployments":"write","single_file":"read"}

Show Child Parameters
eventsarray[string]required
created_atstring(date-time)required
updated_atstring(date-time)required
single_file_namestring | nullrequired

Example:config.yaml

has_multiple_single_filesboolean

Example:true

single_file_pathsarray[string]

Example:["config.yml",".github/issue_TEMPLATE.md"]

app_slugstringrequired

Example:github-actions

suspended_byobject | nullrequired

Simple User

Show Child Parameters
suspended_atstring | null(date-time)required
contact_emailstring | null

Example:"test_13f1e99741e3e004@d7e1eb0bc0a1ba12.com"

get/repos/{owner}/{repo}/installation
 
application/json

List app installations accessible to the user access token

Lists installations of your GitHub App that the authenticated user has explicit permission (:read, :write, or :admin) to access.

You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint.

The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.

You can find the permissions for the installation under the permissions key.

get
{protocol}://{hostname}/api/v3/user/installations

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Response

application/json

You can find the permissions for the installation under the permissions key.

total_countintegerrequired
installationsarray[object]required

Installation

Show Child Parameters
get/user/installations
 
application/json

List repositories accessible to the user access token

List repositories that the authenticated user has explicit permission (:read, :write, or :admin) to access for an installation.

The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership.

You must use a user-to-server OAuth access token, created for a user who has authorized your GitHub App, to access this endpoint.

The access the user has to each repository is included in the hash under the permissions key.

get
{protocol}://{hostname}/api/v3/user/installations/{installation_id}/repositories

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

installation_idintegerrequired

installation_id parameter

Response

application/json

The access the user has to each repository is included in the hash under the permissions key.

total_countintegerrequired
repository_selectionstring
repositoriesarray[object]required

A git repository

Show Child Parameters
get/user/installations/{installation_id}/repositories
 
application/json

Add a repository to an app installation

Add a single repository to an installation. The authenticated user must have admin access to the repository.

You must use a personal access token (which you can create via the command line or Basic Authentication) to access this endpoint.

put
{protocol}://{hostname}/api/v3/user/installations/{installation_id}/repositories/{repository_id}

Path Parameters

installation_idintegerrequired

installation_id parameter

repository_idintegerrequired

Response

Response

put/user/installations/{installation_id}/repositories/{repository_id}