Group relations export API
all tiers

Introduced in GitLab 13.12.

The group relations export API partially exports a group’s structure as separate files for each top-level relation (for example, milestones, boards, and labels).

The group relations export API is primarily used in group migration by direct transfer and can’t be used with the group import and export API.

Schedule new export

Start a new group relations export:

POST /groups/:id/export_relations
AttributeTypeRequiredDescription
idinteger/stringyesID of the group owned by the authenticated user.
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/export_relations"
{
  "message": "202 Accepted"
}

Export status

View the status of the relations export:

GET /groups/:id/export_relations/status
AttributeTypeRequiredDescription
idinteger/stringyesID of the group owned by the authenticated user.
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" \
     "https://gitlab.example.com/api/v4/groups/1/export_relations/status"

The status can be one of the following:

  • 0: started
  • 1: finished
  • -1: failed

  • 0 - started
  • 1 - finished
  • -1 - failed
[
  {
    "relation": "badges",
    "status": 1,
    "error": null,
    "updated_at": "2021-05-04T11:25:20.423Z"
  },
  {
    "relation": "boards",
    "status": 1,
    "error": null,
    "updated_at": "2021-05-04T11:25:20.085Z"
  }
]

Export download

Download the finished relations export:

GET /groups/:id/export_relations/download
AttributeTypeRequiredDescription
idinteger/stringyesID of the group owned by the authenticated user.
relationstringyesName of the group top-level relation to download.
curl --header "PRIVATE-TOKEN: <your_access_token>" --remote-header-name \
     --remote-name "https://gitlab.example.com/api/v4/groups/1/export_relations/download?relation=labels"
ls labels.ndjson.gz
labels.ndjson.gz