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)
| Property | Type | Description |
|---|---|---|
avatar | String (binary) | The avatar image for the organization |
description | String | The description of the organization |
nameRequired | String | The name of the organization |
pathRequired | String | The path of the organization |
visibility | String | The visibility level of the organization Allowed values: private,public |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad Request | — |
Soft-delete an organization
DELETE /api/v4/organizations/{id}
This feature was introduced in GitLab 19.2.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | Integer | ID of the organization |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Accepted | — |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the organization |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the organization to transfer the users to |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
user_Required | Array of integers | The IDs of the users to transfer. |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Accepted | — |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not 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
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the organization |
paginationQuery | String | Pagination method.keyset is supportedAllowed values: keysetDefault: keyset |
cursorQuery | String | Cursor for obtaining the next set of records |
order_Query | String | Sort results by the specified field Allowed values: idDefault: id |
sortQuery | String | Sort results in ascending or descending order Allowed values: asc,descDefault: asc |
per_Query | Integer | Number of items to list per page Default: 20Maximum: 100Minimum: 1 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too 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
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the organization |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
access_ | String | The access level of the user in the organization Allowed values: default,ownerDefault: default |
usernameRequired | String | The username of the user to add |
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too 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
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the organization |
user_Path, | Integer | The ID of the user to update |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
access_Required | String | The access level of the user in the organization Allowed values: default,ownerMinimum length: 1 |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | APIEntities |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too 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
| Name | Type | Description |
|---|---|---|
idPath, | Integer | The ID of the organization |
user_Path, | Integer | The ID of the user to remove |
Responses
| Code | Description | Schema |
|---|---|---|
204 | No Content | — |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too many requests | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesOrganizationsOrganization
| Property | Type | Description |
|---|---|---|
avatar_ | String | URL of the organization avatar Example: https: |
created_ | String (date- | Date and time when the organization was created Example: 2022- |
description | String | Description of the organization Example: My description |
id | Integer (int64) | ID of the organization Example: 1 |
name | String | Name of the organization Example: Git |
path | String | Path of the organization Example: gitlab |
updated_ | String (date- | Date and time when the organization was last updated Example: 2022- |
uuid | String | UUID of the organization Example: 0192f8c2- |
visibility | String | Visibility level of the organization Example: public |
web_ | String | Web URL of the organization Example: https: |
APIEntitiesOrganizationsOrganizationUser
| Property | Type | Description |
|---|---|---|
access_ | String | Example:owner |
bot | Boolean | Example:false |
id | Integer (int64) | Example:1 |
username | String | Example:jane_ |