Getting Started

This page is always updated with the api docs on how to use Formsponge api endpoints

API Endpoints

APIs
https://formsponge.com/i/
https://api.formsponge.com

Form Setup

For collecting submissions to a form, you need to set the form action to the value of the form URL. Also make sure to set the method="POST" in the form

An example

Let's say the form_id is EO2hLYWQT1YFJ0VqSDPp

The code for that would look as follows:

          <form action="https://formsponge.com/i/EO2hLYWQT1YFJ0VqSDPp" method="POST">
  <input type="text" name="name" value="John Doe">
  <input type="number" name="age" value="25">
  <input type="submit" value="Send">
</form>

Special Fields

_honey

Honeypot fields in your forms are an excellent protection against bots

Formsponge fully supports them

Any Submissions to a form with the field nameed _honey will be ignored.

NOTE: Make sure that you hide this field with display: none;

<form action="https://formsponge.com/i/EO2hLYWQT1YFJ0VqSDPp" method="POST">
  <input type="text" name="name" placeholder="name">
  <input type="text" value="_honey" style="display: none;">
</form>
_redirectTo

You can add this field in your forms for redirecting to the specified domain on a successful submission

NOTE: Make sure that you hide this field with display: none;

<form action="https://formsponge.com/i/EO2hLYWQT1YFJ0VqSDPp" method="POST">
  <input type="text" name="name" placeholder="name">
  <input type="text" name="_redirectTo" value="https://example.com/path/to/go" style="display: none;">
</form>

AJAX Requests

Formsponge API also supports direct POST requests to your forms.

NOTE: CORS requests are supported. No config required.

try {
    const response = await fetch("https://formsponge.com/i/EO2hLYWQT1YFJ0VqSDPp", {
      method: 'POST',
      body: {name: 'John', email: '[email protected]'},
    });
    const json = await response.json();

    processApiData(json);
  } catch(error) {
    handleAjaxError(error);
}

Things to know

  • Each form field should have the field name. Form fields without name will be ignored
  • Supported value for Content-Type header in the API URL is application/json, form-data, and x-www-form-urlencoded
  • When not specified, the fallback for the Content-Type is application/json