Integrations · Forms

Validate emails in Basin forms

Check the email addresses in your Basin form submissions. A small relay you deploy to your own Cloudflare account receives each new submission from the form's webhook a few seconds after it arrives, checks Basin's signature, checks the email field and reports the result, tagged with the submission id, in its log, to your own URL or to Slack. It never changes or deletes anything in Basin. Download it: email-validation-basin.zip holds relay.mjs (the relay) and the MIT licence.

Basin stores a submission before its webhook fires, and its webhook docs document no answer that refuses one, so this cannot refuse an address while someone fills in the form. To check an address before you accept it, check it in a form on your own site: see validate a sign-up form.

What you need

  • A Basin plan with webhooks: Basin offers webhooks, and signs them, on its Growth plan and above, and its pricing page offers a 14-day free trial.
  • An API key of ours from the API keys page with Validate addresses. A daily credit cap on the key limits what a busy form can spend. Each billable check uses one credit (what is free).
  • A Cloudflare account (the relay is a Worker you deploy from the Cloudflare dashboard, or with npx wrangler).

Deploy the relay

No terminal? Deploy it from the Cloudflare dashboard instead. Or, from the unzipped folder:

npx wrangler deploy relay.mjs --name ev-basin-relay --compatibility-date 2026-10-01
npx wrangler secret put EV_API_KEY --name ev-basin-relay             # our API key

Then add the webhook in Basin: in the form's dashboard open Integrations, then Webhooks, and select Create a new webhook. Enter the relay's address, for example https://ev-basin-relay.<your subdomain>.workers.dev/?form=<a label> (the form part only labels the reports, since the webhook does not name the form), set Payload Format to JSON and save it. Open it again with Edit, and under Webhook Signing select Show. Put that secret into the relay:

npx wrangler secret put BASIN_SIGNING_SECRET --name ev-basin-relay   # the webhook's signing secret

Basin signs every delivery with that secret (X-Basin-Signature, an HMAC-SHA256 of the exact body). The relay checks it before it reads anything and answers 401 to a delivery without it. Each webhook has its own secret, so one relay serves one webhook: for another form, deploy another relay under another name.

Basin sends no field types, so the relay checks the field named email (the name of the form's input), or the fields you name in EMAIL_FIELDS below: at most 5 per submission, a repeated address once. Anyone can post extra fields to a Basin form, so no other field is ever checked. It reports the status, reason and action of each: always in the Worker's log, with ids and results only, never the address; and to a URL of yours and to a Slack incoming webhook, if you set them below. Act on the action rather than the status: spam traps and known complainers are valid with the action remove.

Submit the form once with no_mailbox@sandbox.email-validation.org to see it work: the log shows invalid with the reason no_mailbox, at no cost. Do it on a form that sends that address no email: it receives no mail, and the bounce hurts your sender.

Deploy the relay from the Cloudflare dashboard

  1. In the Cloudflare dashboard, open Workers & Pages → Create and choose Create Worker. Name it ev-basin-relay and select Deploy.
  2. Select Edit code, replace the starter code with the whole of relay.mjs from the unzipped folder and select Deploy.
  3. In the Worker's Settings → Variables and Secrets, add EV_API_KEY and BASIN_SIGNING_SECRET as type Secret, and any of the settings below the same way, then Deploy.
  4. The relay's address is on the Worker's page. Add the webhook in Basin as described above.

Settings

SettingWhat it does
EV_API_KEYOur API key (required)
BASIN_SIGNING_SECRETThe webhook's signing secret, from Webhook Signing in Basin (required)
EV_REGIONeu to have addresses validated in the EU and their results stored there (default us)
EMAIL_FIELDSComma-separated names of the email fields to check, in that order (default email); each a name of letters, digits, _ or -, up to 64 characters, or the relay answers every delivery with an error
FORWARD_URLAn https address of yours that receives each submission's results as JSON
FORWARD_SECRETSigns the forward: header X-EV-Signature: sha256=<base64 HMAC-SHA256 of the body>
SLACK_WEBHOOK_URLA Slack incoming webhook
NOTIFY_ONall (default) or problems: report only the results whose action is not send
INCLUDE_EMAILtrue to put the address in the forward and the Slack message (default: ids and results only)
EVENTSA KV namespace binding (recommended), so a copy of a delivery within 24 hours is not checked again by any relay instance

How the relay answers Basin

By default Basin sends its webhooks for submissions it did not flag as spam, and retries a delivery that fails up to 15 times over 24 to 28 hours; a submission's webhook can also be re-fired from its submission log. The relay answers within 8 seconds, and finishes a check it started even if Basin stops waiting. Once an address of a submission is checked, it answers with success, and the same submission with the same addresses is not checked again for 24 hours (across relay instances only with EVENTS bound). If our API is busy, or your key or credits need fixing, it answers with an error and nothing is charged, so Basin's retry is safe once it is fixed. A check that timed out may have been charged: that one is answered with success and reported as not checked. A delivery in another payload format than JSON is answered with an error and checks nothing.

Nothing here has been run against a real Basin account yet: it is built from Basin's public documentation and tested against deliveries built from it.

More on Basin

Updated · Maintained by: Email Validation LLC

Need help? Contact support, or ask the help chat. Something wrong or missing on this page? Tell us