Use this API to interact with GitLab organizations. For more information, see organizations.

Create an organization

POST /api/v4/organizations

Creates an organization. This feature was introduced in GitLab 17.5. This feature is behind the allow_organization_creation feature flag. In GitLab 18.3, the feature flag changed to organization_switching. In GitLab 19.4, the feature flag changed to org_stage_experimental.

Request body (multipart/form-data)

PropertyTypeDescription
avatarString (binary)The avatar image for the organization
descriptionStringThe description of the organization
name
Required
StringThe name of the organization
path
Required
StringThe path of the organization
visibilityStringThe visibility level of the organization
Allowed values: private, public

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesOrganizationsOrganization
400Bad Request—

Soft-delete an organization

DELETE /api/v4/organizations/{id}

This feature was introduced in GitLab 19.2.

Parameters

NameTypeDescription
id
Path, required
IntegerID of the organization

Responses

CodeDescriptionSchema
202Accepted—
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—

Restore a soft-deleted organization

POST /api/v4/organizations/{id}/restore

Restores a soft-deleted organization. Administrators only. This feature was introduced in GitLab 19.6.

Parameters

NameTypeDescription
id
Path, required
IntegerThe ID of the organization

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesOrganizationsOrganization
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—

Transfer users to an organization

POST /api/v4/organizations/{id}/transfer_users

Transfers ownership of users to the organization, including their personal namespaces and projects. All users must currently belong to the same organization. This is a change of ownership, not organization membership. The transfer runs in the background. Administrators only. No user can be an internal user, such as the ghost user or a bot like support_bot or admin_bot. Service accounts and project access token bots can be transferred. This feature was introduced in GitLab 19.6.

Parameters

NameTypeDescription
id
Path, required
IntegerThe ID of the organization to transfer the users to

Request body (application/json)

PropertyTypeDescription
user_ids
Required
Array of integersThe IDs of the users to transfer. Maximum 50

Responses

CodeDescriptionSchema
202Accepted—
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—

List organization users

GET /api/v4/organizations/{id}/users

Lists the users of an organization. Uses keyset pagination. This feature was introduced in GitLab 19.6.

Parameters

NameTypeDescription
id
Path, required
IntegerThe ID of the organization
pagination
Query
StringPagination method. Only keyset is supported
Allowed values: keyset
Default: keyset
cursor
Query
StringCursor for obtaining the next set of records
order_by
Query
StringSort results by the specified field
Allowed values: id
Default: id
sort
Query
StringSort results in ascending or descending order
Allowed values: asc, desc
Default: asc
per_page
Query
IntegerNumber of items to list per page
Default: 20
Maximum: 100
Minimum: 1

Responses

CodeDescriptionSchema
200OKArray of APIEntitiesOrganizationsOrganizationUser
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—
429Too many requests—

Add a user to an organization

POST /api/v4/organizations/{id}/users

Adds a user to an organization, optionally as an owner. This feature was introduced in GitLab 19.6.

Parameters

NameTypeDescription
id
Path, required
IntegerThe ID of the organization

Request body (application/json)

PropertyTypeDescription
access_levelStringThe access level of the user in the organization
Allowed values: default, owner
Default: default
username
Required
StringThe username of the user to add

Responses

CodeDescriptionSchema
201CreatedAPIEntitiesOrganizationsOrganizationUser
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—
429Too many requests—

Update an organization user

PUT /api/v4/organizations/{id}/users/{user_id}

Changes the access level of a user in an organization, for example to promote them to owner. This feature was introduced in GitLab 19.6.

Parameters

NameTypeDescription
id
Path, required
IntegerThe ID of the organization
user_id
Path, required
IntegerThe ID of the user to update

Request body (application/json)

PropertyTypeDescription
access_level
Required
StringThe access level of the user in the organization
Allowed values: default, owner
Minimum length: 1

Responses

CodeDescriptionSchema
200OKAPIEntitiesOrganizationsOrganizationUser
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—
429Too many requests—

Remove a user from an organization

DELETE /api/v4/organizations/{id}/users/{user_id}

Removes a user from an organization, including their group and project memberships in it. The last owner of an organization cannot be removed. This feature was introduced in GitLab 19.6.

Parameters

NameTypeDescription
id
Path, required
IntegerThe ID of the organization
user_id
Path, required
IntegerThe ID of the user to remove

Responses

CodeDescriptionSchema
204No Content—
400Bad request—
401Unauthorized—
403Forbidden—
404Not found—
429Too many requests—

Schemas

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

APIEntitiesOrganizationsOrganization

PropertyTypeDescription
avatar_urlStringURL of the organization avatar
Example: https://example.com/uploads/-/system/organizations/organization_detail/avatar/1/avatar.png
created_atString (date-time)Date and time when the organization was created
Example: 2022-02-24T20:22:30.097Z
descriptionStringDescription of the organization
Example: My description
idInteger (int64)ID of the organization
Example: 1
nameStringName of the organization
Example: GitLab
pathStringPath of the organization
Example: gitlab
updated_atString (date-time)Date and time when the organization was last updated
Example: 2022-02-24T20:22:30.097Z
uuidStringUUID of the organization
Example: 0192f8c2-1a2b-7cde-89ab-0123456789ab
visibilityStringVisibility level of the organization
Example: public
web_urlStringWeb URL of the organization
Example: https://example.com/o/gitlab/-/overview

APIEntitiesOrganizationsOrganizationUser

PropertyTypeDescription
access_levelStringExample: owner
botBooleanExample: false
idInteger (int64)Example: 1
usernameStringExample: jane_doe