Skip to main content
POST
/
api
/
agent
/
screenshot
Screenshot
curl --request POST \
  --url https://encrata.com/api/agent/screenshot \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "url": "<string>",
  "full_page": true,
  "format": "<string>",
  "selector": "<string>",
  "render_js": true,
  "block_ads": true,
  "block_trackers": true,
  "wait_for": "<string>",
  "timeout": 123,
  "headers": {}
}
'
{
  "success": true,
  "url": "https://example.com",
  "status_code": 200,
  "screenshot": "iVBORw0KGgoAAAANSUhEUgAA...",
  "format": "png",
  "metadata": {
    "title": "Example Domain"
  },
  "credits": 5,
  "latency_ms": 3120
}

Authentication

Requires an API key in the Authorization header.
Authorization: Bearer YOUR_API_KEY

Request

url
string
required
The URL to capture. Must be a valid http:// or https:// URL.
full_page
boolean
Capture the entire scrollable page rather than just the viewport. Default: true.
format
string
Image format — png (default) or jpeg.
selector
string
Optional CSS selector to capture a single element instead of the full page.
render_js
boolean
Render the page in a headless browser before capturing. Default: true.
block_ads
boolean
Block ad networks while loading. Default: true.
block_trackers
boolean
Block tracking scripts while loading. Default: true.
wait_for
string
CSS selector to wait for before capturing (useful for lazy-loaded content).
timeout
integer
Page load timeout in milliseconds. Default: 30000. Maximum: 60000.
headers
object
Optional custom request headers to send with the page load.

Example request

curl -X POST "https://encrata.com/api/agent/screenshot" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "url": "https://example.com", "full_page": true, "format": "png" }'

Response

success
boolean
Whether the screenshot succeeded.
url
string
The final URL that was captured (after redirects).
status_code
integer
HTTP status code returned by the target page.
screenshot
string
The captured image as a base64-encoded data string.
format
string
The image format of the returned screenshot (png or jpeg).
metadata
object
Page metadata such as title and dimensions.
error_code
string
Machine-readable error code when success is false.
error
string
Human-readable error message when success is false.
credits
integer
Credits consumed. 0 on a failed (refunded) capture.
latency_ms
integer
Total processing time in milliseconds.
{
  "success": true,
  "url": "https://example.com",
  "status_code": 200,
  "screenshot": "iVBORw0KGgoAAAANSUhEUgAA...",
  "format": "png",
  "metadata": {
    "title": "Example Domain"
  },
  "credits": 5,
  "latency_ms": 3120
}

Credits

5 credits per request. Failed captures (blocked, captcha, rate-limited) are automatically refunded.