Developer Documentation
Everything you need to connect static sites, frameworks, and webhooks to FormHook.
Interactive Snippet Generator
Paste your form's API key below, toggle options, and grab ready-to-paste integration code for your stack:
<form action="http://localhost:3000/api/submit" method="POST">
<!-- Unique FormHook Access Key -->
<input type="hidden" name="apiKey" value="YOUR_API_KEY" />
<!-- Custom Thank-You Redirect (Optional) -->
<input type="hidden" name="redirectTo" value="https://yoursite.com/thank-you" />
<!-- Auto Reply-To Email Field (Optional) -->
<input type="hidden" name="replyTo" value="email" />
<!-- 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, grab your apiKey, and point your form to http://localhost:3000/api/submit.
<form action="http://localhost:3000/api/submit" method="POST"> <input type="hidden" name="apiKey" value="YOUR_API_KEY" /> <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 & Path Keys
You can also embed your key directly in the URL path instead of a hidden input:
<form action="http://localhost:3000/api/submit/YOUR_API_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);
formData.append('apiKey', 'YOUR_API_KEY');
const res = await fetch('http://localhost:3000/api/submit', {
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', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({
apiKey: 'YOUR_API_KEY',
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 / accessKeyRequired. Unique form key from your dashboard. Can also be passed via /api/submit/YOUR_API_KEY.
honeypot (_gotcha)Invisible spam trap. Leave empty for real users; bots filling it are silently quarantined.
redirectToCustom thank-you page URL for standard HTML POST submissions (HTTP 303 redirect).
replyToSets the email Reply-To address so hitting Reply responds directly to the submitter.
subjectOverrides the email notification subject line for that submission.
6. Honeypot Spam Defense & Rate Limiting
Every form includes invisible honeypot filtering plus a sliding-window rate limiter (30 requests/minute per IP & API key). Caught bots are quarantined without triggering emails or webhooks.
<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 Whitelisting & CORS
- 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.
9. HTTP Status Codes
| Code | Meaning |
|---|---|
| 200 / 303 | Submission accepted (JSON 200 or HTML redirect 303). |
| 400 | Missing apiKey or invalid payload. |
| 403 | Origin rejected by Allowed Origins whitelist. |
| 404 | Invalid or rotated apiKey. |
| 429 | Rate limit exceeded. Check Retry-After header. |