Real-time event notifications
Webhooks allow you to receive real-time notifications when events occur in your SnapshotAI account. Configure webhook endpoints to get instant updates when screenshots complete, fail, or are queued.
Create a webhook endpoint and select which events you want to receive.
When an event happens, we immediately send a POST request to your URL.
Your endpoint receives the payload and processes it in your application.
Why Use Webhooks?
Webhooks are more efficient than polling. Instead of repeatedly checking for updates, you receive instant notifications when events occur, reducing API calls and improving response times.
screenshot.queuedScreenshotTriggered when a screenshot job is created and queued for processing
screenshot.completedScreenshotTriggered when a screenshot job completes successfully
screenshot.failedScreenshotTriggered when a screenshot job fails to complete
video.completedVideoTriggered when a video recording job completes successfully
video.failedVideoTriggered when a video recording job fails to complete
/v1/webhooksCreate a new webhook endpoint to receive event notifications. Your endpoint must be accessible via HTTPS and return a 2xx status code within 5 seconds.
Base URL: https://www.snapshotai.dev
HTTPS Required
Webhook URLs must use HTTPS for security. HTTP endpoints will be rejected.
namestringRequiredDescriptive name for the webhook endpoint (max 100 characters)
Example: Production Webhook
urlstringRequiredHTTPS URL where webhook events will be sent. Must start with https://
Example: https://your-app.com/api/webhooks/screenshot
eventsarray<string>RequiredArray of event types to subscribe to. At least one event required.
Example: ["screenshot.completed", "screenshot.failed"]
descriptionstringOptionalOptional description of webhook purpose (max 500 characters)
Example: Notifies production system when screenshots complete
is_activebooleanOptionalWhether webhook is active and should receive events
Default: true
curl -X POST https://www.snapshotai.dev/api/v1/webhooks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Production Webhook",
"url": "https://your-app.com/api/webhooks/screenshot",
"events": ["screenshot.completed", "screenshot.failed"],
"description": "Notifies when screenshots complete or fail"
}'{
"message": "Webhook endpoint created successfully",
"data": {
"id": "wh_abc123xyz",
"name": "Production Webhook",
"url": "https://your-app.com/api/webhooks/screenshot",
"events": [
"screenshot.completed",
"screenshot.failed"
],
"description": "Notifies when screenshots complete or fail",
"is_active": true,
"is_default": false,
"created_at": "2025-11-04T23:45:30.123Z",
"updated_at": "2025-11-04T23:45:30.123Z"
}
}/v1/webhooksList all your webhook endpoints with filtering and pagination.
Base URL: https://www.snapshotai.dev
include_inactivebooleanOptionalInclude inactive webhooks in results
Default: false
limitnumberOptionalMaximum number of results to return
Default: 100
offsetnumberOptionalNumber of results to skip for pagination
Default: 0
/v1/webhooks/:idGet detailed information about a specific webhook endpoint, including delivery statistics.
Base URL: https://www.snapshotai.dev
idstringRequiredThe unique identifier of the webhook (starts with wh_)
/v1/webhooks/:idUpdate webhook endpoint configuration. You can change the URL, events, or enable/disable the webhook.
Base URL: https://www.snapshotai.dev
namestringOptionalUpdate webhook name
Example: Updated Webhook Name
urlstringOptionalUpdate webhook URL (must be HTTPS)
Example: https://new-endpoint.com/webhooks
eventsarray<string>OptionalUpdate subscribed events
Example: ["screenshot.completed"]
is_activebooleanOptionalEnable or disable webhook
Example: false
/v1/webhooks/:idPermanently delete a webhook endpoint. This action cannot be undone.
Base URL: https://www.snapshotai.dev
Empty response body. Webhook successfully deleted.
/v1/webhooks/:id/testSend a test event to your webhook endpoint to verify it's working correctly.
Base URL: https://www.snapshotai.dev
Test Delivery
The test sends a sample screenshot.completed event with dummy data to verify your endpoint responds correctly.
curl -X POST https://www.snapshotai.dev/api/v1/webhooks/wh_abc123xyz/test \
-H "Authorization: Bearer YOUR_API_KEY"{
"success": true,
"message": "Webhook test successful",
"status_code": 200,
"response_time_ms": 142,
"error": null,
"timestamp": "2025-11-04T23:50:15.456Z"
}All webhook events have a consistent structure with event metadata and relevant data:
{
"id": "evt_2nX8Kp9mJ4dL7qR",
"type": "screenshot.completed",
"created_at": "2025-11-04T23:30:19.654Z",
"data": {
"screenshot": {
"id": "scr_2nX8Kp9mJ4dL7qR",
"url_to_capture": "https://example.com",
"status": "completed",
"storage_path": "users/usr_abc123/scr_2nX8Kp9mJ4dL7qR.png",
"file_size_bytes": 245678,
"processing_duration_ms": 3420,
"download_url": "https://storage.snapshotai.dev/...",
"created_at": "2025-11-04T23:30:15.123Z",
"completed_at": "2025-11-04T23:30:19.654Z",
"options": {
"viewport_width": 1920,
"viewport_height": 1080,
"format": "png"
}
}
}
}idUnique event identifier for deduplication
typeEvent type (e.g., screenshot.completed)
dataEvent-specific data (screenshot, video, etc.)
Verify webhook authenticity using the signature in the X-Webhook-Signature header:
const crypto = require('crypto');
function verifyWebhookSignature(payload, signature, secret) {
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(JSON.stringify(payload))
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expectedSignature)
);
}
// Express.js middleware
app.post('/api/webhooks/screenshot', (req, res) => {
const signature = req.headers['x-webhook-signature'];
const payload = req.body;
if (!verifyWebhookSignature(payload, signature, process.env.WEBHOOK_SECRET)) {
return res.status(401).json({ error: 'Invalid signature' });
}
// Process webhook
const { type, data } = payload;
if (type === 'screenshot.completed') {
console.log('Screenshot completed:', data.screenshot.id);
console.log('Download URL:', data.screenshot.download_url);
}
res.status(200).json({ received: true });
});Security Best Practices
idBest Practices
If your endpoint fails to respond with a 2xx status code, we automatically retry:
After 3 failed attempts, the webhook delivery is marked as failed and no further retries occur.
Related Resources