How to Migrate Documents from Development to Production Using the Wyn API

Background:


At Wyn, we recommend that clients create their reports, dashboards, and notebooks in a development or testing environment. After thorough testing, the content can then be migrated to the production environment.
This raises a common question: how can documents be migrated between environments?

There are two main options:

Option 1 – Using the Admin Portal (GUI)
Documents can be exported from the Development environment and then imported into the Production environment using the Admin Portal.

Option 2 – Using the Document Export & Import API
The same process can be automated using the Wyn API.

Suppose you want to export all reports that have been modified after a specific date (for example, 2026-02-15) and import them into another Wyn environment.
The following Node.js sample script demonstrates how to perform a bulk migration of documents from one environment to another using the API.

API Endpoints Used 

The following API endpoints are used in this sample.

Search Documents 

  • {server}/api/v2/common/documents/search

This endpoint allows you to search for documents based on different criteria, such as document type, created date, modified date, and modifier.
In this example, documents are filtered by: Type, Modified date and Modifier

Export Documents 

  • {server}/api/v2/admin/export

This endpoint exports the selected documents into a .zip package.

Import Documents 

  • {server}/api/v2/admin/import

This endpoint allows documents to be imported into Wyn.

(Optional) Get Available Document Types 

  • {server}/api/v2/common/documents/document-types

This endpoint retrieves the list of available document types in the system.

It is used in this sample to allow the user to select a document type when filtering.

Prerequisites

• Node.js 18+ installed

• Access to Dev and Production Wyn instances

• Reference Tokens for both environments

• Admin-level permissions

In this sample, a .env file is used. Therefore, you need to create a .env file and add the following values:

DEV_ENV_URL=https://dev.wynserver.com

DEV_ENV_URL=https://dev.wynserver.com

DEV_ENV_REFERENCE_TOKEN=xxxxxxxx

PROD_ENV_REFERENCE_TOKEN=xxxxxxxx

Workflow


The workflow implemented in this sample is simple and easy to follow.


Retrieve the list of available document types

Prompt the user to optionally filter by:

Document type

Modified date

Modifier

Search for documents based on the selected filters

Display the matching documents

Allow the user to select which documents to export

Export the selected documents to a .zip file

Import the package into the target environment

Process Overview

 A([Start]) --> B[List the available document types] 
    B --> C[Ask user to filter by type, modified date, and modifier]
    C --> D[Search documents using the filters]
    D --> E[User selects documents to export] 
    E --> F[Export documents (.zip)]
    F --> G[Import documents into target environment]

The following screen recording demonstrates how the sample script works from the command line.

⬇ Download Script

Enea Gega

Enea Gega

Enea is a Technical Product Enablement Specialist for the Wyn Enterprise Platform. He acts as a vital bridge between customers, product teams, and engineering to ensure that every new feature delivers genuine value and drives user adoption.

Enea specializes in translating complex customer needs into actionable insights for product roadmaps and technical documentation. By partnering cross-functionally, he ensures seamless delivery readiness and alignment across all releases.