Developer · Guide
How to Use Forminator API: A Beginner's Guide

Short answer
The Forminator API is a PHP class called Forminator_API that lets you list forms, read entries and add entries from custom code. Check the class exists, run your code on the init hook or later, and use methods like get_forms and get_entries with the correct form ID.
Key takeaways
- The Forminator API is PHP only, not a REST API.
- Check class_exists and run code on init or later.
- Use field names like email-1, not labels.
- Register your own REST route to share data outside WordPress.
- Webhooks are simpler for pushing new submissions.
- Test API code on a staging site first.
What is the Forminator API?
The Forminator API is a set of PHP methods in the Forminator_API class that lets developers read, create, update and delete forms, polls, quizzes and their entries from custom code.
Forminator is a free form builder for WordPress by WPMU DEV. Besides the drag-and-drop editor, it ships with a developer API so you can work with forms in code.
It is a PHP API, not a public REST API. You call its methods from your theme, a custom plugin or a code snippet running inside WordPress.
Common uses include pulling entries into a custom dashboard, creating entries from another system, or building forms in bulk. WPMU DEV keeps the full method list in its Forminator API docs.
If you are new to the plugin itself, start with our guide on how to use Forminator in WordPress.
What do you need before using the API?
You need the Forminator plugin active, a safe place to add PHP code such as a custom plugin or snippets plugin, and a staging site for testing.
Checklist before you start:
- Forminator installed and activated.
- Basic PHP knowledge.
- A child theme, custom plugin or code snippets plugin.
- A staging or local copy of the site.
- A recent backup.
Avoid editing a parent theme's functions.php directly. Theme updates will wipe your code.
Keep a short note of which forms your code depends on. If someone deletes or rebuilds a form later, its ID changes and your code will quietly stop finding it.
A small custom plugin is the cleanest option. It keeps your API code separate from the theme, so switching themes does not break it.
How do you call the API safely?
Wrap your calls in a check that the Forminator_API class exists and run them on a WordPress hook after plugins have loaded, so your site does not crash if Forminator is turned off.
Here is a safe pattern:
add_action( 'init', function () {
if ( ! class_exists( 'Forminator_API' ) ) {
return;
}
$forms = Forminator_API::get_forms();
// Work with $forms here.
} );
The class_exists check is standard PHP. The PHP manual explains it on the class_exists page.
Running code on init or later makes sure Forminator has loaded its classes. Calling the API too early, directly in a plugin file, is a common cause of fatal errors.
Many API methods return a WP_Error object on failure. Check for that with is_wp_error() before using the result.
Which API methods will you use most?
Most projects use a handful of methods for listing forms, reading a single form, and reading or adding entries.
The table summarizes common methods. Check the official docs for exact parameters, since they can change between versions.
| Task | Method | Returns |
|---|---|---|
| List all forms | Forminator_API::get_forms() | Array of form models |
| Get one form | Forminator_API::get_form( $form_id ) | Form model or error |
| List a form's entries | Forminator_API::get_entries( $form_id ) | Array of entries |
| Get one entry | Forminator_API::get_entry( $form_id, $entry_id ) | Entry object or error |
| Add an entry | Forminator_API::add_form_entry( $form_id, $entry_meta ) | New entry ID or error |
| Delete an entry | Forminator_API::delete_entry( $form_id, $entry_id ) | True or error |
The API also has similar methods for polls and quizzes. Their names follow the same pattern, such as getting polls or quiz entries.
How do you list forms and get a form ID?
Call Forminator_API::get_forms() to get every form, then read each form's ID and name, or copy the ID from the shortcode in the Forminator dashboard.
The quickest way to find one ID is in the dashboard. Go to Forminator, then Forms. Each form's shortcode includes its ID, like [forminator_form id="123"].
In code, you can loop through the results:
$forms = Forminator_API::get_forms();
foreach ( $forms as $form ) {
error_log( $form->id . ' - ' . $form->name );
}
Writing to the error log is a simple way to inspect output on a test site. Turn on WP_DEBUG_LOG to see the results in wp-content/debug.log.
How do you read form entries?
Use Forminator_API::get_entries( $form_id ) to fetch every entry for a form, then read each field value from the entry's meta data.
Each entry holds the submitted values keyed by field name, such as name-1, email-1 or text-1. These names come from the form editor, not the labels.
Example:
$entries = Forminator_API::get_entries( 123 );
foreach ( $entries as $entry ) {
$email = isset( $entry->meta_data['email-1']['value'] )
? $entry->meta_data['email-1']['value'] : '';
}
To see the exact field names, open the form in the editor and check each field's settings. You can also dump one entry to the log and read its structure.
On forms with thousands of entries, fetching everything at once can be slow. Filter or process entries in batches where you can.
How do you add an entry from code?
Call Forminator_API::add_form_entry() with the form ID and an array of field names and values, and Forminator stores it like a normal submission.
$entry_meta = array(
array( 'name' => 'name-1', 'value' => 'Sam Lee' ),
array( 'name' => 'email-1', 'value' => '[email protected]' ),
);
$entry_id = Forminator_API::add_form_entry( 123, $entry_meta );
The field names must match the form exactly. A typo means the value is saved under a name the form does not show.
Adding an entry through the API does not always trigger the same actions as a front-end submission. Do not assume notification emails or integrations will fire. Test this on staging.
Always clean incoming data before saving it. WordPress functions like sanitize_text_field() and sanitize_email() are the usual tools.
If you import many entries at once, run the job in small batches from WP-CLI or a scheduled task rather than a page load. Long loops in a browser request can hit PHP time limits and stop halfway, leaving you unsure which rows were saved.
Log each new entry ID as you go. That gives you a simple record to check against your source data.
How do you expose Forminator data over REST?
Forminator's API is PHP only, so if an outside app needs form data, register your own REST route with register_rest_route() and call the Forminator API inside it.
A minimal custom endpoint looks like this:
add_action( 'rest_api_init', function () {
register_rest_route( 'mysite/v1', '/form-entries/(?P<id>\\d+)', array(
'methods' => 'GET',
'callback' => function ( $request ) {
return Forminator_API::get_entries( (int) $request['id'] );
},
'permission_callback' => function () {
return current_user_can( 'manage_options' );
},
) );
} );
Never leave permission_callback open on an endpoint that returns entries. Form submissions often hold personal data.
For apps outside WordPress, Application Passwords are a simple way to authenticate REST requests as a specific user without sharing the real password.
The WordPress handbook explains the full process in adding custom endpoints. The register_rest_route reference lists every argument.
Is a webhook easier than the API?
If you only need to send each new submission to another service, Forminator's webhook integration is usually easier than writing API code.
Forminator includes integrations for tools such as webhooks, so you can post form data to a URL each time someone submits. That suits Zapier, Make or your own receiver script.
Use the PHP API when you need to:
- Read old entries in bulk.
- Create or update forms in code.
- Add entries from an import or another system.
- Build custom reports inside WordPress.
Use a webhook when you need to push each new submission somewhere in real time.
What are common Forminator API errors?
The most common errors are calling the API before Forminator loads, using the wrong form ID, and using field labels instead of field names.
Quick fixes:
- Class not found: run code on
initand checkclass_exists. - Empty results: confirm the form ID and that the form has entries.
- Values not saved: match field names like
email-1exactly. - WP_Error returned: log the error message to see what failed.
- Permission problems on REST: check your
permission_callbackand the logged-in user.
If a form stops showing after code changes, our guide to Forminator not showing covers display problems.
If emails stop after you add entries by code, see our guide on Forminator email notifications not working.
How do you move forms between sites instead?
To copy forms from one site to another, the built-in export and import tools are simpler than the API.
Forminator lets you export a form as a file and import it on another site. That keeps fields, settings and styling, but not entries.
Our guide on how to import a Forminator form walks through it. Save the API for jobs the dashboard cannot do.
Frequently asked questions
Does Forminator have a REST API?
Forminator's developer API is a set of PHP methods, not a public REST API. To make form data available to outside apps, register your own REST route in WordPress and call the Forminator methods inside it, with a proper permission check.
Where do I find a Forminator form ID?
Open Forminator, then Forms, in your dashboard. Each form's shortcode includes its ID number. In code, you can also list every form with the get_forms method and read each form's ID and name.
Does adding an entry by API send notification emails?
Do not assume it does. Entries added through the API are stored like submissions, but some actions tied to a front-end submission may not run. Test on a staging site and send emails yourself in code if needed.
Is the Forminator API available in the free version?
The developer API ships with the Forminator plugin, including the free version on WordPress.org. Some features you work with through it, such as certain integrations, may depend on what your plan includes.
Can I create forms with the Forminator API?
Yes. The API includes methods for adding and updating forms as well as entries. Building forms in code is more complex than reading entries, so check the official documentation for the exact data each method expects.
Sources
- Forminator API Docs WPMU DEV
- Forminator Forms WordPress.org
- Adding Custom Endpoints WordPress REST API Handbook
- register_rest_route() WordPress Developer Resources
- class_exists PHP Manual
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


