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=1Delete Forms
You can bulk delete forms with this command.
| Option | Description |
|---|---|
--form-handle | The form handle(s) to delete. Can be set to multiple comma-separated handles. |
--form-id | The form ID(s) to delete. Can be set to multiple comma-separated IDs. |
./craft formie/forms/delete --form-handle=form1,anotherFormImport/Export
List Forms
Lists all available Formie forms that can be exported or imported.
| Option | Description |
|---|---|
folderPath | Optional path to look for JSON files. Defaults to the plugin's export folder. |
./craft formie/forms/listExport Forms
Export Formie forms as JSON files. Requires form IDs or handles as a comma-separated list.
./craft formie/forms/export 1,contact-form,newsletterImport Form
Import a Formie form from a JSON file.
| Option | Description |
|---|---|
fileLocation | Path to a JSON file to import. Can be relative to the plugin's export folder or an absolute path. |
--create | Whether to create a new form instead of updating an existing one. Default is false. |
./craft formie/forms/import formie-contact-form.jsonImport All Forms
Import all Formie form JSON files from a folder.
| Option | Description |
|---|---|
folderPath | Optional path to look for JSON files. Defaults to the plugin's export folder. |
--create | Whether to create new forms instead of updating existing ones. Default is false. |
./craft formie/forms/import-allSubmissions
Re-save Submissions
Refer to the Craft docs (opens new window) on available options.
./craft resave/formie-submissions --form-id=1234 --update-search-index=1Run Integrations
For a provided submission, run the provided integration.
| Option | Description |
|---|---|
--submission-id | The submission ID(s) to use data for. Can be set to multiple comma-separated IDs. |
--integration | The handle of the integration to trigger. |
./craft formie/submissions/run-integration --submission-id=12345 --integration=mailchimpSend Email Notification
For a provided submission, send the provided notification.
| Option | Description |
|---|---|
--submission-id | The submission ID(s) to use data for. Can be set to multiple comma-separated IDs. |
--notification-id | The ID of the notification to trigger. |
./craft formie/submissions/send-notification --submission-id=12345 --notification-id=12Cron
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| Option | Description |
|---|---|
--skip-gc | Skip cleanup and retention tasks. |
--skip-reports | Skip scheduled report delivery. |
--only | Comma-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=reportsCraft'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-scheduledCleanup
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| Option | Description |
|---|---|
--only | Comma-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-submissionsPrune Data Retention Submissions
Deletes any submissions that exceed your data retention form settings.
./craft formie/gc/prune-data-retention-submissionsPrune Sent Notifications
Deletes sent notifications that exceed the plugin's maximum age setting.
./craft formie/gc/prune-sent-notificationsPrune Submission States
Deletes stale submission draft state records.
./craft formie/gc/prune-submission-statesPrune Draft Storage
Deletes expired submission draft storage rows.
./craft formie/gc/prune-draft-storagePrune 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-retentionPrune Stale Pending Uploads
Deletes unfinalized staged File Upload assets that exceed the plugin's maximum incomplete submission age.
./craft formie/gc/prune-stale-pending-uploadsPrune Report Exports
Deletes expired report export files.
./craft formie/gc/prune-report-exportsDelete Submissions
You can bulk delete submissions with this command.
| Option | Description |
|---|---|
--form-handle | The form handle(s) to delete submissions from. Can be set to multiple comma-separated handles. |
--form-id | The form ID(s) to delete submissions from. Can be set to multiple comma-separated IDs. |
--incomplete-only | Whether to delete only incomplete submissions. |
--spam-only | Whether to delete only spam submissions. |
--before | Delete submissions created before a date or relative date string. |
--after | Delete submissions created after a date or relative date string. |
./craft formie/submissions/delete --form-handle=form1,anotherFormDelete Sent Notifications
You can bulk delete sent notifications with this command.
| Option | Description |
|---|---|
--form-handle | The form handle(s) to delete sent notifications for. Can be set to multiple comma-separated handles. |
--form-id | The form ID(s) to delete sent notifications for. Can be set to multiple comma-separated IDs. |
--all | Delete sent notifications for all forms. |
--hard-delete | Permanently delete sent notifications instead of soft deleting them. |
./craft formie/sent-notifications/delete --form-handle=form1,anotherFormMigration
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
| Option | Description |
|---|---|
--form-handle | The 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,anotherFormMigrate Freeform
| Option | Description |
|---|---|
--form-handle | The 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