REST API endpoints for Project (classic) collaborators
Note
Projects (classic) has been retired. You can read more about this change on the Blog.
The new and improved Projects experience is available. For more information, see About Projects.
These endpoints only interact with projects (classic). To manage Projects, use the GraphQL API. For more information, see Using the API to manage Projects.
Note
The REST API to manage projects (classic) only supports authentication using a personal access token (classic). For more information, see Managing your personal access tokens.
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Fine-grained access tokens for "List project collaborators"
This endpoint works with the following fine-grained token types:
The fine-grained token must have at least one of the following permission sets:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Parameters for "List project collaborators"
Name, Type, Description |
---|
accept stringSetting to |
Name, Type, Description |
---|
project_id integer RequiredThe unique identifier of the project. |
Name, Type, Description |
---|
affiliation stringFilters the collaborators by their affiliation. Default: Can be one of: |
per_page integerThe number of results per page (max 100). For more information, see "Using pagination in the REST API." Default: |
page integerThe page number of the results to fetch. For more information, see "Using pagination in the REST API." Default: |
HTTP response status codes for "List project collaborators"
Status code | Description |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Code samples for "List project collaborators"
Request example
curl -L \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/projects/PROJECT_ID/collaborators
Response
Status: 200
[ { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api..com/users/octocat", "html_url": "https://.com/octocat", "followers_url": "https://api..com/users/octocat/followers", "following_url": "https://api..com/users/octocat/following{/other_user}", "gists_url": "https://api..com/users/octocat/gists{/gist_id}", "starred_url": "https://api..com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api..com/users/octocat/subscriptions", "organizations_url": "https://api..com/users/octocat/orgs", "repos_url": "https://api..com/users/octocat/repos", "events_url": "https://api..com/users/octocat/events{/privacy}", "received_events_url": "https://api..com/users/octocat/received_events", "type": "User", "site_admin": false } ]
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Fine-grained access tokens for "Add project collaborator"
This endpoint works with the following fine-grained token types:
The fine-grained token must have at least one of the following permission sets:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Parameters for "Add project collaborator"
Name, Type, Description |
---|
accept stringSetting to |
Name, Type, Description |
---|
project_id integer RequiredThe unique identifier of the project. |
username string RequiredThe handle for the user account. |
Name, Type, Description |
---|
permission stringThe permission to grant the collaborator. Default: Can be one of: |
HTTP response status codes for "Add project collaborator"
Status code | Description |
---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Code samples for "Add project collaborator"
Request example
curl -L \ -X PUT \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/projects/PROJECT_ID/collaborators/USERNAME \ -d '{"permission":"write"}'
Response
Status: 204
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Fine-grained access tokens for "Remove user as a collaborator"
This endpoint works with the following fine-grained token types:
The fine-grained token must have at least one of the following permission sets:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Parameters for "Remove user as a collaborator"
Name, Type, Description |
---|
accept stringSetting to |
Name, Type, Description |
---|
project_id integer RequiredThe unique identifier of the project. |
username string RequiredThe handle for the user account. |
HTTP response status codes for "Remove user as a collaborator"
Status code | Description |
---|---|
204 | No Content |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Code samples for "Remove user as a collaborator"
Request example
curl -L \ -X DELETE \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/projects/PROJECT_ID/collaborators/USERNAME
Response
Status: 204
Warning
Closing down notice: Projects (classic) is being deprecated in favor of the new Projects experience. See the changelog for more information.
Fine-grained access tokens for "Get project permission for a user"
This endpoint works with the following fine-grained token types:
The fine-grained token must have at least one of the following permission sets:
- "Projects" repository permissions (write)
- "Projects" organization permissions (admin)
Parameters for "Get project permission for a user"
Name, Type, Description |
---|
accept stringSetting to |
Name, Type, Description |
---|
project_id integer RequiredThe unique identifier of the project. |
username string RequiredThe handle for the user account. |
HTTP response status codes for "Get project permission for a user"
Status code | Description |
---|---|
200 | OK |
304 | Not modified |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
422 | Validation failed, or the endpoint has been spammed. |
Code samples for "Get project permission for a user"
Request example
curl -L \ -H "Accept: application/vnd.+json" \ -H "Authorization: Bearer <YOUR-TOKEN>" \ -H "X--Api-Version: 2022-11-28" \ https://api..com/projects/PROJECT_ID/collaborators/USERNAME/permission
Response
Status: 200
{ "permission": "admin", "user": { "login": "octocat", "id": 1, "node_id": "MDQ6VXNlcjE=", "avatar_url": "https://.com/images/error/octocat_happy.gif", "gravatar_id": "", "url": "https://api..com/users/octocat", "html_url": "https://.com/octocat", "followers_url": "https://api..com/users/octocat/followers", "following_url": "https://api..com/users/octocat/following{/other_user}", "gists_url": "https://api..com/users/octocat/gists{/gist_id}", "starred_url": "https://api..com/users/octocat/starred{/owner}{/repo}", "subscriptions_url": "https://api..com/users/octocat/subscriptions", "organizations_url": "https://api..com/users/octocat/orgs", "repos_url": "https://api..com/users/octocat/repos", "events_url": "https://api..com/users/octocat/events{/privacy}", "received_events_url": "https://api..com/users/octocat/received_events", "type": "User", "site_admin": false } }