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)).
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_ | 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 | The ID of a group |
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.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
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.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
Request body (application/json)
| Property | Type | Description |
|---|---|---|
batched | Boolean | Whether to export in batches |
Responses
| Code | Description | Schema |
|---|---|---|
202 | Accepted | — |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
503 | Service unavailable | — |
Download a relations export for a group
GET /api/v4/groups/{id}/export_relations/download
Downloads a group relations export file.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
relationQuery, | String | Group relation name |
batchedQuery | Boolean | Whether to download in batches |
batch_Query | Integer | Batch number to download |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | String (binary) (application/) |
400 | Bad Request | — |
401 | Unauthorized | — |
403 | Forbidden | — |
404 | Not found | — |
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.
Parameters
| Name | Type | Description |
|---|---|---|
idPath, | String | The ID of a group |
relationQuery | String | Group relation name |
Responses
| Code | Description | Schema |
|---|---|---|
200 | OK | 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 | 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- |