Collaborators
- List collaborators
- Check if a user is a collaborator
- Add user as a collaborator
- Remove user as a collaborator
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
}
]
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
Note that you’ll need to set Content-Length
to zero when calling out to this endpoint. For more information, see “HTTP verbs.”
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