HTML
A plain HTML form is all you need, with no JavaScript required.
<form action="https://api.formstork.com/submit" method="POST">
<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
<input type="hidden" name="subject" value="New message from my website">
<input type="hidden" name="redirect" value="https://yoursite.com/thanks">
<label>Name <input type="text" name="name" required></label>
<label>Email <input type="email" name="email" required></label>
<label>Message <textarea name="message" required></textarea></label>
<!-- Honeypot: bots fill this, humans don't. Keep it hidden. -->
<input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">
<button type="submit">Send</button>
</form>
After submitting, the visitor is sent to your redirect URL. Remove that field to show Formstork’s default thank-you page instead, or handle the response with JavaScript.
Prefer a shorter form? Put the key in the URL and skip the hidden field:
<form action="https://api.formstork.com/f/YOUR_ACCESS_KEY" method="POST">
Both styles behave identically, use whichever reads better to you.
Show a success message without leaving the page
<form id="form" action="https://api.formstork.com/submit" method="POST">
<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
<input type="email" name="email" required>
<textarea name="message" required></textarea>
<button>Send</button>
</form>
<p id="result"></p>
<script>
const form = document.getElementById("form");
form.addEventListener("submit", async (e) => {
e.preventDefault();
const res = await fetch(form.action, {
method: "POST",
body: new FormData(form),
headers: { Accept: "application/json" },
});
const data = await res.json();
document.getElementById("result").textContent = data.message;
if (data.success) form.reset();
});
</script>