A React component can post a form straight to FormKeep with fetch. There is no backend to write and no API key.
https://formkeep.com/f/YOUR-TOKEN.ContactForm.jsx and put your URL in FORM_URL.<ContactForm /> where the form should appear.import { useState } from 'react';
const FORM_URL = 'https://formkeep.com/f/YOUR-TOKEN';
export default function ContactForm() {
const [status, setStatus] = useState('idle'); // idle | sending | sent | error
async function handleSubmit(event) {
event.preventDefault();
const form = event.currentTarget;
setStatus('sending');
try {
const response = await fetch(FORM_URL, {
method: 'POST',
headers: { Accept: 'application/json' },
body: new FormData(form),
});
if (!response.ok) throw new Error(`FormKeep answered ${response.status}`);
form.reset();
setStatus('sent');
} catch (error) {
setStatus('error');
}
}
return (
<form onSubmit={handleSubmit}>
<label>
Email
<input name="email" type="email" required />
</label>
<label>
Message
<textarea name="message" required />
</label>
<button type="submit" disabled={status === 'sending'}>
{status === 'sending' ? 'Sending...' : 'Send'}
</button>
{status === 'sent' && <p role="status">Thanks, we got your message.</p>}
{status === 'error' && <p role="alert">Something went wrong. Please try again.</p>}
</form>
);
}
Do not set a Content-Type header yourself with FormData: the browser adds the multipart boundary. The URL is not a secret, so it can sit in client code; there is no API key to hide.
The request asks for JSON with Accept: application/json, so FormKeep does not redirect. A stored submission answers 200 with the body null; the page stays where it is and shows its own message. A wrong token answers 404 and a form switched off answers 403, and the code above shows the error message for both. The submission appears in your dashboard and your inbox.
Add a file input inside the form. new FormData(form) sends it as multipart without any other change.
<input name="resume" type="file">
Each file can be up to 10 MB and a submission can carry up to 50 files. Whether attachments are kept depends on your plan.
{"error":"This form is not accepting submissions."}. The form has been switched off. Switch it back on, or use another form.event.preventDefault() and that each input has a name: only named inputs are sent.