Use this API to migrate a group structure by exporting and importing a file. When you use it with the project import and export API, you can preserve relationships that span the group, such as connections between project issues and group epics. Run the group export and import first, then import the project exports into the group structure.
A group export includes group milestones, boards, labels, badges, members, events, wikis (Premium and Ultimate only), and subgroups. Each subgroup includes all of the same data.
To preserve the member list and permissions of an imported group, make sure those users exist on the destination instance before you import.
Because of issue 405168, imported groups have
a private visibility level unless you import them into a parent group. By default, groups imported
into a parent group inherit the visibility of the parent.
The destination instance uses the group relations export endpoints during group migration by direct transfer. You don’t usually need to call them yourself. In this context, a relation is an exportable item such as an epic, including any related items such as a label. These endpoints require your instance to meet certain prerequisites, and can’t be used with the file-based export and import endpoints.
Create a group import
POST /api/v4/groups/import
Creates a group import. The maximum import file size can be set by the Administrator on GitLab Self-Managed (defaults to 0 (unlimited)). Administrators can set it in the Admin area or with the max_import_size application setting.
Request body (multipart/form-data)
| Property | Type | Description |
|---|---|---|
fileRequired | String (binary) | The group export file to be imported |
nameRequired | String | Group name |
organization_ | Integer | The ID of the organization that the group will be part of.parent_ is provided, |
parent_ | Integer | The ID of the parent group that the group will be imported into. |
pathRequired | String | Group path |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Accepted | — |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
429 | Too many requests | — |
503 | Service unavailable | — |
Workhorse authorize the group import upload
POST /api/v4/groups/import/authorize
This feature was introduced in GitLab 12.8
Responses
| Code | Description | Schema |
|---|---|---|
201 | Created | — |
400 | Bad Request | — |
Create a group export
POST /api/v4/groups/{id}/export
Creates a group export for a specified group.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Accepted | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too many requests | — |
503 | Service unavailable | — |
Retrieve a group export download
GET /api/v4/groups/{id}/export/download
Retrieves the exported archive for a specified group. Time spent on exporting a group might vary depending on the size of the group. This endpoint returns the exported archive when it is available, or a 404 message otherwise.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
503 | Service unavailable | — |
Schedule a relations export for a group
POST /api/v4/groups/{id}/export_relations
Schedules a relations export for a specified group. By default, this endpoint has a rate limit of 6 requests per minute for each user and group. On GitLab Self-Managed and GitLab Dedicated, an administrator can change this limit in the application settings.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
batched | Boolean | If true, |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Accepted | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too many requests | — |
503 | Service unavailable | — |
Download a relations export for a group
GET /api/v4/groups/{id}/export_relations/download
Downloads a group relations export file. By default, this endpoint has a rate limit of 100 requests per minute for each user and group. On GitLab Self-Managed and GitLab Dedicated, an administrator can change this limit in the application settings.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
relationQuery, | String | Name of the group top- |
batchedQuery | Boolean | If true,batched,batch_ must be provided |
batch_Query | Integer | Number of the export batch to download.batched,batch_ must be provided |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
429 | Too many requests | — |
503 | Service unavailable | — |
Retrieve the status of an relations export for a group
GET /api/v4/groups/{id}/export_relations/status
Retrieves the status of a relations export for a group. The status is one of 0 (started), 1 (finished), or -1 (failed).
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | ID or URL- |
relationQuery | String | Name of the group top- |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | Array of APIEntities |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
503 | Service unavailable | — |
Schemas
Objects returned by the operations above and objects nested in their request bodies.
APIEntitiesBulkImportsExportBatchStatus
| Property | Type | Description |
|---|---|---|
batch_ | Integer | Example:1 |
error | String | Example:Error message |
objects_ | Integer | Example:100 |
status | String | Allowed values:started,finished,failedExample: started |
updated_ | String (date- | Example:2012- |
APIEntitiesBulkImportsExportStatus
| Property | Type | Description |
|---|---|---|
batched | Boolean | Example:true |
batches | Array of APIEntities | — |
batches_ | Integer | Example:2 |
error | String | Example:Error message |
relation | String | Example:issues |
status | String | Allowed values:pending,started,finished,failedExample: started |
total_ | Integer | Example:100 |
updated_ | String (date- | Example:2012- |