Skip to content

// automation and data tools

Via API

Segment email verification with pingutil

Segment forwards identify calls to every marketing and sales destination, so a throwaway or machine-generated address gets copied into the CRM, the email tool and the warehouse at the same time. A destination insert function can call pingutil in onIdentify, add the category and spam verdict as traits, and drop or flag the event before delivery.

Where it connects: Destination insert function, onIdentify handler

What goes wrong without it

  • Every disposable signup shows up as a new profile in Braze, HubSpot and the warehouse.
  • Marketing builds audiences on "new users" that are padded with fake accounts.
  • We want one place in the pipeline to classify emails instead of a check in every destination.

What you can do with Segment and pingutil

  • Add email traits on identify

    Call /v1/lookup with skip_enrichment: true and add traits like email_category and email_is_spam, so every downstream audience can filter on them.

  • Keep throwaway profiles out of the email tool

    Attach the insert function to the email destination and drop identify events where verdict.is_spam is true, while the warehouse still receives them.

  • Company traits for B2B destinations

    For company emails, a full lookup adds company.name and company.industry as traits before the event reaches the CRM.

Set it up

  1. 1

    In Segment, create a destination insert function and add a secret setting named apiKey with your pingutil key.

  2. 2

    Paste the onIdentify handler below and keep pass-through handlers (return event) for the other event types you send.

  3. 3

    Test it with a sample identify event that has traits.email set.

  4. 4

    Attach the function to the destinations that should receive the enriched or filtered events.

  5. 5

    Watch the function's error counts after deploying; pingutil errors pass the event through unchanged.

Insert function: classify traits.email on identify
async function onIdentify(event, settings) {
  const email = event.traits && event.traits.email;
  if (!email) return event;

  let data;
  try {
    const res = await fetch('https://pingutil.com/v1/lookup', {
      method: 'POST',
      headers: {
        Authorization: 'Bearer ' + settings.apiKey,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ input: email, skip_enrichment: true }),
    });
    if (!res.ok) return event; // rate limit, quota or 5xx: deliver unchanged
    data = await res.json();
  } catch (err) {
    return event; // network error: fail open
  }

  event.traits.email_category = data.category;
  event.traits.email_is_spam = data.verdict.is_spam;
  event.traits.email_low_trust = data.verdict.low_trust;
  event.traits.email_reason = data.verdict.reason;

  // Uncomment to keep throwaway profiles out of this destination:
  // if (data.verdict.is_spam) throw new DropEvent('spam email: ' + data.verdict.reason);
  return event;
}

async function onTrack(event, settings) {
  return event;
}

What to do with each result

pingutil resultAction in Segment
categorytraits.email_category for audiences and CRM fields
verdict.is_spam = truetraits.email_is_spam, or DropEvent for that destination
verdict.low_trust = truetraits.email_low_trust so marketing can exclude role inboxes
Error or 429Return the event unchanged

Limits to plan for

  • pingutil allows 60 requests a minute and 2,000 lookups a day (30,000 a month) per account, which a busy Segment source can exceed; call it on identify only, not on track. Those are Free plan limits; Enterprise has custom limits.
  • Segment retries events when a function throws RetryError, which replays the call; this snippet fails open instead of retrying.
  • Fast mode classifies the address; it does not check the mailbox. Use /v1/verify where a mailbox check matters.

Segment documentation

Segment is a trademark of its owner. This integration uses Segment's documented extension points; it is not an official Segment app.

Common questions

Why an insert function and not a destination function?
An insert function modifies or drops the event before it reaches an existing destination. A destination function only sends events somewhere new.
Will this slow down delivery?
Fast mode lookups return in milliseconds without an AI call, so the delay per identify is small. Avoid /v1/verify here because it can take seconds.

Stop bad addresses in Segment today

Sign in with your email, create an API key and paste it into the step above. Test on a few real addresses first: the live demo shows exactly what your Segment setup will receive.