Skip to main content
POST
/
browser
/
sessions
/
{id}
/
screenshot
Screenshot
curl --request POST \
  --url https://api.example.com/browser/sessions/{id}/screenshot \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "<string>",
  "fullPage": true,
  "selector": "<string>"
}
'
{
  "image": "<string>",
  "url": "<string>",
  "width": 123,
  "height": 123
}

Overview

Captures a PNG of the session’s active page and returns it base64-encoded. Supports viewport, full-page, and element-bounded capture via a CSS selector.

Path Parameters

id
string
required
Browser session ID (UUID).

Body

url
string
Optional URL to navigate to before capturing.
fullPage
boolean
default:"false"
When true, capture the full scrollable document height instead of just the viewport.
selector
string
CSS selector of an element to capture. Clipped to the element’s bounding box.

Example Request

curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/screenshot" \
  -H "Authorization: Bearer $SCRAPENGINE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'

Response

Success Response (200)

image
string
Base64-encoded PNG bytes.
url
string
Effective URL after any redirects.
width
integer
Screenshot width in pixels.
height
integer
Screenshot height in pixels.
Example Response:
{
  "url": "https://example.com/",
  "image": "iVBORw0KGgoAAAANSUhEUgAA...",
  "width": 1920,
  "height": 1080
}

Error Responses

StatusDescription
400Invalid body — bad selector or unreachable URL.
401Unauthorized — invalid or missing API key.
404Session not found, or selector matched no visible element.
503The browser session is temporarily unreachable.