StopBounceAI

Webhooks

Receive a signed HTTP POST to your server the moment a bulk job completes - no polling required.

Discover with AI

How It Works

When a bulk verification job transitions to completed, StopBounceAI sends a POST request to your configured webhook URL. The payload is JSON and every request is signed with an HMAC-SHA256 signature so you can verify it came from us.

Configuration

You have two ways to configure a webhook URL:

MethodWhereScope
Global URLDashboard → My Account → Webhooks sectionApplies to all bulk jobs from your account unless overridden.
Per-job URLwebhook_url field in POST /v1/bulk request bodyOverrides the global URL for that specific job only.

The signing secret is generated in the same Webhooks panel. It is shown once when generated - copy it immediately. Use it to verify the X-StopBounceAI-Signature header on every incoming request.

Payload Format

StopBounceAI sends a Content-Type: application/json POST with the following structure:

Top-level fields

FieldTypeDescription
eventstringEvent type. Currently always bulk_job.completed.
dataobjectJob details. See Data Object below.

Data Object

FieldTypeDescription
job_idstringJob identifier. Use this to call GET /v1/bulk/:job_id/status to retrieve paginated results.
statusstringAlways completed in this event.
created_atstringISO 8601 timestamp when the event was dispatched.
completed_atstringISO 8601 timestamp when the job finished processing.
statsobjectAggregate counts keyed by SB_Status: total, VALID, INVALID, CATCH_ALL, UNKNOWN, DO_NOT_MAIL, SPAMTRAP, ABUSE, duplicate, score.
results_urlstringFull URL to retrieve per-email results via the status endpoint. Supports ?page and &limit params.
json
{
  "event": "bulk_job.completed",
  "data": {
    "job_id": "J1717000000000",
    "status": "completed",
    "created_at": "2024-05-12T10:05:30Z",
    "completed_at": "2024-05-12T10:05:30Z",
    "stats": {
      "total": 10000,
      "VALID": 8500,
      "INVALID": 1000,
      "CATCH_ALL": 300,
      "UNKNOWN": 50,
      "DO_NOT_MAIL": 100,
      "SPAMTRAP": 25,
      "ABUSE": 25,
      "duplicate": 28,
      "score": 85
    },
    "results_url": "https://api.stopbounceai.com/v1/bulk/J1717000000000/status"
  }
}
Full results not included
The payload contains summary stats only - not the full list of emails. Use results_url to fetch paginated results: ?page=0&limit=1000, ?page=1&limit=1000, etc.

Request Headers Sent to Your Endpoint

HeaderValue / Description
Content-Typeapplication/json
X-StopBounceAI-SignatureHMAC-SHA256 hex digest of the raw request body bytes, keyed with your webhook signing secret. Always verify this before processing.
User-AgentStopBounceAI-Webhooks/1.0

Verifying Signatures

Always verify the signature before processing a webhook. Compute an HMAC-SHA256 of the raw request body using your signing secret, then compare it to the X-StopBounceAI-Signature header using a constant-time comparison.

Important: use the raw bytes of the request body - not a re-serialized version of the parsed JSON. The signature is computed over the exact bytes received.

javascript
import crypto from 'crypto';
import express from 'express';

const app = express();

app.post(
  '/webhooks/stopbounceai',
  express.raw({ type: 'application/json' }),  // raw body required
  (req, res) => {
    const signature = req.headers['x-stopbounceai-signature'];
    const secret    = process.env.WEBHOOK_SECRET;

    // Compute expected signature over raw body bytes
    const expected = crypto
      .createHmac('sha256', secret)
      .update(req.body)          // Buffer - raw bytes from express.raw()
      .digest('hex');

    // Constant-time comparison prevents timing attacks
    const isValid = crypto.timingSafeEqual(
      Buffer.from(expected,  'hex'),
      Buffer.from(signature, 'hex')
    );

    if (!isValid) {
      return res.status(401).send('Invalid signature');
    }

    const event = JSON.parse(req.body.toString());

    if (event.event === 'bulk_job.completed') {
      const { job_id, stats, results_url } = event.data;
      console.log(`Job ${job_id} done. Valid: ${stats.valid}/${stats.total}`);
      // Fetch full results from results_url using your API key
    }

    res.json({ received: true });
  }
);

Retries

If your endpoint returns a non-2xx status code or times out (after 10 seconds), StopBounceAI retries delivery on the following schedule:

AttemptDelay after previous attempt
1 (initial)Immediately on job completion
25 minutes
3 (final)30 minutes

After 3 failed attempts, delivery is abandoned. Results remain available indefinitely via GET /v1/bulk/:job_id/status - you can always retrieve them by polling directly.

Respond quickly
Return a 2xx response as fast as possible (ideally under 1 second). Do your processing asynchronously. If your handler takes longer than 10 seconds, the request times out and is retried.

Idempotency

Due to retries, your handler may receive the same job_id more than once. Use job_id as a deduplication key - skip processing if you've already handled that job.