Use cURL to capture screenshots from the command line.
curl -X POST https://api.screenshotly.dev/api/v1/screenshots \ -H "screenshotly-api-key: $SCREENSHOTLY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com", "format": "png" }'
{ "status": "processing", "id": "scr_abc123", "message": "Screenshot request accepted and is being processed." }
curl -X POST https://api.screenshotly.dev/api/v1/screenshots \ -H "screenshotly-api-key: $SCREENSHOTLY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com", "format": "jpeg", "fullPage": true, "width": 1440, "height": 900 }'
curl https://api.screenshotly.dev/api/v1/screenshots/scr_abc123 \ -H "screenshotly-api-key: $SCREENSHOTLY_API_KEY"
{ "id": "scr_abc123", "status": "completed", "url": "https://example.com", "screenshotUrl": "https://api.screenshotly.dev/api/v1/screenshots/scr_abc123.png", "format": "png", "requestedAt": "2025-05-14T10:00:00Z", "completedAt": "2025-05-14T10:00:03Z" }
curl -X POST https://api.screenshotly.dev/api/v1/screenshots \ -H "screenshotly-api-key: $SCREENSHOTLY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com", "width": 390, "height": 844, "deviceScaleFactor": 3, "isMobile": true, "hasTouch": true }'
export SCREENSHOTLY_API_KEY="your-api-key-here"
#!/bin/bash # screenshot.sh - capture a screenshot of a URL URL="${1:?Usage: screenshot.sh <url>}" curl -s -X POST https://api.screenshotly.dev/api/v1/screenshots \ -H "screenshotly-api-key: $SCREENSHOTLY_API_KEY" \ -H "Content-Type: application/json" \ -d "{\"url\": \"$URL\", \"format\": \"png\"}" | jq .
chmod +x screenshot.sh ./screenshot.sh https://example.com