Try WSO2 Cloud for Free
Sign in

All docs This doc
Skip to end of metadata
Go to start of metadata

Any user with admin privileges can migrate APIs from one WSO2 API Cloud environment to another without having to recreate the APIs. You do this in instances where separate API Cloud environments exist, for example, for development, testing and production. For more information on how to separate API Cloud environments, see the Separating Development, Test, and Production blog post.

In this tutorial, you create an API in one WSO2 API Cloud organization (in this case, CompanyT DEV, which acts as the development environment) and migrate it to another WSO2 API Cloud organization (in this case, CompanyT TEST, which acts as the test environment).

Let's get started!

  1. Log in to WSO2 Cloud by going to, entering your email address, and clicking Sign In.
  2. In the dialog box that appears, enter your credentials and click Sign In
  3. Select your development organization (in this case, CompanyT DEV) and click Go
  4. Select API Cloud from the list of Cloud options.
  5. Create and publish an API with the following details. If you do not know how to create and publish an API, see Create and Publish an API.

    Tab NameParametersValues
    Design TabNamePhoneTest





    API Definition

    Click Next: Implement > without entering anything. You are prompted to add a wildcard resource (/*). Click Yes.

    Implement Tab > Managed APIProduction Endpoint
    Manage TabTier Availability


    You cannot import a tier to an environment if it is not supported there, although it is supported in the source environment.
    For example, if you have a tier (e.g., Gold-Updated tier) that is supported in one API Cloud environment, but not in the other. Therefore, in the latter mentioned scenario, you cannot import the tier from one API Cloud environment to the other. 

  6. Construct and copy your username, which should be in the following format: <email_address>@<tenant_domain>.
  7. Use the command line (if you are on a Mac/Linux) or an online Base64 encoder such as, to create a Base64-encoded string of your WSO2 API Cloud's credentials, using the following format.

    If you are on a Mac/Linux, you can use following command.
    echo -n <username>:<password> | base64

    Example: echo -n | base64

  8. Install cURL in your local machine, if it is not already installed.

  9. Execute the following command to  export your API from your tenant account in the WSO2 API Cloud as a ZIP file. 

    curl -H "Authorization:Basic <base64-encoded-credentials-from_previous_step>"
    -X GET "<API_Name>&version=<API-Version>
    &provider=<API_provider>" -k > <ZIP_File_Name>.zip
    According to our example, the command is:
    curl -H "Authorization:Basic <base64-encoded-credentials-from_previous_step>" -X GET "" -k >

    You have exported an API to a ZIP file. Let's import that to your API Cloud test environment. 

  10. Log out of WSO2 API Cloud, enter your credentials and click Sign In.

  11. Select your test organization (in this case, CompanyT TEST) and click Go

  12. Construct and copy your username, which should be in the following format: <email_address>@<tenant_domain>.
  13. Create a Base64-encoded string of your API Cloud's credentials, separated by a colon in the format <username>:<password>, similar to what you did in step 7 above.

  14. Execute the following command to import the API to your test organization.

    curl -H "Authorization:Basic <base64-encoded-credentials-from_previous_step>" -F file=@"<full_path_of_zip_file>" -k -X POST ""
    For example:
    curl -H "Authorization:Basic <base64-encoded-credentials-from_previous_step>" -F file=@"/Users/Admin15/Downloads/" -k -X POST ""

    Tip: Make sure the name and context of the API that you are importing (e.g., PhoneTest and /phonetest) do not duplicate that of an existing API in the API Cloud.

  15. Sign in to your test environment and note that the API that you imported now appears in the API Publisher.

    Note that the API in the test environment is in the CREATED state, although it was in the PUBLISHED state in your development environment. This is done to enable you to modify the API before publishing it.

In this tutorial, you created an API in one API Cloud environment and exported that to another API Cloud environment without having to recreate the API from scratch.

  • No labels