Response Formats

RenderScreenshot returns screenshots in various formats based on your request parameters.

Image Formats

PNG (Default)

Content-Type: image/png

PNG is the default format. It's lossless and supports transparency.

{
  "url": "https://example.com",
  "output": {
    "format": "png"
  }
}

JPEG

Content-Type: image/jpeg

JPEG produces smaller files but doesn't support transparency.

{
  "output": {
    "format": "jpeg",
    "quality": 85
  }
}

WebP

Content-Type: image/webp

WebP offers the best compression with quality comparable to PNG.

{
  "output": {
    "format": "webp",
    "quality": 90
  }
}

PDF Output

Content-Type: application/pdf

Generate PDF documents from web pages:

{
  "url": "https://example.com",
  "output": {
    "format": "pdf"
  }
}

JSON Metadata

To get JSON with the CDN URL instead of the image bytes, send the same POST /v1/screenshot request with the header Accept: application/json:

curl -X POST https://api.renderscreenshot.com/v1/screenshot \
  -H "Authorization: Bearer $RS_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"url": "https://example.com"}'

Response:

{
  "id": "req_1a2b3c4d5e6f7a8b",
  "status": "completed",
  "image": {
    "url": "https://cdn.renderscreenshot.com/...",
    "width": 1200,
    "height": 630,
    "size": 245632,
    "format": "png"
  },
  "metadata": {
    "title": "Example Domain",
    "description": "This is an example website",
    "favicon": "https://example.com/favicon.ico"
  },
  "cache": {
    "hit": false,
    "key": "...",
    "url": "https://cdn.renderscreenshot.com/...",
    "expires_at": "2025-01-16T10:30:00Z"
  },
  "usage": {
    "credits": 1,
    "remaining": 99
  }
}

The request still renders a screenshot and costs the same credits as a binary response.

See Also

Was this page helpful?