# Validate Emails in Basin Forms: Setup Guide

URL: https://email-validation.org/docs/guides/basin/
Updated: 2026-12-04

> Documentation index: https://email-validation.org/llms.txt

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](https://email-validation.org/downloads/basin/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](https://email-validation.org/docs/guides/signup-form-validation/).

## 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](https://email-validation.org/app/api-keys/) with **Validate addresses**. A
  [daily credit cap](https://email-validation.org/docs/authentication/#limits) on the key limits what a busy form can spend. Each billable check
  uses one credit ([what is free](https://email-validation.org/docs/credits-and-billing/)).
- 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](#relay-dashboard) instead. Or, from the unzipped folder:

```bash
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:

```bash
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](https://dash.cloudflare.com/), 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](#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

| Setting | What it does |
|---|---|
| `EV_API_KEY` | Our API key (required) |
| `BASIN_SIGNING_SECRET` | The webhook's signing secret, from **Webhook Signing** in Basin (required) |
| `EV_REGION` | `eu` to have addresses validated in the EU and their results stored there (default `us`) |
| `EMAIL_FIELDS` | Comma-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_URL` | An https address of yours that receives each submission's results as JSON |
| `FORWARD_SECRET` | Signs the forward: header `X-EV-Signature: sha256=<base64 HMAC-SHA256 of the body>` |
| `SLACK_WEBHOOK_URL` | A Slack incoming webhook |
| `NOTIFY_ON` | `all` (default) or `problems`: report only the results whose action is not `send` |
| `INCLUDE_EMAIL` | `true` to put the address in the forward and the Slack message (default: ids and results only) |
| `EVENTS` | A 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

- [Basin email validation integration](https://email-validation.org/integrations/basin/)
