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
StringID or URL-encoded path of the group
query
Query
StringFilter results by name, email, or username. Use partial values to widen the scope of the query
user_ids
Query
Array of integersFilter results by the given user IDs
skip_users
Query
Array of integersFilter skipped users out of the results
show_seat_info
Query
BooleanIf true, shows seat information for members
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesMember
400Bad Request—
404Not Found—

Add a member to a group

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

Adds a direct member to a specified group. If administrator approval for role promotions is turned on, requests that promote existing users into a billable role require administrator approval. Administrator approval for role promotions can be turned on only when the enable_member_promotion_management application setting is enabled. When a request for a single user is queued, the response has a message object that maps the username to Request queued for administrator approval.. When requests for multiple users are queued, the response has a queued_users object with the same mapping and a status of success.

Parameters

NameTypeDescription
id
Path, required
StringID or URL-encoded path of the group

Request body (application/json)

PropertyTypeDescription
access_level
Required
IntegerA valid access level. Possible values: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), or 50 (Owner). On Premium and Ultimate, 5 (Minimal access) is also valid when id is a top-level group
expires_atString (date-time)Date string in the format YEAR-MONTH-DAY
invite_sourceStringSource of the invitation that starts the member creation process. GitLab team members can view more information in this confidential issue: https://gitlab.com/gitlab-org/gitlab/-/issues/327120
Default: members-api
user_idInteger or stringUser ID of the new member, or multiple IDs separated by commas. Required if username is not provided. Mutually exclusive with username. At least one of user_id, username must be provided
usernameStringUsername of the new member, or multiple usernames separated by commas. Required if user_id is not provided. Mutually exclusive with user_id. At least one of user_id, username must be provided

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
StringID or URL-encoded path of the group
query
Query
StringFilter results by name, email, or username. Use partial values to widen the scope of the query
user_ids
Query
Array of integersFilter results by the given user IDs
show_seat_info
Query
BooleanIf true, shows seat information for members
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesMember
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. Members of an invited private group are returned if the requester is a member of the shared group or project, even if the requester is not a member of the invited private group.

Parameters

NameTypeDescription
id
Path, required
StringID or URL-encoded path of the group
user_id
Path, required
IntegerUser 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
StringID or URL-encoded path of the group
user_id
Path, required
IntegerUser 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. If administrator approval for role promotions is turned on, requests that promote existing users into a billable role require administrator approval. Administrator approval for role promotions can be turned on only when the enable_member_promotion_management application setting is enabled. When the request is queued, the response has a message object that maps the username to Request queued for administrator approval..

Parameters

NameTypeDescription
id
Path, required
StringID or URL-encoded path of the group
user_id
Path, required
IntegerUser ID of the member

Request body (application/json)

PropertyTypeDescription
access_level
Required
IntegerA valid access level. Possible values: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), or 50 (Owner). On Premium and Ultimate, 5 (Minimal access) is also valid when id is a top-level group
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
StringID or URL-encoded path of the group
user_id
Path, required
IntegerUser ID of the member
skip_subresources
Query
BooleanIf true, skips deleting direct memberships of the removed member in subgroups and 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
StringID or URL-encoded path of the project
query
Query
StringFilter results by name, email, or username. Use partial values to widen the scope of the query
user_ids
Query
Array of integersFilter results by the given user IDs
skip_users
Query
Array of integersFilter skipped users out of the results
show_seat_info
Query
BooleanIf true, shows seat information for members
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesMember
400Bad Request—
404Not Found—

Add a member to a project

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

Adds a direct member to a specified project. If administrator approval for role promotions is turned on, requests that promote existing users into a billable role require administrator approval. Administrator approval for role promotions can be turned on only when the enable_member_promotion_management application setting is enabled. When a request for a single user is queued, the response has a message object that maps the username to Request queued for administrator approval.. When requests for multiple users are queued, the response has a queued_users object with the same mapping and a status of success.

Parameters

NameTypeDescription
id
Path, required
StringID or URL-encoded path of the project

Request body (application/json)

