Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 2
Message 1 of 2

Update Collaborator Permission

Solved! Go to Solution.

Is there any way to update a collaborators permission on an organization repository via the v3 (or even v4) API?


I cannot find any way to do this and it would very much help me enforce assignment deadlines in GitHub Classroom, since Classroom does not do anything in terms of deadline enforcement. I can make the switch for student collaborators from Write to Read permissions just fine on the website but would be quite cumbersome to do that for 70+ repositories.

1 Reply
Copilot Lvl 2
Message 2 of 2

Re: Update Collaborator Permission

Okay, so this turns out to be an API documentation issue because:


Nowhere in the docs here is it mentioned that this endpoint can also update the permissions on existing collaborators, although it is mentioned in the Octokit library docs:


But, even more confusingly, the given permission levels do not match the levels shown on the GitHub website. There are actually five permission levels, not three: Read, Triage, Write, Maintain, Admin.


Even worse, when hitting the endpoint using the permissions "Triage", "Maintain" or "Admin", they successfully modify the existing collaborator permissions. But, when using what you would might expect to work ("Read" or "Write") it will fail. You need to use the permissions "Pull" (which is read-only access or "Read" permissions on the website) or "Push" (which is "Write" permissions on the website) for this to work properly.


So either the permission names on the GitHub website need to be changed, or the documentation for the API needs to updated to explain that:


  1. the add user as a collaborator endpoint can actually update the permission of existing users and
  2. the actual permission levels allowed are: Pull (which is Read), Triage, Push (which is Write), Maintain, Admin


Though, it would be really awesome to allow "Read" and "Write" on this endpoint as alises for the currently established names (according to the API anyways) to maybe save someone down the line a huge, hours-long headache.