Operate

Webhook events

Every event we send to a webhook endpoint: when it is sent, every field it carries and an example, how to check its signature with each official SDK, and when a failed delivery is tried again. To add an endpoint and choose its events, see Webhooks.

Every delivery is an HTTPS POST of a JSON object with the event type, a timestamp and data. It holds event metadata only (ids, statuses, counts, an error code, a balance or an expiry date), never email addresses or verification results. These headers come with it:

  • webhook-id: Unique id of the event (stable across retries).
  • webhook-timestamp: Unix time in seconds when the delivery was signed.
  • webhook-signature: Space-separated signatures, each v1,<base64>.

Events

  • bulk.completed: A bulk job finished and its results can be downloaded.
  • bulk.failed: A bulk job could not finish (unused credits are returned).
  • credits.low: Your balance fell below the low-balance threshold you set.
  • credits.expiring: Some of your credits expire in 30 days.
  • webhook.test: You pressed Send test for the endpoint in the dashboard (sent whatever events it subscribes to).

bulk.completed

A bulk job finished and its results can be downloaded.

Fields of data:

  • job_id · string · always present
    Bulk job id.
  • status · BulkJobStatus · always present
    Job lifecycle.
  • total_rows · integer or null · always present
    Data rows in the file (header excluded).
  • unique_emails · integer or null · always present
    Distinct addresses after normalization that need a mail-server check. Later rows repeating one of them (duplicates), malformed rows (syntax_invalid) and sandbox addresses (local_answered) are counted apart, so total_rows is the sum of the four.
  • processed · integer · always present
    Of unique_emails, the addresses with a final result so far; a completed job ends with processed equal to unique_emails. Sandbox addresses (local_answered), malformed rows and duplicates are never counted here, so a list of only sandbox addresses completes with processed 0.
  • credits_charged · integer · always present
    Credits actually used. When the job ends, the difference to credits_reserved is returned.
  • counts · object · always present
    Results by status.
  • error_code · string or null · always present
    Why a job failed or is waiting in ready, for example insufficient_credits (the job stays ready) or invalid_csv. Every value: https://email-validation.org/docs/api/bulk/#errors

Example:

{
  "type": "bulk.completed",
  "timestamp": "2026-10-20T09:52:08.000Z",
  "data": {
    "job_id": "job_3Fv8QpL2xM7nC1rT9kW4yB",
    "status": "completed",
    "total_rows": 12480,
    "unique_emails": 12061,
    "processed": 12061,
    "credits_charged": 11874,
    "counts": {
      "valid": 10406,
      "invalid": 977,
      "catch_all": 401,
      "unknown": 187,
      "disposable": 90
    },
    "error_code": null
  }
}

bulk.failed

A bulk job could not finish (unused credits are returned).

Fields of data:

  • job_id · string · always present
    Bulk job id.
  • status · BulkJobStatus · always present
    Job lifecycle.
  • total_rows · integer or null · always present
    Data rows in the file (header excluded).
  • unique_emails · integer or null · always present
    Distinct addresses after normalization that need a mail-server check. Later rows repeating one of them (duplicates), malformed rows (syntax_invalid) and sandbox addresses (local_answered) are counted apart, so total_rows is the sum of the four.
  • processed · integer · always present
    Of unique_emails, the addresses with a final result so far; a completed job ends with processed equal to unique_emails. Sandbox addresses (local_answered), malformed rows and duplicates are never counted here, so a list of only sandbox addresses completes with processed 0.
  • credits_charged · integer · always present
    Credits actually used. When the job ends, the difference to credits_reserved is returned.
  • counts · object · always present
    Results by status.
  • error_code · string or null · always present
    Why a job failed or is waiting in ready, for example insufficient_credits (the job stays ready) or invalid_csv. Every value: https://email-validation.org/docs/api/bulk/#errors

Example:

{
  "type": "bulk.failed",
  "timestamp": "2026-10-20T09:30:12.000Z",
  "data": {
    "job_id": "job_3Fv8QpL2xM7nC1rT9kW4yB",
    "status": "failed",
    "total_rows": null,
    "unique_emails": null,
    "processed": 0,
    "credits_charged": 0,
    "counts": {},
    "error_code": "invalid_csv"
  }
}

