Async & webhooks

For slow captures or fire-and-forget workflows, use POST /screenshot/async. It accepts the job and returns immediately; when the screenshot is ready the result is delivered to your webhookUrl.

Request

curl -X POST https://screenshotforweb.com/api/v1/screenshot/async \
  -H "X-API-Key: sk_live_your_key" -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com",
    "format": "png",
    "webhookUrl": "https://you.com/hook",
    "webhookSecret": "whsec_..."
  }'
// -> 202 { "data": { "jobId": "job_...", "status": "queued" } }

Webhook payload

Your endpoint receives a POST when the job finishes. If you set webhookSecret, verify the X-Webhook-Signature: sha256=… header (HMAC-SHA256 of the raw body).

{
  "jobId": "job_...",
  "status": "completed",
  "data": {
    "signedUrl": "https://storage.googleapis.com/...",
    "downloadUrl": "/api/v1/assets/screenshot/...",
    "metadata": { "format": "png", "sizeBytes": 17544, "capturedAt": "..." }
  }
}

On failure

{ "jobId": "job_...", "status": "failed", "error": "..." }