PropertyTypeDescription
access_level
Required
IntegerA valid access level. Possible values: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), or 50 (Owner)
expires_atString (date-time)Date string in the format YEAR-MONTH-DAY
invite_sourceStringSource of the invitation that starts the member creation process. GitLab team members can view more information in this confidential issue: https://gitlab.com/gitlab-org/gitlab/-/issues/327120
Default: members-api
user_idInteger or stringUser ID of the new member, or multiple IDs separated by commas. Required if username is not provided. Mutually exclusive with username. At least one of user_id, username must be provided
usernameStringUsername of the new member, or multiple usernames separated by commas. Required if user_id is not provided. Mutually exclusive with user_id. At least one of user_id, username must be provided

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
StringID or URL-encoded path of the project
query
Query
StringFilter results by name, email, or username. Use partial values to widen the scope of the query
user_ids
Query
Array of integersFilter results by the given user IDs
show_seat_info
Query
BooleanIf true, shows seat information for members
page
Query
IntegerPage number of results to retrieve
Default: 1
Example: 1
per_page
Query
IntegerNumber of items to list per page
Default: 20
Example: 20

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesMember
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. Members of an invited private group are returned if the requester is a member of the shared group or project, even if the requester is not a member of the invited private group.

Parameters

NameTypeDescription
id
Path, required
StringID or URL-encoded path of the project
user_id
Path, required
IntegerUser 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
StringID or URL-encoded path of the project
user_id
Path, required
IntegerUser 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. If administrator approval for role promotions is turned on, requests that promote existing users into a billable role require administrator approval. Administrator approval for role promotions can be turned on only when the enable_member_promotion_management application setting is enabled. When the request is queued, the response has a message object that maps the username to Request queued for administrator approval..

Parameters

NameTypeDescription
id
Path, required
StringID or URL-encoded path of the project
user_id
Path, required
IntegerUser ID of the member

Request body (application/json)

PropertyTypeDescription
access_level
Required
IntegerA valid access level. Possible values: 10 (Guest), 15 (Planner), 20 (Reporter), 25 (Security Manager), 30 (Developer), 40 (Maintainer), or 50 (Owner)
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
StringID or URL-encoded path of the project
user_id
Path, required
IntegerUser ID of the member
skip_subresources
Query
BooleanIf true, skips deleting direct memberships of the removed member in subgroups and 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_urlStringURL of the user’s avatar
Example: https://gravatar.com/avatar/1
created_atString—
created_byAPIEntitiesUserBasic—
custom_attributesArray of APIEntitiesCustomAttribute—
expires_atString—
idInteger (int64)ID of the user
Example: 1
lockedBooleanIf true, the user account is locked, and the user cannot sign in until the lock expires or an administrator unlocks the account
nameStringName of the user. For a bot user, **** if the current user cannot read the bot’s project or group
Example: Administrator
public_emailStringPublic email address of the user
Example: john@example.com
stateStringState of the user account. Possible values: active, blocked, ldap_blocked, blocked_pending_approval, banned, or deactivated
Example: active
two_factor_enabledBooleanIf true, the user has two-factor authentication enabled. Returned only for users with the Owner role and administrators. Introduced in GitLab 19.4
usernameStringUsername of the user
Example: admin
web_urlStringURL of the user’s profile
Example: https://gitlab.example.com/root

APIEntitiesUserBasic

PropertyTypeDescription
avatar_pathStringExample: /user/avatar/28/The-Big-Lebowski-400-400.png
avatar_urlStringURL of the user’s avatar
Example: https://gravatar.com/avatar/1
custom_attributesArray of APIEntitiesCustomAttribute—
idInteger (int64)ID of the user
Example: 1
lockedBooleanIf true, the user account is locked, and the user cannot sign in until the lock expires or an administrator unlocks the account
nameStringName of the user. For a bot user, **** if the current user cannot read the bot’s project or group
Example: Administrator
public_emailStringPublic email address of the user
Example: john@example.com
stateStringState of the user account. Possible values: active, blocked, ldap_blocked, blocked_pending_approval, banned, or deactivated
Example: active
usernameStringUsername of the user
Example: admin
web_urlStringURL of the user’s profile
Example: https://gitlab.example.com/root