credits.low

Your balance fell below the low-balance threshold you set.

Fields of data:

  • balance · integer · always present
    Your balance right after it fell below threshold.
  • threshold · integer · always present
    The threshold the alert used: yours, or by default the larger of 100 credits and 10% of your largest credit lot.

Example:

{
  "type": "credits.low",
  "timestamp": "2026-10-20T10:04:00.000Z",
  "data": {
    "balance": 950,
    "threshold": 1000
  }
}

credits.expiring

Some of your credits expire in 30 days.

Fields of data:

  • credits · integer · always present
    Credits that expire at expires_at.
  • expires_at · string (date-time) · always present
    When those credits expire.

Example:

{
  "type": "credits.expiring",
  "timestamp": "2026-10-20T12:00:00.000Z",
  "data": {
    "credits": 850,
    "expires_at": "2026-11-19T12:00:00.000Z"
  }
}

webhook.test

You pressed Send test for the endpoint in the dashboard (sent whatever events it subscribes to).

Fields of data:

  • endpoint_id · string · always present
    The endpoint the test was sent to.

Example:

{
  "type": "webhook.test",
  "timestamp": "2026-10-20T10:15:00.000Z",
  "data": {
    "endpoint_id": "whk_5Rt8YpL3nQ7vC2xM9kW4bD"
  }
}

Verify the signature with an SDK

Each official SDK (some coming soon) checks the signature and the timestamp for you and returns the event. Pass it the raw body, before any JSON parsing, the request headers and your endpoint secret (whsec_…). Without an SDK, follow the steps on Webhooks.

JavaScript

TypeScript
import { verifyWebhook, WebhookVerificationError } from '@email-validation/sdk';

// In any fetch-style handler (a Request in, a Response out):
export default {
  async fetch(request: Request, env: { EV_WEBHOOK_SECRET: string }) {
    try {
      const event = await verifyWebhook(await request.text(), request.headers, env.EV_WEBHOOK_SECRET);
      if (event.type === 'bulk.completed') console.log('job done', event.data.job_id);
      return new Response(null, { status: 204 });
    } catch (err) {
      if (err instanceof WebhookVerificationError) return new Response('invalid signature', { status: 400 });
      throw err;
    }
  },
};

Python

import os

from email_validation import WebhookVerificationError, verify_webhook
from flask import Flask, request

app = Flask(__name__)


@app.post("/webhooks/email-validation")
def webhook():
    try:
        event = verify_webhook(request.get_data(), request.headers, os.environ["EV_WEBHOOK_SECRET"])
    except WebhookVerificationError:
        return "invalid signature", 400
    if event["type"] == "bulk.completed":
        print("job done", event["data"]["job_id"])
    return "", 204

Go

http.HandleFunc("/webhooks/email-validation", func(w http.ResponseWriter, r *http.Request) {
	body, err := io.ReadAll(r.Body) // the raw body, before any JSON parsing
	if err != nil {
		http.Error(w, "bad body", http.StatusBadRequest)
		return
	}
	event, err := emailvalidation.VerifyWebhook(body, r.Header, os.Getenv("EV_WEBHOOK_SECRET"), nil)
	if err != nil {
		http.Error(w, "invalid signature", http.StatusBadRequest)
		return
	}
	if event.Type == emailvalidation.WebhookBulkCompleted {
		if data, err := event.BulkData(); err != nil {
			log.Println("unexpected bulk event data:", err) // signed, so answer 2xx: a resend would not parse either
		} else {
			log.Println("job done", data.JobID)
		}
	}
	w.WriteHeader(http.StatusNoContent)
})

PHP

<?php

use EmailValidation\Exception\WebhookVerificationException;
use EmailValidation\Webhook;

$payload = file_get_contents('php://input'); // the raw body, before any JSON parsing

