Async and Webhooks
Learn how to use webhooks for asynchronous screenshot processing
Asynchronous Processing with Webhooks
The Screenshots API supports webhook callbacks for asynchronous screenshot processing. This is particularly useful for:
- Long-running captures (full page, high resolution)
- Bulk screenshot operations
- Integration with your existing systems
How Webhooks Work
- You make a request to the API with a
webhook
URL - The API immediately acknowledges your request
- The screenshot is processed in the background
- When complete, the API calls your webhook URL with the results
Setting Up a Webhook
Here's how to use webhooks in your application:
Webhook Payload
When your webhook is called, you'll receive a JSON payload with the following structure:
If there's an error, you'll receive:
Best Practices
- Secure Your Webhook: Use HTTPS and validate incoming requests
- Handle Retries: The API will retry failed webhook calls
- Process Quickly: Respond to webhooks within 5 seconds
- Log Everything: Keep records of all webhook events
- Monitor Status: Track the status of your screenshot requests
Common Use Cases
- Bulk Processing: Capture multiple screenshots asynchronously
- High-Resolution Captures: Process large screenshots in the background
- Integration: Connect with your existing systems and workflows
- Monitoring: Track the status of your screenshot requests