Use a plain HTML form in an .astro page, or fetch() JSON, without adding an Astro endpoint.
You can add a contact form to an Astro site without src/pages/api and without an Astro adapter.
Plain HTML in any .astro file:
<form action="https://formcask.com/f/f_YOUR_FORM_ID" method="POST">
<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>
<input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">
<button type="submit">Send</button>
</form>
With fetch, for a custom success state on the same page:
const res = await fetch("https://formcask.com/f/f_YOUR_FORM_ID", {
method: "POST",
headers: { "content-type": "application/json", accept: "application/json" },
body: JSON.stringify({ name, email, message }),
});
const data = await res.json(); // { ok: true } on success
This works with static output (output: 'static'). File uploads require the Pro plan and multipart/form-data. Optional _redirect must be an absolute http or https URL.
Related: Plain HTML · Eleventy · Vercel