try {
    $event = Webhook::verify($payload, getallheaders(), (string) getenv('EV_WEBHOOK_SECRET'));
} catch (WebhookVerificationException $e) {
    http_response_code(400);
    exit;
}

if ($event->type === 'bulk.completed') {
    error_log('job done ' . $event->data['job_id']);
}
http_response_code(204);

Ruby

# Sinatra
payload = request.body.read # the raw body, before any JSON parsing
begin
  event = EmailValidation.verify_webhook(payload, request.env, ENV.fetch("EV_WEBHOOK_SECRET"))
rescue EmailValidation::WebhookVerificationError
  halt 400, "invalid signature"
end

puts "job done #{event.data.job_id}" if event.type == "bulk.completed"
status 204

Java

// Java SDK: coming soon to its registry
// rawBody: the request body bytes exactly as received; headers: for example a Map<String, List<String>>
try {
  WebhookEvent event = Webhooks.verifyWebhook(rawBody, headers, System.getenv("EV_WEBHOOK_SECRET"));
  if (WebhookEventType.BULK_COMPLETED.equals(event.type())) {
    System.out.println("job done " + event.bulkData().jobId());
  }
  // answer 204
} catch (WebhookVerificationException e) {
  // answer 400
}

C#

app.MapPost("/webhooks/email-validation", async (HttpRequest request) =>
{
    using var body = new MemoryStream();
    await request.Body.CopyToAsync(body);
    try
    {
        var evt = Webhooks.Verify(body.ToArray(), request.Headers,
            Environment.GetEnvironmentVariable("EV_WEBHOOK_SECRET")!);
        if (evt.Type == WebhookEventType.BulkCompleted)
            Console.WriteLine($"job done: {evt.GetBulkData().JobId}");
        return Results.NoContent();
    }
    catch (WebhookVerificationException)
    {
        return Results.BadRequest();
    }
});

Rust

use email_validation::{verify_webhook, WebhookHeaders, WebhookPayload};

/// `raw_body` is the request body exactly as received; `headers` can be an `http::HeaderMap` (axum, hyper),
/// a `HashMap`, a `BTreeMap` or a list of `(name, value)` pairs with string values.
fn on_delivery(raw_body: &[u8], headers: &impl WebhookHeaders, secret: &str) -> u16 {
    let Ok(event) = verify_webhook(raw_body, headers, secret) else {
        return 400;
    };
    if let Ok(WebhookPayload::BulkCompleted(data)) = event.payload() {
        println!("job done {}", data.job_id);
    }
    204
}

Swift

// rawBody: the request body exactly as received (Data or String); headers: [String: String] or [String: [String]]
// (a String body with [String: [String]] headers needs version 1.1.0 or later)
do {
    let event = try verifyWebhook(payload: rawBody, headers: headers, secret: webhookSecret)
    if case .bulk(let data) = event.data, event.type == .bulkCompleted {
        print("job done", data.jobId)
    }
    // answer 204
} catch is WebhookVerificationError {
    // answer 400
}

Kotlin

// Kotlin SDK: coming soon to its registry
fun handle(rawBody: ByteArray, headers: Map<String, String>): Int {
    val event = try {
        verifyWebhook(rawBody, headers, System.getenv("EV_WEBHOOK_SECRET"))
    } catch (e: WebhookVerificationException) {
        return 400
    }
    if (event.type == WebhookEventType.BULK_COMPLETED) println("job done ${event.bulkData().jobId}")
    return 204
}

Dart

// Dart SDK: coming soon to its registry
import 'dart:io';

import 'package:email_validation_sdk/email_validation_sdk.dart';

Future<void> main() async {
  final secret = Platform.environment['EV_WEBHOOK_SECRET'] ?? '';
  final server = await HttpServer.bind(InternetAddress.anyIPv4, 8080);
  await for (final request in server) {
    final body = await request.fold<List<int>>([], (all, chunk) => all..addAll(chunk)); // the raw body
    try {
      final event = verifyWebhook(body, request.headers, secret);
      if (event.type == WebhookEventType.bulkCompleted) {
        print('job done ${event.bulkData.jobId}');
      }
      request.response.statusCode = HttpStatus.noContent;
    } on WebhookVerificationException {
      request.response.statusCode = HttpStatus.badRequest;
    }
    await request.response.close();
  }
}

