Caldera Forms, beginning in version 1.5, provides a REST API for form configurations and entries. The primary role of the Caldera Forms REST API, at this time, is to provide data to the Front-end entry viewer.
As of version 1.5, this API is read only and requires authorization — by default as an admin. Filters are provided to modify permissions or implement alternative permission schemes.
The base URL for all API endpoints is: wp-json/cf-api/v2
You can perform the following requests:
- GET Form configuration (does not include processor configuration) for many forms.
- GET Form configuration (does not include processor configuration) for a form.
- GET Form configuration revisions.
- Added in Caldera Forms 1.5.3
- GET Entries for a specific form.
- GET An entry from a form.
- DELETE A specific entry.
Caldera Forms REST API Permissions
By default all requests require that the current user by authorized, via standard WordPress authentication methods as an admin to view entries. There are many filters to modify this, and a special token system for granting access to lower roles.
Changing Permissions For The Caldera Forms REST
Filter documentation coming soon.
Control What Data Is Exposed Via The Caldera Forms REST
By default all fields are returned by the Caldera Forms REST API. You can prevent fields from being added to REST API responses using the caldera_forms_api_show_field filter.
Loading The Caldera Forms REST API Client
The setup is slightly different if you want to allow this instance of the API client to be used by non-admin users. For admin-only, you can skip setting up the special access token, and use this:
If you wish to add an access token for lower user levels, this is how you would set up script loading:
Using The Caldera Forms REST API Client
Before using the Caldera Forms REST API client, you must initialize it, per form, using the CFAPI function. Presuming you have followed the first example in the previous section, for using the API for admin users only, you can initialize the API client like this:
If you have followed the first example in the previous section, for using the API for users of a lower role than admin, you can initialize the API client like this:
The object that this returns has very simple methods for getting form configuration and form entry data: