Title: Contact Form 7 to API
Author: Kenny Meyer
Published: <strong>May 27, 2018</strong>
Last modified: October 12, 2026

---

Search plugins

![](https://s.w.org/plugins/geopattern-icon/cf7-to-api-basic-auth.svg)

# Contact Form 7 to API

 By [Kenny Meyer](https://profiles.wordpress.org/kennymeyer/)

[Download](https://downloads.wordpress.org/plugin/cf7-to-api-basic-auth.1.5.3.zip)

 * [Details](https://frp.wordpress.org/plugins/cf7-to-api-basic-auth/#description)
 * [Reviews](https://frp.wordpress.org/plugins/cf7-to-api-basic-auth/#reviews)
 *  [Installation](https://frp.wordpress.org/plugins/cf7-to-api-basic-auth/#installation)
 * [Development](https://frp.wordpress.org/plugins/cf7-to-api-basic-auth/#developers)

 [Support](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/)

## Description

Contact Form 7 to API adds an **API Integration** tab to each form. When the form
is submitted, the entry is sent to the URL you set.

#### What you can send

 * **Parameters.** Map each form field to an API key. GET adds the pairs to the 
   query string and sends no body. POST sends them as the body.
 * **JSON.** The filled template is the request body for both GET and POST.
 * **XML.** The filled template is the request body. XML is always sent as POST,
   and the method menu is hidden.
 * **Files.** Uploads are sent as base64. A file larger than 8 MB is left out.
 * **Acceptance.** In JSON, an acceptance field is a boolean: `true` when checked
   and `false` when it is not. In XML and in parameter mode it is the text `true`
   or `false`.
 * **Auth.** Basic auth (`user:secret`) or a Bearer token. Bearer is used when both
   are filled in, and both are sent on GET and POST.
 * **Headers.** One `Name: value` line each.
 * **Timeout.** Defaults to 15 seconds. You can set 1 to 60 seconds on the form.

A JSON template looks like this:

    ```
    { "name": "[your-name]", "email": "[your-email]" }
    ```

If the URL already has a query string, mapped fields are added with `&`. `https://
example.com/hook?token=abc` keeps the token, and the fields follow it.

#### When the call fails

A response outside HTTP 200–299, a connection error, or a rejected URL fails the
submission and skips the Contact Form 7 email. The visitor sees the form’s usual
error message.

Turn on **Show the API response body as the form message** to show a JSON `message`
field, or a shortened copy of any other body.

The last call is saved on the form. Open **DEBUG LOG** on the API Integration tab.
Authorization header values are not stored.

#### Good to know

 * Credentials are stored in the form. Anyone who can edit the form can read them.
 * Keep one copy of the plugin active. WordPress.org installs it in `cf7-to-api-
   basic-auth`. A GitHub checkout uses `cf7-to-api`. Version 1.5.0 and newer skip
   loading when another copy is already active. Delete the extra folder.
 * WordPress allows public http and https URLs on ports 80, 443, and 8080. For a
   private host or another port, return that URL from the `qs_cf7_api_validated_url`
   filter, and only for an address you trust.

### External service

This plugin does not call a service of its own. Nothing is sent until **Send to 
API** is turned on for that form. The request then goes to the URL entered on the
API Integration tab. You choose that address. Its terms of use and privacy policy
are the ones published by whoever runs it.

The request can include:

 * Mapped field values, or the filled JSON or XML template.
 * File contents, as base64, for files of 8 MB or less.
 * Any special mail-tag you put in a template. `[_remote_ip]` is the visitor’s IP
   address. `[_url]` is the page URL.
 * The Basic or Bearer credential, in the Authorization header, when one is saved
   on the form.

On your own site, the API URL, credentials, templates, and field map are stored 
in the Contact Form 7 form. The debug log stores the last called URL, request body,
header names, response code, response body, and error on that same form. Authorization
header values are not stored.

Deleting the plugin removes the option that remembers dismissed notices. It leaves
Contact Form 7 posts in place, including the API settings and the debug log.

## Installation

 1. Install and activate Contact Form 7.
 2. Install and activate Contact Form 7 to API. It can be activated first, and it shows
    a notice until Contact Form 7 is active.
 3. Edit a form, open the **API Integration** tab, and save.

## FAQ

### Where are the settings?

Edit the form and open the **API Integration** tab.

### The URL already has a query string. Will my fields replace it?

No. Fields are appended with `&`. `https://example.com/hook?token=abc` keeps `token
=abc`, and the mapped fields follow it.

### Does Basic auth work with GET?

Yes. The Authorization header is sent for GET and POST. If both Basic and Bearer
are filled in, Bearer is used.

### Can I add my own headers?

Yes. Use the Custom headers box, one `Name: value` line each. The `qs_cf7_api_get_args`
filter can still change the request for GET and POST.

### What happens when the API returns an error?

The form fails and the email is not sent. The visitor sees the form’s usual failure
text, unless you turn on **Show the API response body as the form message**.

### Who can see the API credentials?

Anyone who can edit the form. They are stored in the form, not in a separate encrypted
option.

### Does JSON GET send a body?

Yes. Parameter mode is the one that puts fields on the query string and sends no
body. A JSON template is sent as the body for GET and POST. XML is always POST.

### What is removed on uninstall?

Only the option that remembers dismissed notices. Form settings and the debug log
stay on the Contact Form 7 posts.

### Can I change the request in code?

Yes. `cf7api_create_record` replaces the payload. `qs_cf7_api_get_args`, `qs_cf7_api_get_url`,`
qs_cf7_api_post_url`, and `qs_cf7_api_timeout` adjust the HTTP call. `qs_cf7_api_validated_url`
accepts a URL that WordPress would otherwise reject.

## Reviews

![](https://secure.gravatar.com/avatar/e529b9f24f89e394908c83bb590e612c038bdb3c7c812f9984fff3db4bb7ce28?
s=60&d=retro&r=g)

### 󠀁[Plugin is Dead…doesn’t save settings anymore](https://wordpress.org/support/topic/plugin-is-dead-doesnt-save-settings-anymore/)󠁿

 [utkarshs](https://profiles.wordpress.org/utkarshs/) December 15, 2021 3 replies

Plugin is Dead…doesn't save settings anymore

![](https://secure.gravatar.com/avatar/c098029cca4f9ba1c2dbe7f7a6049aa7ee6edaa52119465f131df53f73b46ae1?
s=60&d=retro&r=g)

### 󠀁[Update to recent versions](https://wordpress.org/support/topic/update-to-recent-versions/)󠁿

 [hotelwww](https://profiles.wordpress.org/hotelwww/) December 13, 2021

Did not work to save data in version 5.8.2

![](https://secure.gravatar.com/avatar/44b61999370c56b7dc6a4fb2808b43c18189a215ca8b62adbc3356c7096d59eb?
s=60&d=retro&r=g)

### 󠀁[Awesome plugin](https://wordpress.org/support/topic/awesome-plugin-6012/)󠁿

 [hausi91](https://profiles.wordpress.org/hausi91/) July 6, 2021

does what I expected it to do. so five stars from me!

![](https://secure.gravatar.com/avatar/2d52d932aecfae0e01372d6c12ee1f14edb7eea4ed0d9f3b30e4319390a18ad0?
s=60&d=retro&r=g)

### 󠀁[great plugin!!!!](https://wordpress.org/support/topic/great-plugin-30270/)󠁿

 [Host Domination](https://profiles.wordpress.org/ilithio/) March 21, 2021

great plugin!!! one of a kind, simple and easy to set up.

![](https://secure.gravatar.com/avatar/8a295a9dc6bd123effd9d83a5e941cb3de858c4653433ad023af3a54a587e136?
s=60&d=retro&r=g)

### 󠀁[Awesome plugin](https://wordpress.org/support/topic/awesome-plugin-5201/)󠁿

 [dasherg](https://profiles.wordpress.org/dasherg/) July 8, 2020

Extremely useful and easy to use.

![](https://secure.gravatar.com/avatar/bbc6dfc95822e60ff24dc495e7cc45ee75ca481c78ecbb44c617d7d05e66d75c?
s=60&d=retro&r=g)

### 󠀁[Great tool!](https://wordpress.org/support/topic/great-tool-1286/)󠁿

 [George Pattichis](https://profiles.wordpress.org/pattihis/) March 19, 2020 1 reply

Does exactly what it says with no problems. Thank you very much!

 [ Read all 7 reviews ](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/reviews/)

## Contributors & Developers

“Contact Form 7 to API” is open source software. The following people have contributed
to this plugin.

Contributors

 *   [ Kenny Meyer ](https://profiles.wordpress.org/kennymeyer/)

[Translate “Contact Form 7 to API” into your language.](https://translate.wordpress.org/projects/wp-plugins/cf7-to-api-basic-auth)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/cf7-to-api-basic-auth/),
check out the [SVN repository](https://plugins.svn.wordpress.org/cf7-to-api-basic-auth/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/cf7-to-api-basic-auth/)
by [RSS](https://plugins.trac.wordpress.org/log/cf7-to-api-basic-auth/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 1.5.3

 * Documents what is sent to the API URL, what the debug log stores, and what uninstall
   leaves in place. Form and API behavior match 1.5.2.

#### 1.5.2

 * Rewrites the plugin directory readme.
 * The API Integration tab script no longer depends on jQuery. Form and API behavior
   match 1.5.1.

#### 1.5.1

 * Maintenance release. The directory index file contains a short PHP comment so
   coding-standards checks can read it. Form and API behavior match 1.5.0.

#### 1.5.0

 * Requires WordPress 6.7 and PHP 7.4. Tested with WordPress 7.1 and Contact Form
   7 5.9 through 6.2.
 * Fixes a fatal error when two copies of the plugin are active.
 * Fixes saving JSON and XML templates so quotes are no longer stored as backslashes.
 * Fixes a PHP 8 error when a JSON or XML template is saved without a field map.
 * Appends fields to an existing query string with `&`, and sends Basic and Bearer
   auth on GET.
 * Encodes JSON values, so quotes, newlines, and dollar signs stay valid JSON. XML
   values are escaped.
 * Resolves Contact Form 7 special mail-tags in templates.
 * Adds a timeout field and a custom headers field. Requests use HTTP/1.1.
 * A non-2xx response, a transport error, or an invalid API URL fails the submission
   and skips the email.
 * Escapes the API tab, checks a nonce and capability before dismissing notices,
   and limits assets to Contact Form 7 screens.
 * Removes the unused template-helper class.

#### 1.4.11

 * Support the Contact Form 7 property loader used by current CF7 releases.

#### 1.4.10

 * Option to show the API response body as the form message.

#### 1.4.9

 * Acceptance fields can be sent as JSON booleans.
 * Multiple files can be sent.
 * Multi-value fields in templates are joined when a single text value is required.

#### 1.4.8

 * Revert single-quote handling.

#### 1.4.7

 * Compatibility fixes.

#### 1.4.5

 * Handle line breaks.

#### 1.4.4

 * Read custom placeholders out of the template.

#### 1.4.3

 * Bearer token fix.

#### 1.4.2

 * Bug fix.

#### 1.4.1

 * WordPress 5 support.

#### 1.3.0

 * Basic auth.

#### 1.2.0

 * Checkbox arrays and the `cf7api_create_record` filter.

#### 1.1.0

 * XML, JSON, and the per-form debug log.

#### 1.0.0

 * Initial release.

## Meta

 *  Version **1.5.3**
 *  Last updated **15 hours ago**
 *  Active installations **1,000+**
 *  WordPress version ** 6.7 or higher **
 *  Tested up to **7.1.3**
 *  PHP version ** 7.4 or higher **
 *  Language
 * [English (US)](https://wordpress.org/plugins/cf7-to-api-basic-auth/)
 * Tags
 * [api](https://frp.wordpress.org/plugins/tags/api/)[contact form 7](https://frp.wordpress.org/plugins/tags/contact-form-7/)
   [crm](https://frp.wordpress.org/plugins/tags/crm/)[rest-api](https://frp.wordpress.org/plugins/tags/rest-api/)
   [webhook](https://frp.wordpress.org/plugins/tags/webhook/)
 *  [Advanced View](https://frp.wordpress.org/plugins/cf7-to-api-basic-auth/advanced/)

## Ratings

 4.3 out of 5 stars.

 *  [  5 5-star reviews     ](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/reviews/?filter=2)
 *  [  1 1-star review     ](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/reviews/)

## Contributors

 *   [ Kenny Meyer ](https://profiles.wordpress.org/kennymeyer/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/cf7-to-api-basic-auth/)