Use this API to manage invitations and add users to a group or project.
List all pending invitations for a group
GET /api/v4/groups/{id}/invitations
Lists all pending invitations for a specified group viewable by the authenticated user. Returns invitations to direct members only, and not through inherited ancestor groups. This function takes pagination parameters page and per_page to restrict the list of members.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
pageQuery | Integer | Page number of results to retrieve Default: 1Example: 1 |
per_Query | Integer | Number of items to list per page Default: 20Example: 20 |
queryQuery | String | Return only invitations sent to this email address. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Add a member to a group
POST /api/v4/groups/{id}/invitations
Adds a member to a group. You can specify a user ID or invite a user by email. You must have the Owner role for the group. On GitLab Self-Managed, an administrator must add the user if new user accounts or user invitations are not allowed, and must approve the invitation if administrator approval for role promotions is enabled. If an invitation fails, the response has a status of error and a message object that maps each email address or username to its error. To enable Manage non-billable promotions, enable the enable_member_promotion_management application setting. Users whose requests are queued for administrator approval are listed in queued_users.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
access_Required | Integer | Access level to grant to the invited user.5 (Minimal access) is also valid when id is a top-Allowed values: 10,15,20,25,30,40,50 |
email | Array of strings | Email address of the member to invite,user_ is not provided |
expires_ | String (date- | Date when the invitation expires |
invite_ | String | Source of the invitation that starts the member creation process Default: invitations- |
user_ | Array of strings | ID of the user to invite,email is not provided |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Update an invitation to a group
PUT /api/v4/groups/{id}/invitations/{email}
Updates a pending invitation to a group.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
emailPath, | String | Email address the invitation was previously sent to |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
access_ | Integer | Access level to grant to the invited user. Allowed values: 10,15,20,25,30,40,50 |
expires_ | String (date- | Date when the invitation expires |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete an invitation to a group
DELETE /api/v4/groups/{id}/invitations/{email}
Deletes a pending invitation to a specified email address for a group.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
emailPath, | String | Email address the invitation was previously sent to |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
409 | Could not delete invitation | — |
List all pending invitations for a project
GET /api/v4/projects/{id}/invitations
Lists all pending invitations for a specified project viewable by the authenticated user. Returns invitations to direct members only, and not through inherited ancestor groups. This function takes pagination parameters page and per_page to restrict the list of members.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
pageQuery | Integer | Page number of results to retrieve Default: 1Example: 1 |
per_Query | Integer | Number of items to list per page Default: 20Example: 20 |
queryQuery | String | Return only invitations sent to this email address. |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Add a member to a project
POST /api/v4/projects/{id}/invitations
Adds a member to a project. You can specify a user ID or invite a user by email. You must have the Maintainer or Owner role for the project, and group membership lock must be disabled. On GitLab Self-Managed, an administrator must add the user if new user accounts or user invitations are not allowed, and must approve the invitation if administrator approval for role promotions is enabled. If an invitation fails, the response has a status of error and a message object that maps each email address or username to its error. To enable Manage non-billable promotions, enable the enable_member_promotion_management application setting. Users whose requests are queued for administrator approval are listed in queued_users.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
access_Required | Integer | Access level to grant to the invited user. Allowed values: 10,15,20,25,30,40,50 |
email | Array of strings | Email address of the member to invite,user_ is not provided |
expires_ | String (date- | Date when the invitation expires |
invite_ | String | Source of the invitation that starts the member creation process Default: invitations- |
user_ | Array of strings | ID of the user to invite,email is not provided |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Update an invitation to a project
PUT /api/v4/projects/{id}/invitations/{email}
Updates a pending invitation to a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
emailPath, | String | Email address the invitation was previously sent to |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
access_ | Integer | Access level to grant to the invited user. Allowed values: 10,15,20,25,30,40,50 |
expires_ | String (date- | Date when the invitation expires |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad Request | — |
404 | Not Found | — |
Delete an invitation to a project
DELETE /api/v4/projects/{id}/invitations/{email}
Deletes a pending invitation to a specified email address for a project.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
emailPath, | String | Email address the invitation was previously sent to |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad Request | — |
403 | Forbidden | — |
404 | Not found | — |
409 | Could not delete invitation | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesInvitation
| Property | Type | Description |
|---|---|---|
access_ | String | — |
created_ | String | — |
created_ | String | — |
expires_ | String | — |
invite_ | String | — |
invite_ | String | — |
user_ | String | — |