Guide

Add a contact form to a Cloudflare Pages site

Pages serves static files, so there is no server waiting to receive your form's POST. You could write a Pages Function to handle it, plus the email sending, storage, and spam filtering behind it. Or you can point the form at an endpoint and be done in two minutes.

Step 1: Get an endpoint

Create a form in the dashboard and you get a unique endpoint shaped like https://forms.scrolltheory.media/f/YOUR_FORM_ID. Add the email address you want submissions sent to and verify it from the Emails page.

Step 2: Add the form to your page

Paste this into any page of your site and replace YOUR_FORM_ID. It works the same when your Pages project is plain HTML or a framework build, because the output is static either way:

<form action="https://forms.scrolltheory.media/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" rows="5" required></textarea>
  </label>

  <!-- optional: land the visitor on your own thank-you page -->
  <input type="hidden" name="_next" value="https://yoursite.pages.dev/thanks">

  <!-- hidden spam honeypot: leave empty -->
  <input type="text" name="_gotcha" tabindex="-1" autocomplete="off"
         style="position:absolute;left:-9999px" aria-hidden="true">

  <button type="submit">Send message</button>
</form>

Step 3: Deploy and test

Push to your connected repo or upload the build, open the live site, and submit a test. The submission appears in your dashboard and lands at your verified email. If you set _next, add a small thanks.html page for it to point at.

Why this pairing makes sense

Scroll Theory Forms runs on Cloudflare's network, the same network serving your Pages site. Your form posts to nearby infrastructure instead of a distant server, and there is no function code for you to write, deploy, or maintain.

Lock the form to your domain

In the form's settings you can restrict submissions to your own domain, so nobody can lift your endpoint and post to it from elsewhere. Works with both your pages.dev address and a custom domain.

Get your endpoint

Create a form on the free plan and you get an endpoint to drop into any of the examples above. Every submission is stored and spam is quarantined rather than deleted, so a false positive never costs you a real lead.

Start free   Read the docs

More guides