Use this API to manage the members of a group or a project, including inherited memberships, membership approvals, and the billable members of a group.

List all direct members of a group

GET /api/v4/groups/{id}/members

Lists all direct members of a specified group viewable by the authenticated user. Does not return inherited members from ancestor groups or invited groups.

Parameters

NameTypeDescription
id
Path, required
StringThe group ID
query
Query
StringA query string to search for members
user_ids
Query
Array of integersArray of user ids to look up for membership
skip_users
Query
Array of integersArray of user ids to be skipped for membership
show_seat_info
Query
BooleanShow seat information for members
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Add a member to a group

POST /api/v4/groups/{id}/members

Adds a member to a specified group.

Parameters

NameTypeDescription
id
Path, required
StringThe group ID

Request body (application/json)

PropertyTypeDescription
access_level
Required
IntegerA valid access level
expires_atString (date-time)Date string in the format YEAR-MONTH-DAY
invite_sourceStringSource that triggered the member creation process
Default: members-api
user_idInteger or stringThe user ID of the new member or multiple IDs separated by commas. Mutually exclusive with username
usernameStringThe username of the new member or multiple usernames separated by commas. Mutually exclusive with user_id

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMember
400Bad Request—
404Not Found—

List all members of a group

GET /api/v4/groups/{id}/members/all

Lists all members of a specified group viewable by the authenticated user. Also returns inherited members from ancestor groups or invited groups. If a user is a member of this group and one or more ancestor groups, only returns the highest access_level. Members from an invited group are returned if the invited group is public, the requester is a member of an invited group, or the requester is a member of the shared group or project.

Parameters

NameTypeDescription
id
Path, required
StringThe group ID
query
Query
StringA query string to search for members
user_ids
Query
Array of integersArray of user ids to look up for membership
show_seat_info
Query
BooleanShow seat information for members
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Retrieve a group member

GET /api/v4/groups/{id}/members/all/{user_id}

Retrieves a specified member of a group. Returns direct members and members inherited or invited through ancestor groups.

Parameters

NameTypeDescription
id
Path, required
StringThe group ID
user_id
Path, required
IntegerThe user ID of the member

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Retrieve a direct group member

GET /api/v4/groups/{id}/members/{user_id}

Retrieves a specified member of a group. Returns only direct members and not inherited members through ancestor groups.

Parameters

NameTypeDescription
id
Path, required
StringThe group ID
user_id
Path, required
IntegerThe user ID of the member

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Update a group member

PUT /api/v4/groups/{id}/members/{user_id}

Updates a specified member of a group.

Parameters

NameTypeDescription
id
Path, required
StringThe group ID
user_id
Path, required
IntegerThe user ID of the new member

Request body (application/json)

PropertyTypeDescription
access_level
Required
IntegerA valid access level
expires_atString (date-time)Date string in the format YEAR-MONTH-DAY

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Remove a member from a group

DELETE /api/v4/groups/{id}/members/{user_id}

Removes a specified user from a group. The user must be a direct member.

Parameters

NameTypeDescription
id
Path, required
StringThe group ID
user_id
Path, required
IntegerThe user ID of the member
skip_subresources
Query
BooleanIf true, the member retains any direct memberships in subgroups or projects
Default: false
unassign_issuables
Query
BooleanIf true, unassigns the member from any issues or merge requests in the group
Default: false

Responses

CodeDescriptionSchema
204Resource deleted—
400Bad Request—
404Not Found—

List all direct members of a project

GET /api/v4/projects/{id}/members

Lists all direct members of a specified project viewable by the authenticated user. Does not return inherited members from ancestor groups or invited groups.

Parameters

NameTypeDescription
id
Path, required
StringThe project ID
query
Query
StringA query string to search for members
user_ids
Query
Array of integersArray of user ids to look up for membership
skip_users
Query
Array of integersArray of user ids to be skipped for membership
show_seat_info
Query
BooleanShow seat information for members
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Add a member to a project

POST /api/v4/projects/{id}/members

Adds a member to a specified project.

Parameters

NameTypeDescription
id
Path, required
StringThe project ID

