|
| 1 | +--- |
| 2 | +title: Repository Invitations |
| 3 | +--- |
| 4 | + |
| 5 | +# Repository Invitations |
| 6 | + |
| 7 | +{{#tip}} |
| 8 | + |
| 9 | +We're currently offering a preview of the Repository Invitations API. |
| 10 | + |
| 11 | +To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header: |
| 12 | + |
| 13 | +``` |
| 14 | +application/vnd.github.swamp-thing-preview+json |
| 15 | +``` |
| 16 | + |
| 17 | +{{/tip}} |
| 18 | + |
| 19 | +{:toc} |
| 20 | + |
| 21 | +<a id="invite" /> |
| 22 | + |
| 23 | +## Invite a user to a repository |
| 24 | + |
| 25 | +Use the API endpoint for adding a collaborator [here](/v3/repos/collaborators). |
| 26 | + |
| 27 | +<a id="list" /> |
| 28 | + |
| 29 | +## List invitations for a repository |
| 30 | + |
| 31 | + GET /repositories/:repo_id/invitations |
| 32 | + |
| 33 | +When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations. |
| 34 | + |
| 35 | +### Response |
| 36 | + |
| 37 | +<%= headers 200, :pagination => default_pagination_rels %> |
| 38 | +<%= json(:repository_invitation) { |h| [h] } %> |
| 39 | + |
| 40 | +<a id="uninvite" /> |
| 41 | + |
| 42 | +## Delete a repository invitation |
| 43 | + |
| 44 | + DELETE /repositories/:repo_id/invitations/:invitation_id |
| 45 | + |
| 46 | +### Response |
| 47 | + |
| 48 | +<%= headers 204 %> |
| 49 | + |
| 50 | +<a id="update" /> |
| 51 | + |
| 52 | +## Update a repository invitation |
| 53 | + |
| 54 | + PATCH /repositories/:repo_id/invitations/:invitation_id |
| 55 | + |
| 56 | +### Input |
| 57 | + |
| 58 | +Name | Type | Description |
| 59 | +-----|------|-------------- |
| 60 | +`permissions`|`string` | The permissions that the associated user will have on the repository. Valid values are `read`, `write`, and `admin`. |
| 61 | + |
| 62 | +### Response |
| 63 | + |
| 64 | +<%= headers 200 %> |
| 65 | +<%= json(:repository_invitation) %> |
| 66 | + |
| 67 | +<a id="my-invitations" /> |
| 68 | + |
| 69 | +## List a user's repository invitations |
| 70 | + |
| 71 | + GET /user/repository_invitations |
| 72 | + |
| 73 | +When authenticating as a user, this endpoint will list all currently open repository invitations for that user. |
| 74 | + |
| 75 | +### Response |
| 76 | + |
| 77 | +<%= headers 200 %> |
| 78 | +<%= json(:repository_invitation) { |h| [h] } %> |
| 79 | + |
| 80 | +<a id="accept" /> |
| 81 | + |
| 82 | +## Accept a repository invitation |
| 83 | + |
| 84 | + PATCH /repositories/:repo_id/invitations/:invitation_id |
| 85 | + |
| 86 | +### Response |
| 87 | + |
| 88 | +<%= headers 204 %> |
| 89 | + |
| 90 | +<a id="decline" /> |
| 91 | + |
| 92 | +## Decline a repository invitation |
| 93 | + |
| 94 | + DELETE /repositories/:repo_id/invitations/:invitation_id |
| 95 | + |
| 96 | +### Response |
| 97 | + |
| 98 | +<%= headers 204 %> |
0 commit comments