Webhooks
Receive a signed HTTP POST to your server the moment a bulk job completes - no polling required.
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:
| Method | Where | Scope |
|---|---|---|
| Global URL | Dashboard → My Account → Webhooks section | Applies to all bulk jobs from your account unless overridden. |
| Per-job URL | webhook_url field in POST /v1/bulk request body | Overrides 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
| Field | Type | Description |
|---|---|---|
| event | string | Event type. Currently always bulk_job.completed. |
| data | object | Job details. See Data Object below. |
Data Object
| Field | Type | Description |
|---|---|---|
| job_id | string | Job identifier. Use this to call GET /v1/bulk/:job_id/status to retrieve paginated results. |
| status | string | Always completed in this event. |
| created_at | string | ISO 8601 timestamp when the event was dispatched. |
| completed_at | string | ISO 8601 timestamp when the job finished processing. |
| stats | object | Aggregate counts keyed by SB_Status: total, VALID, INVALID, CATCH_ALL, UNKNOWN, DO_NOT_MAIL, SPAMTRAP, ABUSE, duplicate, score. |
| results_url | string | Full URL to retrieve per-email results via the status endpoint. Supports ?page and &limit params. |
{
"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
results_url to fetch paginated results: ?page=0&limit=1000, ?page=1&limit=1000, etc.Request Headers Sent to Your Endpoint
| Header | Value / Description |
|---|---|
| Content-Type | application/json |
| X-StopBounceAI-Signature | HMAC-SHA256 hex digest of the raw request body bytes, keyed with your webhook signing secret. Always verify this before processing. |
| User-Agent | StopBounceAI-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.
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:
| Attempt | Delay after previous attempt |
|---|---|
| 1 (initial) | Immediately on job completion |
| 2 | 5 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
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.