Skip to main content
You can call the Screenshotly API directly from the command line using cURL.

Capture a screenshot

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"
  }'
Response:
{
  "status": "processing",
  "id": "scr_abc123",
  "message": "Screenshot request accepted and is being processed."
}

Full-page capture with custom viewport

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
  }'

Check screenshot status

curl https://api.screenshotly.dev/api/v1/screenshots/scr_abc123 \
  -H "screenshotly-api-key: $SCREENSHOTLY_API_KEY"
Response:
{
  "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"
}

Mobile device emulation

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
  }'

Using with a script

Store your API key as an environment variable:
export SCREENSHOTLY_API_KEY="your-api-key-here"
Create a reusable shell script:
#!/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 .
Usage:
chmod +x screenshot.sh
./screenshot.sh https://example.com