Skip to content

[Schema Inaccuracy] permission on Add a repository collaborator is valid on personal-account repositories #7010

Description

@aaronariasperez

Schema Inaccuracy

Operation: PUT /repos/{owner}/{repo}/collaborators/{username} (Add a repository
collaborator).

The description of the permission body parameter states:

The permission to grant the collaborator. Only valid on organization-owned repositories.

That restriction does not hold. On a repository owned by a personal account the parameter
is honoured for pull, push and admin. Only triage and maintain are
organization-only.

Expected

The permission parameter description should state that on organization-owned
repositories all of pull, triage, push, maintain, admin and custom repository
roles are accepted, while on repositories owned by a personal account only pull, push
and admin are accepted — triage and maintain return 422 Validation Failed.

Reproduction Steps

Against a private repository owned by a personal account:

$ curl -X PUT
-H "Authorization: Bearer $TOKEN"
-H "Accept: application/vnd.github+json"
-H "X-GitHub-Api-Version: 2022-11-28"
https://api.github.com/repos/OWNER/REPO/collaborators/USERNAME
-d '{"permission":"pull"}'

→ HTTP 201, and the returned invitation object contains "permissions": "read".

Full sweep of all five values, cancelling the invitation between attempts:

requested HTTP recorded permissions
pull 201 read
triage 422 Validation Failed
push 201 write
maintain 422 Validation Failed
admin 201 admin

Identical sweep against a private organization-owned repository, same script and
token: all five accepted and recorded as requested.

Enforcement matches what is recorded: a collaborator granted pull on a private
personal-account repository has git push rejected by the server.

Note on versioning: this description is identical in both published API versions in
descriptions/[api.github.com/](http://api.github.com/) on mainapi.github.com.2022-11-28.json and
api.github.com.2026-03-10.json both contain the "Only valid on organization-owned
repositories." sentence verbatim. So this is not a leftover in an older version.

Related documentation issue: github/docs#45537

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions