Collaborators

List collaborators

GET /repos/:owner/:repo/collaborators

When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list.

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999
[
  {
    "login": "octocat",
    "id": 1,
    "avatar_url": "https://github.com/images/error/octocat_happy.gif",
    "gravatar_id": "",
    "url": "https://api.github.com/users/octocat",
    "html_url": "https://github.com/octocat",
    "followers_url": "https://api.github.com/users/octocat/followers",
    "following_url": "https://api.github.com/users/octocat/following{/other_user}",
    "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
    "organizations_url": "https://api.github.com/users/octocat/orgs",
    "repos_url": "https://api.github.com/users/octocat/repos",
    "events_url": "https://api.github.com/users/octocat/events{/privacy}",
    "received_events_url": "https://api.github.com/users/octocat/received_events",
    "type": "User",
    "site_admin": false,
    "permissions": {
      "pull": true,
      "push": true,
      "admin": false
    }
  }
]

Check if a user is a collaborator

GET /repos/:owner/:repo/collaborators/:username

Response if user is a collaborator

Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999

Response if user is not a collaborator

Status: 404 Not Found
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999

Add user as a collaborator

PUT /repos/:owner/:repo/collaborators/:username

Parameters

Name Type Description
permission string The permission to grant the team. 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.
Default: pull
This parameter requires a custom media type to be specified. Please see more in the alert below.

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.”

We're currently offering a preview period allowing applications to opt in to the Organization Permissions API. Please see the blog post for full details.

To access the API during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.ironman-preview+json

Warning: If you use this API to add a collaborator to a repository that's owned by an organization that hasn't had improved organization permissions enabled yet, you will get a 422 error response.

Response

Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999

Remove user as a collaborator

DELETE /repos/:owner/:repo/collaborators/:username

Response

Status: 204 No Content
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4999