You are viewing beta documentation for Formie 4.x. View the latest stable version (3.x) →
Developers

Console Commands

Formie comes with a number of command line utilities that can be run on-demand, or on a set schedule.

Forms

Re-save Forms

Refer to the Craft docs (opens new window) on available options.

./craft resave/formie-forms --update-search-index=1

Delete Forms

You can bulk delete forms with this command.

OptionDescription
--form-handleThe form handle(s) to delete. Can be set to multiple comma-separated handles.
--form-idThe form ID(s) to delete. Can be set to multiple comma-separated IDs.
./craft formie/forms/delete --form-handle=form1,anotherForm

Import/Export

List Forms

Lists all available Formie forms that can be exported or imported.

OptionDescription
folderPathOptional path to look for JSON files. Defaults to the plugin's export folder.
./craft formie/forms/list

Export Forms

Export Formie forms as JSON files. Requires form IDs or handles as a comma-separated list.

./craft formie/forms/export 1,contact-form,newsletter

Import Form

Import a Formie form from a JSON file.

OptionDescription
fileLocationPath to a JSON file to import. Can be relative to the plugin's export folder or an absolute path.
--createWhether to create a new form instead of updating an existing one. Default is false.
./craft formie/forms/import formie-contact-form.json

Import All Forms

Import all Formie form JSON files from a folder.

OptionDescription
folderPathOptional path to look for JSON files. Defaults to the plugin's export folder.
--createWhether to create new forms instead of updating existing ones. Default is false.
./craft formie/forms/import-all

Submissions

Re-save Submissions

Refer to the Craft docs (opens new window) on available options.

./craft resave/formie-submissions --form-id=1234 --update-search-index=1

Run Integrations

For a provided submission, run the provided integration.

OptionDescription
--submission-idThe submission ID(s) to use data for. Can be set to multiple comma-separated IDs.
--integrationThe handle of the integration to trigger.
./craft formie/submissions/run-integration --submission-id=12345 --integration=mailchimp

Send Email Notification

For a provided submission, send the provided notification.

OptionDescription
--submission-idThe submission ID(s) to use data for. Can be set to multiple comma-separated IDs.
--notification-idThe ID of the notification to trigger.
./craft formie/submissions/send-notification --submission-id=12345 --notification-id=12

Cron

Run Scheduled Tasks

Runs Formie tasks that should be scheduled on cron: cleanup/retention and due scheduled reports.

Schedule this command on production sites — for example, hourly:

./craft formie/cron/run
OptionDescription
--skip-gcSkip cleanup and retention tasks.
--skip-reportsSkip scheduled report delivery.
--onlyComma-separated task groups to run: gc, reports.

Use --only or the skip flags when you want separate cron schedules — for example, daily cleanup and hourly reports:

# Daily cleanup at 3am
0 3 * * * /path/to/craft formie/cron/run --only=gc

# Hourly scheduled reports
0 * * * * /path/to/craft formie/cron/run --only=reports

Craft's garbage collection (opens new window) still runs Formie cleanup as a best-effort fallback on web requests, but production sites should not rely on it.

Reports

Run Scheduled Reports

Sends any enabled scheduled reports that are due. This is included in ./craft formie/cron/run, or you can schedule it separately — for example, every hour — so scheduled report deliveries run automatically.

./craft formie/reports/run-scheduled

Cleanup

Run All Cleanup Tasks

Runs every Formie cleanup and retention task. This is included in ./craft formie/cron/run, or you can schedule it separately — for example, daily:

./craft formie/gc/run
OptionDescription
--onlyComma-separated cleanup task handles. Omit to run all tasks. Handles: incomplete-submissions, data-retention-submissions, sent-notifications, file-upload-asset-retention, stale-pending-uploads, report-exports, submission-states, draft-storage.

Prune Incomplete Submissions

Deletes any incomplete submissions that exceed the "Maximum Incomplete Submission Age" plugin setting.

./craft formie/gc/prune-incomplete-submissions

Prune Data Retention Submissions

Deletes any submissions that exceed your data retention form settings.

./craft formie/gc/prune-data-retention-submissions

Prune Sent Notifications

Deletes sent notifications that exceed the plugin's maximum age setting.

./craft formie/gc/prune-sent-notifications

Prune Submission States

Deletes stale submission draft state records.

./craft formie/gc/prune-submission-states

Prune Draft Storage

Deletes expired submission draft storage rows.

./craft formie/gc/prune-draft-storage

Prune File Upload Asset Retention

Deletes uploaded assets that exceed a File Upload field's asset retention setting while keeping the submission record.

./craft formie/gc/prune-file-upload-asset-retention

Prune Stale Pending Uploads

Deletes unfinalized staged File Upload assets that exceed the plugin's maximum incomplete submission age.

./craft formie/gc/prune-stale-pending-uploads

Prune Report Exports

Deletes expired report export files.

./craft formie/gc/prune-report-exports

Delete Submissions

You can bulk delete submissions with this command.

OptionDescription
--form-handleThe form handle(s) to delete submissions from. Can be set to multiple comma-separated handles.
--form-idThe form ID(s) to delete submissions from. Can be set to multiple comma-separated IDs.
--incomplete-onlyWhether to delete only incomplete submissions.
--spam-onlyWhether to delete only spam submissions.
--beforeDelete submissions created before a date or relative date string.
--afterDelete submissions created after a date or relative date string.
./craft formie/submissions/delete --form-handle=form1,anotherForm

Delete Sent Notifications

You can bulk delete sent notifications with this command.

OptionDescription
--form-handleThe form handle(s) to delete sent notifications for. Can be set to multiple comma-separated handles.
--form-idThe form ID(s) to delete sent notifications for. Can be set to multiple comma-separated IDs.
--allDelete sent notifications for all forms.
--hard-deletePermanently delete sent notifications instead of soft deleting them.
./craft formie/sent-notifications/delete --form-handle=form1,anotherForm

Migration

You can run the migrations from either Sprout Forms or Freeform via the command line. This is useful if you have a large number of submissions or complex forms to migrate.

Migrate Sprout Forms

OptionDescription
--form-handleThe Sprout Forms handle(s) to migrate. Can be set to multiple comma-separated handles. Omit to migrate all.
./craft formie/migrate/sprout-forms --form-handle=form1,anotherForm

Migrate Freeform

OptionDescription
--form-handleThe Freeform form handle(s) to migrate. Can be set to multiple comma-separated handles. Omit to migrate all.
./craft formie/migrate/freeform4 --form-handle=form1,anotherForm
./craft formie/migrate/freeform5 --form-handle=form1,anotherForm