Skip to content

Marketing & email

Verify signup emails before creating Loops contacts

In your signup handler, verify the email first, refuse typos, then create the Loops contact with an emailStatus property through the official loops SDK.

Updated 2026-11-26

This recipe verifies the email in your signup handler before the person becomes a Loops contact. Typos are refused while the person is still on the form, disposable inboxes stay off your mailing list, and every contact carries an emailStatus property that your Loops audience filters and loops can use. There is no native Qelka app for Loops; the code uses the official loops JavaScript SDK in your backend.

Why at signup: a SaaS signup is usually followed within seconds by a welcome or onboarding email from Loops. If the address has a typo, that first email bounces, and mailbox providers judge your domain by how much of your mail bounces. Refusing the typo at the form fixes it for everyone: the person gets their email, and your sender reputation stays clean. See Email bounces explained.

What you need

  • A Loops account, an API key from its API settings page, and the ID of the mailing list signups join, if you use one.
  • A string contact property named emailStatus, created once in Loops.
  • Node.js 20 or later, the minimum of the loops SDK. Install with npm install loops @qelka/sdk.
  • A Qelka API key. A sk_test_ key returns simulated results and never spends credits: see Test mode.
  • Environment variables LOOPS_API_KEY, LOOPS_LIST_ID and QELKA_API_KEY. Loops' API refuses browser calls, and both keys must stay on the server anyway.

Steps

1. Verify the address

javascript
import { ApiConnectionError, ApiError, Client } from '@qelka/sdk'

const verifier = new Client({ apiKey: process.env.QELKA_API_KEY, timeoutMs: 10000 })

export async function checkAddress(email) {
  try {
    return await verifier.email.verify({ email })
  } catch (error) {
    if (error instanceof ApiError) {
      console.warn(`email check skipped: ${error.type} request ${error.requestId}`)
    } else if (error instanceof ApiConnectionError) {
      console.warn(`email check skipped: ${error.message}`)
    } else {
      throw error
    }
    return { status: 'unchecked', reason: null, did_you_mean: null }
  }
}

This runs a full check, which asks the recipient's mail server whether the mailbox exists, capped at 10 seconds. If your form must answer faster, pass { email, mode: 'fast' }: it catches typos in the domain, domains that take no mail and disposable inboxes without waiting for a mail server, and returns unknown with the reason smtp_not_checked for everything else. Any API problem returns unchecked, so the signup always goes through.

2. Create the contact after the check

javascript
import { APIError, LoopsClient, RateLimitExceededError } from 'loops'
import { checkAddress } from './check-address.js'

const loops = new LoopsClient(process.env.LOOPS_API_KEY)

export async function addSignupToLoops({ email: rawEmail, userId }) {
  const email = rawEmail.trim()
  const check = await checkAddress(email)

  if (check.status === 'undeliverable') {
    return {
      ok: false,
      message: check.did_you_mean ? `Did you mean ${check.did_you_mean}?` : 'This address cannot receive mail.',
    }
  }

  const joinsList = check.reason !== 'disposable'
  try {
    await loops.updateContact({
      email,
      userId,
      properties: { emailStatus: check.status },
      ...(joinsList ? { mailingLists: { [process.env.LOOPS_LIST_ID]: true } } : {}),
    })
  } catch (error) {
    if (error instanceof RateLimitExceededError) {
      console.warn(`Loops rate limit reached: ${error.remaining} of ${error.limit} left`)
    } else if (error instanceof APIError) {
      console.error(`Loops answered ${error.statusCode}`, error.json)
    }
    throw error
  }
  return { ok: true }
}

Call addSignupToLoops from the handler that receives your signup form, before or right after you create the user in your database, and render message next to the email field when ok is false.

  • Undeliverable addresses never reach Loops, so nothing is sent to them and they do not count as contacts.
  • A disposable inbox becomes a contact with emailStatus: risky but does not join the mailing list. If your product needs a lasting address, refuse it in the form instead: see Block disposable email signups.
  • updateContact creates the contact when it does not exist yet, so a repeated signup does not fail with the 409 that createContact returns for an existing email or userId.
  • Loops errors are rethrown: decide in your handler whether a Loops outage should fail the signup or be queued for a retry. Queuing is kinder.

3. Use the property in Loops

Filter your audience or branch a loop on emailStatus:

emailStatus Meaning Suggested use in Loops
deliverable The mail server accepted the mailbox Send everything
risky A disposable inbox, a catch-all domain or a full mailbox Send product and account emails; consider leaving them out of campaigns
unknown The checks could not conclude, or fast mode found nothing wrong Send everything. Never delete on this result; re-check later
unchecked The API was not reached Send everything, and re-check from a job

There is no undeliverable value in Loops, because those addresses are refused before the contact exists. If you also want the reason, create an emailReason property and send check.reason; the email reference explains each one.

4. Test the branches

With a sk_test_ key, the part before the @ picks the outcome: sign up with undeliverable@example.com and the form must refuse it, with disposable@example.com and the contact must appear without the list, with any other address and it must appear on the list with emailStatus: deliverable. Use a separate Loops account or list for tests so your real audience stays clean.

Handle errors and rate limits

Nothing is billed on errors. 401 and 403 mean a wrong or restricted key, 402 an empty balance: each ends as unchecked, so contacts with that value tell you something is wrong, and a low-balance webhook warns you before it happens. The Qelka SDK retries 429 after Retry-After. A key allows 200 requests per 10 seconds, and each check costs 1 credit. Loops has its own team-wide rate limit, documented in its API reference, and signals it with 429 and x-ratelimit-* headers, which the SDK raises as RateLimitExceededError. See Errors and Rate limits.

Frequently asked questions

Can I call the Loops API from my signup page directly?
No. Loops says its API key must never be used client side, and its API does not accept cross-origin requests from browser JavaScript. The same goes for your verification key. Run both calls in your backend, in the handler that receives the signup form.
Why updateContact rather than createContact?
createContact answers 409 when the email or userId already exists, so a person who signs up twice, or who was imported earlier, would make your handler fail. Loops documents that updateContact creates the contact when no match exists, so it covers both cases in one call.
Do I have to create the emailStatus property in Loops first?
Yes. Loops asks you to create custom properties in your account before using them in API calls. Create emailStatus once as a string property, in Loops or with its create contact property endpoint, then deploy the code.

More in Marketing & email

All integrations

Put this check in your product

Get an API key in under a minute. 100 free credits every month, no card required.

  • 100 free credits a month
  • No card
  • Test keys spend nothing
  • Cancel any time