Request body (application/json)

PropertyTypeDescription
access_level
Required
IntegerA valid access level
expires_atString (date-time)Date string in the format YEAR-MONTH-DAY
invite_sourceStringSource that triggered the member creation process
Default: members-api
user_idInteger or stringThe user ID of the new member or multiple IDs separated by commas. Mutually exclusive with username
usernameStringThe username of the new member or multiple usernames separated by commas. Mutually exclusive with user_id

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesMember
400Bad Request—
404Not Found—

List all members of a project

GET /api/v4/projects/{id}/members/all

Lists all members of a specified project viewable by the authenticated user. Also returns inherited members from ancestor groups or invited groups. If a user is a member of this project and one or more ancestor groups, only returns the highest access_level. Members from an invited group are returned if the invited group is public, the requester is a member of an invited group, or the requester is a member of the shared group or project.

Parameters

NameTypeDescription
id
Path, required
StringThe project ID
query
Query
StringA query string to search for members
user_ids
Query
Array of integersArray of user ids to look up for membership
show_seat_info
Query
BooleanShow seat information for members
page
Query
IntegerCurrent page number
Default: 1
Example: 1
per_page
Query
IntegerNumber of items per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Retrieve a project member

GET /api/v4/projects/{id}/members/all/{user_id}

Retrieves a specified member of a project. Returns direct members and members inherited or invited through ancestor groups.

Parameters

NameTypeDescription
id
Path, required
StringThe project ID
user_id
Path, required
IntegerThe user ID of the member

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Retrieve a direct project member

GET /api/v4/projects/{id}/members/{user_id}

Retrieves a specified member of a project. Returns only direct members and not inherited members through ancestor groups.

Parameters

NameTypeDescription
id
Path, required
StringThe project ID
user_id
Path, required
IntegerThe user ID of the member

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Update a project member

PUT /api/v4/projects/{id}/members/{user_id}

Updates a specified member of a project.

Parameters

NameTypeDescription
id
Path, required
StringThe project ID
user_id
Path, required
IntegerThe user ID of the new member

Request body (application/json)

PropertyTypeDescription
access_level
Required
IntegerA valid access level
expires_atString (date-time)Date string in the format YEAR-MONTH-DAY

Responses

CodeDescriptionSchema
200OKAPIEntitiesMember
400Bad Request—
404Not Found—

Remove a member from a project

DELETE /api/v4/projects/{id}/members/{user_id}

Removes a specified user from a project. The user must be a direct member.

Parameters

NameTypeDescription
id
Path, required
StringThe project ID
user_id
Path, required
IntegerThe user ID of the member
skip_subresources
Query
BooleanIf true, the member retains any direct memberships in subgroups or projects
Default: false
unassign_issuables
Query
BooleanIf true, unassigns the member from any issues or merge requests in the project
Default: false

Responses

CodeDescriptionSchema
204Resource deleted—
400Bad Request—
404Not Found—

Schemas

Objects returned by the operations above and objects nested in their request bodies.

APIEntitiesCustomAttribute

PropertyTypeDescription
keyStringExample: foo
valueStringExample: bar

APIEntitiesMember

PropertyTypeDescription
access_levelString—
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringExample: https://gravatar.com/avatar/1
created_atString—
created_byAPIEntitiesUserBasic—
custom_attributesArray of APIEntitiesCustomAttribute—
expires_atString—
idInteger (int64)Example: 1
lockedBoolean—
nameStringExample: Administrator
public_emailStringExample: john@example.com
stateStringExample: active
two_factor_enabledBoolean—
usernameStringExample: admin
web_urlStringExample: https://gitlab.example.com/root

APIEntitiesUserBasic

PropertyTypeDescription
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringExample: https://gravatar.com/avatar/1
custom_attributesArray of APIEntitiesCustomAttribute—
idInteger (int64)Example: 1
lockedBoolean—
nameStringExample: Administrator
public_emailStringExample: john@example.com
stateStringExample: active
usernameStringExample: admin
web_urlStringExample: https://gitlab.example.com/root