// Metadata created by nebel
// ParentAssemblies: assemblies/getting-started/as_managing-registry-artifacts.adoc

[id="exporting-importing-using-rest-api_{context}"]
= Exporting and importing registry data using {registry} REST API commands

[role="_abstract"]
As an administrator, you can use the Core Registry API v3 to export data from one {registry} instance and import into another {registry} instance, so you can migrate data between different instances.

This section shows a simple curl-based example of using the Core Registry API v3 to export and import existing data in `.zip` format from one {registry} instance to another. All the artifact data contained in the {registry} instance is exported in the `.zip` file.

.Prerequisites

* {registry} is installed and running in your environment.
* {registry} instances have been created:
** The source instance that you want to export data from contains at least one schema or API artifact.
** The target instance that you want to import data into is empty to preserve unique IDs.

.Procedure
. Export the {registry} data from your existing source {registry} instance:
+
[source,bash]
----
$ curl MY-REGISTRY-URL/apis/registry/v3/admin/export \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  --output my-registry-data.zip
----
+
`MY-REGISTRY-URL` is the
ifdef::apicurio-registry[]
host name on which the source {registry} is deployed. For example: `\http://my-source-registry:8080`.
endif::[]
ifdef::rh-service-registry[]
host name on which the source {registry} is deployed. For example: `my-cluster-source-registry-myproject.example.com`.
endif::[]

. Import the registry data into your target {registry} instance:
+
[source,bash]
----
$ curl -X POST "MY-REGISTRY-URL/apis/registry/v3/admin/import" \
  -H "Content-Type: application/zip" -H "Authorization: Bearer $ACCESS_TOKEN" \
  --data-binary @my-registry-data.zip
----
+
`MY-REGISTRY-URL` is the
ifdef::apicurio-registry[]
host name on which the target {registry} is deployed. For example: `\http://my-target-registry:8080`.
endif::[]
ifdef::rh-service-registry[]
host name on which the target {registry} is deployed. For example: `my-cluster-target-registry-myproject.example.com`.
endif::[]


[role="_additional-resources"]
.Additional resources
* For more details, see the `admin` endpoint in the {registry-rest-api}.
//* For details on export tools for migrating from {registry} version 1.x to 2.x, see link:https://github.com/Apicurio/apicurio-registry/tree/main/utils/exportV1[Apicurio Registry export utility for 1.x versions].