Elixir

# Elixir SDK: coming soon to its registry
# Phoenix / Plug: the raw body, read in full (at most 1 MB) before any JSON parsing
case Plug.Conn.read_body(conn, length: 1_048_576) do
  {:ok, payload, conn} ->
    case EmailValidation.verify_webhook(payload, conn.req_headers, System.fetch_env!("EV_WEBHOOK_SECRET")) do
      {:ok, %EmailValidation.WebhookEvent{type: "bulk.completed", data: data}} ->
        IO.puts("job done #{data.job_id}")
        Plug.Conn.send_resp(conn, 204, "")

      {:ok, _event} ->
        Plug.Conn.send_resp(conn, 204, "")

      {:error, %EmailValidation.WebhookVerificationError{}} ->
        Plug.Conn.send_resp(conn, 400, "invalid signature")
    end

  {:more, _partial, conn} ->
    Plug.Conn.send_resp(conn, 413, "body too large")

  {:error, _reason} ->
    Plug.Conn.send_resp(conn, 400, "could not read the body")
end

C

// C SDK: coming soon to its registry
#include <email_validation.h>
#include <stdlib.h>
#include <string.h>

/* body: the raw request body; headers: name/value pairs in any case */
int on_webhook(const char *body, size_t len, const emailval_header *headers, size_t count) {
  emailval_webhook_event *event = NULL;
  if (emailval_verify_webhook(body, len, headers, count, getenv("EV_WEBHOOK_SECRET"), NULL, &event, NULL) !=
      EMAILVAL_OK) {
    return 400;
  }
  if (event->type != NULL && strcmp(event->type, EMAILVAL_EVENT_BULK_COMPLETED) == 0) {
    const char *job_id = emailval_json_string(emailval_json_get(event->data, "job_id"), NULL);
    (void)job_id;
  }
  emailval_webhook_event_free(event);
  return 204;
}

Perl

# Perl SDK: coming soon to its registry
# a PSGI application (Plack, Dancer2 or Mojolicious)
my $app = sub {
    my ($env) = @_;
    my ( $payload, $chunk ) = ( '', '' );    # the raw body, read in full (at most 1 MB) before any JSON parsing
    while ( $env->{'psgi.input'}->read( $chunk, 65536 ) ) {    # a read can return less; 0 at the end
        $payload .= $chunk;
        return [413, [], ['body too large']] if length $payload > 1_048_576;
    }
    my $event = eval { EmailValidation::Webhooks::verify_webhook($payload, $env, $ENV{EV_WEBHOOK_SECRET}) };
    return [400, [], ['invalid signature']] if !$event;

    print 'job done ', $event->data->job_id, "\n" if $event->type eq 'bulk.completed';
    return [204, [], []];
};

The JavaScript tab's sample is TypeScript. In plain JavaScript, leave out the type annotations (and any ! after a value); everything else is the same.

More on each SDK's helper: JavaScript and TypeScript, Python, Go, PHP, Ruby, Java, C# and .NET, Rust, Swift, Kotlin, Dart, Elixir, C, Perl.

Delivery and retries

  • Answer with any 2xx status within 10 seconds. Redirects are not followed; any other answer, or none, is a failed attempt.
  • A failed delivery is tried again up to 8 times, 9 attempts in all, with growing waits. Each wait varies by up to 20% either way (never over 1 hour), so deliveries that failed together do not all come back at once.
  • The same event can arrive more than once: deduplicate on webhook-id, which stays the same across retries.
  • An endpoint whose attempts fail 20 times in a row is turned off; turn it back on in the dashboard after fixing it.
  • A webhook.test delivery from Send test is sent once: it is never retried and does not count toward turning the endpoint off.
AttemptMade about this long after the previous one
1When the event happens
230 seconds
31 minute
42 minutes
54 minutes
68 minutes
716 minutes
832 minutes
91 hour

Updated · Maintained by: Email Validation LLC

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