Getting Started with API Migration - Editor
Migrate an existing API tutorialLocal with an editor
Import an API into Zuplo and verify that a request through the gateway matches the original backend.
Follow along using
Import an existing API into a local Zuplo project, add its upstream handler, and compare responses before moving client traffic.
Prerequisites
- Node.js 24 or later and Git.
- A terminal and an editor.
- A Zuplo account for linking and deployment.
Import and test your API
-
Create a project
Run:
CodeWhen prompted, choose Yes to create a matching Portal project, then complete sign-in and account selection to link your local copy. For an existing project, work on a new Git branch before importing routes.
-
Get your existing OpenAPI document
Get your API's OpenAPI document from its repository, API documentation, or current gateway. Save a copy in the project root. The commands below use
openapi.json; substitute your file's name if it differs.If you don't have an OpenAPI document, download the
Swagger Petstore OpenAPI document
.
Choose a read-only operation and call it directly on the original API. Record its URL, required headers, query parameters, and response. For Petstore, try:
Code -
Import the routes
Run:
CodeOpen
config/routes.oas.jsonand find the operation you chose. The destination must end in.oas.json. Seeopenapi mergefor importing from URLs and controlling server paths. -
Configure forwarding
On the operation you chose, set
x-zuplo-routeto the following, replacingYOUR_UPSTREAM_BASE_URLwith your original API's base URL:CodeImporting OpenAPI describes the route; this handler makes it forward to the upstream. See URL Forward. Check the imported path so any server prefix appears only once. For Petstore, use
https://petstore3.swagger.io/api/v3if the route path is/pet/findByStatus, orhttps://petstore3.swagger.ioif it already starts with/api/v3. -
Compare local and upstream responses
Start
npm run dev. In a second terminal, run:CodeReplace
YOUR_ROUTEwith the imported route path. Include the same headers and query parameters as your original request, such asstatus=availablefor Petstore. Compare the status and response structure with the original API; live data can change between requests. Check the gateway logs if you get an error. -
Preserve behavior when importing updates
Before re-importing a changed OpenAPI file, commit your work. Run the same merge command and review
git diff. The importer merges routes by path and method and preserves Zuplo route configuration. Routes absent from the new document aren't automatically deleted; review them explicitly.For your own API, translate authentication, rate limits, and transformations into Zuplo policies. OpenAPI security declarations don't enforce access control. Test both allowed and rejected requests, plus the headers, query parameters, and bodies your clients send. The migration overview covers existing gateway configurations.
-
Deploy and move a test client
Follow Deploy to the edge, then repeat your tests against the deployed gateway URL. Change one test client's base URL to that gateway and verify its workflow before moving more clients. Keep the original endpoint available for rollback.