Developer Documentation
Everything you need to connect static sites, frameworks, and webhooks to FormHook.
Interactive Snippet Generator
Paste your form key below, toggle options, and grab ready-to-paste integration code for your stack:
<form action="http://localhost:3000/api/submit/YOUR_FORM_KEY" method="POST">
<!-- Thank-you redirect (optional) -->
<input type="hidden" name="redirectTo" value="https://yoursite.com/thank-you" />
<!-- Invisible Honeypot Spam Trap (Leave Empty) -->
<input type="text" name="honeypot" style="display:none" tabindex="-1" autocomplete="off" />
<label for="name">Your Name</label>
<input type="text" id="name" name="name" required />
<label for="email">Email Address</label>
<input type="email" id="email" name="email" required />
<label for="message">Message</label>
<textarea id="message" name="message" rows="4" required></textarea>
<button type="submit">Send Message</button>
</form>1. Quickstart (Under 1 Minute)
FormHook handles form submissions on any static host (Vercel, Netlify, Cloudflare Pages, GitHub Pages, AWS S3) with zero server code. Create a form in your Dashboard, copy its form key, and point your form's action at http://localhost:3000/api/submit/YOUR_FORM_KEY.
<form action="http://localhost:3000/api/submit/YOUR_FORM_KEY" method="POST"> <input type="text" name="name" placeholder="Your Name" required /> <input type="email" name="email" placeholder="Your Email" required /> <textarea name="message" placeholder="Your Message" required></textarea> <button type="submit">Send Message</button> </form>
2. HTML Form Setup
Add a hidden honeypot field to trap bots and a thank-you page to send visitors to after they submit. Can't change the form's URL? Post to http://localhost:3000/api/submit and send the key in a hidden apiKey field instead.
<form action="http://localhost:3000/api/submit/YOUR_FORM_KEY" method="POST"> <input type="text" name="honeypot" style="display:none" tabindex="-1" autocomplete="off" /> <input type="hidden" name="redirectTo" value="https://yoursite.com/thank-you" /> <input type="text" name="name" placeholder="Name" required /> <input type="email" name="email" placeholder="Email" required /> <textarea name="message" rows="4" placeholder="Message" required></textarea> <button type="submit">Send</button> </form>
3. React & Next.js Guide
Submit using FormData with Accept: application/json for inline loading and confirmation states:
'use client';
import React, { useState } from 'react';
export function ContactForm() {
const [status, setStatus] = useState<'idle' | 'submitting' | 'sent' | 'error'>('idle');
async function onSubmit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
setStatus('submitting');
const formData = new FormData(e.currentTarget);
const res = await fetch('http://localhost:3000/api/submit/YOUR_FORM_KEY', {
method: 'POST',
headers: { Accept: 'application/json' },
body: formData,
});
setStatus(res.ok ? 'sent' : 'error');
}
if (status === 'sent') return <p>Thanks! We received your message.</p>;
return (
<form onSubmit={onSubmit}>
<input type="text" name="honeypot" style={{ display: 'none' }} tabIndex={-1} autoComplete="off" />
<input type="text" name="name" required placeholder="Your Name" />
<input type="email" name="email" required placeholder="Your Email" />
<textarea name="message" required placeholder="Message" />
<button type="submit" disabled={status === 'submitting'}>
{status === 'submitting' ? 'Sending...' : 'Send Message'}
</button>
</form>
);
}4. JavaScript & AJAX JSON Submissions
Send any custom JSON fields—FormHook automatically stores, emails, and includes all custom keys in CSV exports:
const response = await fetch('http://localhost:3000/api/submit/YOUR_FORM_KEY', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
name: 'Sarah Chen',
email: 'sarah@example.com',
company: 'DesignCraft',
message: 'Hello from our static site!',
honeypot: '',
}),
});
const result = await response.json();5. Special Configuration Fields
apiKey / accessKeyYour form key, if you post to /api/submit without it in the URL. Not needed when the URL is /api/submit/YOUR_FORM_KEY.
honeypot (_gotcha, botcheck)Invisible spam trap. Leave empty for real users; bots filling it are silently quarantined.
redirectTo (_next, redirect)Custom thank-you page URL for standard HTML POST submissions (HTTP 303 redirect).
replyTo (_replyto, replyto)Optional. Reply-To is already set to the submitter's email field (change which field in Form Settings). Send replyTo with an address only to override it; it is not stored with the message.
subject (_subject)Overrides the email notification subject line for that submission.
6. Spam Protection & Rate Limiting
With Spam Protection on (the default), every submission is checked twice: a hidden honeypot field that bots fill in, and a content filter that flags link spam such as HTML links, known spam phrases and link shorteners. A rate limit (30 requests a minute per IP address and form key) applies to all forms. Spam is quarantined in your Spam tab without triggering emails or webhooks, and you can restore anything flagged by mistake.
<input type="text" name="honeypot" style="display:none" tabindex="-1" autocomplete="off" />
7. Outbound Webhooks
Add a Webhook URL in Form Settings (Zapier, Make, Slack, Discord, or custom server) and verify it live with the Test Webhook button.
{
"event": "form_submission",
"formId": "form-123",
"formName": "Contact Form",
"submissionId": "sub-456",
"data": {
"name": "Sarah Chen",
"email": "sarah@example.com",
"message": "Hello from your site!"
},
"createdAt": "2026-11-18T12:00:00.000Z"
}8. Domain Lock
- Exact origin:
https://myportfolio.devmatches that exact scheme and host. - Bare domain:
myportfolio.devmatches the root domain and subdomains without matching lookalike domains. - Empty: Accepts submissions from any origin.
This stops other websites from using your form in the browser. It is not bot protection: scripts that post directly can send any origin, or none (requests without an origin are allowed so server-side integrations keep working). Spam Protection handles bots.
9. HTTP Status Codes
| Code | Meaning |
|---|---|
| 200 / 303 | Submission accepted (JSON 200 or HTML redirect 303). |
| 400 | Missing form key or invalid payload. |
| 403 | Blocked by the form's domain lock. |
| 404 | Invalid or rotated form key. |
| 429 | Rate limit exceeded. Check Retry-After header. |