Skip to content

Someone's permission on a repository: their role and its source (owner, base or direct), or null for both when they have none, and the capabilities that role has, from the permission table.

GET/repos/{owner}/{name}/collaborators/{username}/permission

Being able to read a public repository does not count as a role. Needs the Write role or higher, or to ask about yourself.

capabilities lists what the role allows, in the table’s order: read, participate, triage, push, merge, run, manage_settings, manage_protection, manage_integrations, manage_access, administer and delete (which also takes an owner of the workspace). role and source are null, and capabilities empty, for someone with no role. Refused with 403 below the Write role, unless you ask about yourself. See Access and roles.

Name Type Required Description
owner string Yes The workspace that owns the repository.
name string Yes The repository’s name.
username string Yes The person’s username.
curl https://api.g1t.sh/repos/flagon-io/hello/collaborators/ada/permission \
-H "Authorization: Bearer $G1T_TOKEN"

A successful request answers 200 with:

{
"username": "ada",
"role": "triage",
"source": "direct",
"capabilities": [
"read",
"participate",
"triage"
]
}

A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.

Status Code When
401 unauthenticated A token is required, or the one sent is not valid.
403 forbidden The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository.
404 not_found It does not exist, or you cannot see it.
422 invalid The input is not valid. message says which field and why.