API Docs

Submission Form Examples

View real-life examples that utilize the Formeezy API to submit and store submissions.

Submission Form Examples

Ready to send some submissions to your account? Below we're going to walk you through the ins-and-outs of using the Formeezy API to submit and store your form submissions. We'll cover everything with real examples that you can copy-paste into your code.

Specialized Field Instructions

Honeypot Bot Field

The honeypot bot field is used to target spam bots and scripts that fill out forms automatically and submit them. If this field is filled out, a submission will silently fail with a 200(successful) status.

How to use the Honeypot Bot Field

  • Name an input "bot-field"
  • Add a hidden class to "display: none;" to hide this field from users. Bots can detect inline-styles so a class name is the preferred method.
<input name="bot-field" type="text" class="hidden"></input>

Stripe Price ID

Use this input type to automatically process payments using Stripe Checkout. To get started, all you need is a Price ID (multiple prices are supported) and the input name "price_id".

Guide: Implement Stripe Checkout

Single Product

<input name="price_id" type="hidden" value="price_xxxxxxx"></input>

Multiple Products

<input name="price_id" type="hidden" value="price_xxxxxxx,price_xxxxxxx"></input>

Submit Files

To accept files in your submission, ensure you set your form's enctype to "multipart/form-data" or include your file as FormData if using fetch or fetch libraries like Axios. Uploads are limited to a maximum of 5 files. We'll automatically upload your files and save a URL to download the file in your submission.

<form
  enctype="multipart/form-data"
  action="https://formeezy.com/api/v1/forms/{FORM_ID}/submissions"
  method="POST"
>
  <input type="file" name="my-file"></input>
  <button type="submit">Send</button>
</form>

HTML Static Form Example

<form
  action="https://formeezy.com/api/v1/forms/{FORM_ID}/submissions"
  method="POST"
  enctype="multipart/form-data"
>
  <input type="email" name="email" placeholder="Enter email" required></input>
  <textarea placeholder="Enter message" name="message" required></textarea>
  <input type="file" name="my-file"></input>
  <input name="bot-field" type="text" style="display: none;"></input>
  <button type="submit">Send</button>
</form>

React Stateful Form Example

import React from 'react';
import axios from 'axios';

function Form(){
const [state, setState] = React.useState({
email: '',
message: '',
file: null
});

function handleChange(e){
if (e.target.files) {
setState({ ...state, [e.target.name]: e.target.files[0] });
} else {
setState({ ...state, [e.target.name]: e.target.value });
}
}

async function handleSubmit(e){
e.preventDefault();

    let formData = new FormData();

    for (let [key, value] of Object.entries(state)) {
      formData.append(key, value);
    }

    // Use fetch or axios to submit the form
    await axios.post("https://formeezy.com/api/v1/forms/{FORM_ID}/submissions", formData)
      .then(({ data }) => {
      const { redirect } = data;
      // Redirect used for reCAPTCHA and/or thank you page
      window.location.href = redirect;
    });

}

return (
    <form onSubmit={handleSubmit}>
      <input name="email" type="email" placeholder="Enter email" onChange={handleChange} value={state.email} required />
      <textarea name="message" placeholder="Enter message" onChange={handleChange} value={state.message} required />
      <input type="file" name="file" onChange={handleChange}/>
      {/_ Optional Bot Field - Submit will fail silently if this is filled out.
      _/}
      <input name="bot-field" type="text" onChange={handleChange} style={{display: 'none'}} />
      <button type="submit">Send</button>
    </form>
  )
}

React FormData Example

import React from 'react';
import axios from 'axios';

function Form(){
async function handleSubmit(e){
e.preventDefault();

    // Use fetch or axios to submit the form
    await axios
      .post("https://formeezy.com/api/v1/forms/{FORM_ID}/submissions", new FormData(e.target))
      .then(({ data }) => {
        const { redirect } = data;
        // Redirect used for reCAPTCHA and/or thank you page
        window.location.href = redirect;
      });

}

return (
    <form onSubmit={handleSubmit}>
      <input name="email" type="email" placeholder="Enter email" required />
      <textarea name="message" placeholder="Enter message" required />
      <input type="file" name="my-file" />
      {/_ Optional Bot Field - Submit will fail silently if this is filled out.
      _/}
      <input name="bot-field" type="text" style={{display: 'none'}} />
      <button type="submit">Send</button>
    </form>
  )
}

Get Started For Free

Save time and code with Formeezy!

Create form endpoints in one click.
No-code backend for your forms.

Get Started For Free!