Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

The Command Line Interface

This project is the command line interface for, which allows you to quickly bootstrap full working projects as well as interface with the API.


Installation is easy... Simply type the following in your command line.

npm install -g formio-cli



formio migrate <source> [<transformer>] <destination> --src-key [SOURCE_API_KEY] --dst-key [DESTINATION_API_KEY]

The migrate command allows you to migrate submission data from one source to another using a simple command. You can either migrate data from a CSV into a form, or from a form into another form. This works by taking the data from <source>, sending it through a middleware function called <transformer> (which you provide) that transforms the data into the correct format, and then saving that data as a submission into the <destination> form. If you are migrating data from one form to the same form within two different projects, you will just provide form as your transform and your command would be as follows.

formio migrate <source> form <destination> --src-key [SOURCE_API_KEY] --dst-key [DESTINATION_API_KEY]

As an example, if you wish to move submission data from one form in a project to your remotely deployed project. You can use the following command.

formio migrate form --src-key abc1234 --dst-key cde2468

Where you would replace the domains of your from and to, but also need to replace the src-key and dst-key with the API Keys from the from project and API key of your destination project respectively.

Migrating an entire project

You can also migrate an entire project by using the "project" transform as follows.

formio migrate project --src-key=abc1234 --dst-key=cde2468

Migrating from CSV

In many cases, you may wish to migrate data from a local CSV file into a project submission table. This requires the transform middleware where you will map the columns of your CSV file into the Submission data going into

Example: Let's suppose you have the following CSV file of data.


First Name, Last Name, Email
Joe, Smith,
Jane, Thompson,
Terry, Jones,

And now you wish to import all of that data into a form. You can create the transform file like the following.


var header = true;
module.exports = function(record, next) {
  if (header) {
    // Ignore the header row.
    header = false;
    return next();
  next(null, {
    data: {
      firstName: record[0],
      lastName: record[1],
      email: record[2]

This transform middleware file can be a complete Node.js middleware method and works asynchronously so if you need to perform asynchronous behavior, you can do that by only calling the next function when the record is ready.

You can now migrate that data into your form with the following command.

formio migrate import.csv transform.js --key [YOUR_API_KEY]

Migrate and Delete

In many cases, when you migrate, you may wish to delete previous submissions during the migration phase. You can do this by adding the following option to your command.


For example, the following will perform a migration and delete any previous migration records during the migration.

formio migrate project --src-key=abc1234 --dst-key=cde2468 --delete-previous

Migrate and Delete Before and After

You can also provide a window of records that should be deleted using the --delete-after and --delete-before flags. The values should be in the format 2022-05-30T12:00:00.000Z. For example, if you wish to migrate your data, but also remove any records before 2022-05-30T09:00:00.000Z and 2022-05-30T12:00:00.000Z, you would provide the following command.

formio migrate project --src-key=abc1234 --dst-key=cde2468 --delete-after=2022-05-30T09:00:00.000Z --delete-before=2022-05-30T12:00:00.000Z --delete-previous


formio clone <source_db> <destination_db> --src-project=[PROJECT_ID]

Clones a project from one database into another, and includes all forms, submissions, and every other resources within the project. This command also retains any _id's from the source database.

Clone Multiple Projects

It is also possible to clone multiple projects at the same time by providing a comma separated list of the project ids, like this.

formio clone <source_db> <destination_db> --src-project=234234234234,345345345345345,45456456456456

Clone only records created after a certain date

You can also clone only the records that have been created after a certain ISO Timestamp. This is useful if you wish to perform multiple migrations and only wish to clone records since the last clone command was called.

formio clone <source_db> <destination_db> --src-project=[PROJECT_ID] --created-after=2342342342

Clone Submissions

formio clone -o <source_db> <destination_db> --src-project=[PROJECT_ID]

This command only clones the submissions from one environment to another.


formio deploy [src] [dst]

You can deploy a project on a paid plan on to a hosted server with this command. Specify the source and destination servers and the project will be created or updated on the destination server.


// A project without a server is implied from
formio deploy myproject http://myproject.localhost:3000

// Projects can be specified with a subdomain.
formio deploy http://myproject.localhost:3000

// Projects can also be referred to with their project id which will need to be looked up.
formio deploy{projectId} http://localhost:3000/project/{projectId}

Each server will require authentication so you will be asked twice, once for the source and once for the destination. These can also be specified with --src-username, --src-password, --dst-username, --dst-password.


formio copy form [src] [dest]

This command will copy the components of a form into another form. This will overwrite all components within the destination form if that form exists. You can also chain together multiple source forms which will aggregate the components of those forms into the destination form.


// Copy a form from one project to another.
formio copy form

// Aggregate multiple forms into the same form.
formio copy form,


The command line interface.







No packages published