GitHub v3 REST API

Check if a user is a repository collaborator

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.

Team members will include the members of child teams.

You must authenticate using an access token with the read:org and repo scopes with push access to use this
endpoint. GitHub Apps must have the members organization permission and metadata repository permission to use this
endpoint.

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

Path Parameters

ownerstringrequired
repostringrequired
usernamestringrequired

Response

Response if user is a collaborator

get/repos/{owner}/{repo}/collaborators/{username}
 

Add a repository collaborator

This endpoint triggers notifications. Creating content too quickly using this endpoint may result in secondary rate limiting. See “Secondary rate limits” and “Dealing with secondary rate limits” for details.

For more information on permission levels, see “Repository permission levels for an organization”. There are restrictions on which permissions can be granted to organization members when an organization base role is in place. In this case, the permission being given must be equal to or higher than the org base permission. Otherwise, the request will fail with:

Cannot assign {member} permission of {role name}

Note that, if you choose not to pass any parameters, you’ll need to set Content-Length to zero when calling out to this endpoint. For more information, see “HTTP verbs.”

The invitee will receive a notification that they have been invited to the repository, which they must accept or decline. They may do this via the notifications page, the email they receive, or by using the repository invitations API endpoints.

Rate limits

You are limited to sending 50 invitations to a repository per 24 hour period. Note there is no limit if you are inviting organization members to an organization repository.

put
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/collaborators/{username}

Path Parameters

ownerstringrequired
repostringrequired
usernamestringrequired

Body

application/json
permissionstring

The permission to grant the collaborator. Only valid on organization-owned repositories. Can be one of:
* pull - can pull, but not push to or administer this repository.
* push - can pull and push, but not administer this repository.
* admin - can pull, push and administer this repository.
* maintain - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions.
* triage - Recommended for contributors who need to proactively manage issues and pull requests without write access.

Allowed values:pullpushadminmaintaintriage

Default:push

permissionsstring

Example:"push"

Response

application/json

Response when a new invitation is created

Repository Invitation

Repository invitations let you manage who you collaborate with.

idintegerrequired

Unique identifier of the repository invitation.

Example:42

repositoryobjectrequired

Minimal Repository

Show Child Parameters
inviteeobject | nullrequired

Simple User

Show Child Parameters
inviterobject | nullrequired

Simple User

Show Child Parameters
permissionsstringrequired

The permission associated with the invitation.

Allowed values:readwriteadmintriagemaintain

Example:read

created_atstring(date-time)required

Example:2016-06-13T14:52:50-05:00

expiredboolean

Whether or not the invitation has expired

urlstringrequired

URL for the repository invitation

Example:https://api.github.com/user/repository-invitations/1

html_urlstringrequired

Example:https://github.com/octocat/Hello-World/invitations

node_idstringrequired
put/repos/{owner}/{repo}/collaborators/{username}

Body

{}
 
application/json

Remove a repository collaborator

delete
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/collaborators/{username}

Path Parameters

ownerstringrequired
repostringrequired
usernamestringrequired

Response

204

Response

delete/repos/{owner}/{repo}/collaborators/{username}
 
204

Get repository permissions for a user

Checks the repository permission of a collaborator. The possible repository permissions are admin, write, read, and none.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/collaborators/{username}/permission

Path Parameters

ownerstringrequired
repostringrequired
usernamestringrequired

Response

application/json

if user has admin permissions

Repository Collaborator Permission

Repository Collaborator Permission

permissionstringrequired
userobject | nullrequired

Collaborator

Show Child Parameters
get/repos/{owner}/{repo}/collaborators/{username}/permission
 
application/json

List commit comments for a repository

Commit Comments use these custom media types. You can read more about the use of media types in the API here.

Comments are ordered by ascending ID.

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

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired

Response

200 application/json

Response

Commit Comment

html_urlstring(uri)required
urlstring(uri)required
idintegerrequired
node_idstringrequired
bodystringrequired
pathstring | nullrequired
positioninteger | nullrequired
lineinteger | nullrequired
commit_idstringrequired
userobject | nullrequired

Simple User

Show Child Parameters
created_atstring(date-time)required
updated_atstring(date-time)required
author_associationstringrequired

How the author is associated with the repository.

Allowed values:COLLABORATORCONTRIBUTORFIRST_TIMERFIRST_TIME_CONTRIBUTORMANNEQUINMEMBERNONEOWNER

Example:OWNER

reactionsobject
Show Child Parameters
get/repos/{owner}/{repo}/comments
 
200 application/json