// api reference

Screenshot API

Capture any web page as a PNG. Run real browser automation first. Click cookie banners, fill logins, wait for content, scroll. Then crop to the exact area you need.

Quick Start

Base URL

https://e.customjs.io/screenshot

Get your API key from app.customjs.space, 600 free requests every month, no credit card.

Authentication

Pass your API key in the x-api-key header. The response is the raw PNG binary, so pipe it to a file.

curl -X POST https://e.customjs.io/screenshot \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{ "input": { "url": "https://example.com" } }' \
  > output.png

Rate Limiting

Every response includes your current usage in the rate-limit headers.

Response HeaderDescription
x-ratelimit-limitMaximum requests allowed in the current window
x-ratelimit-usedRequests used in the current window
x-ratelimit-remainingRequests remaining in the current window

POST /screenshot

Send a URL, get a PNG. The page is rendered in a real Chromium instance. JavaScript, web fonts, and lazy-loaded content all render before capture.

Request body

FieldTypeDescription
input.urlstringRequired. The URL of the page to capture
input.commandsarrayAutomation commands to run before capture (see Automation)
input.boxobjectBounding box for a partial screenshot (see Cropping)

Example. Full page

curl -X POST https://e.customjs.io/screenshot \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "input": {
      "url": "https://example.com",
      "commands": []
    }
  }' \
  > output.png

Automation commands

Pass an array of commands to interact with the page before the shot is taken. They run in order. Dismiss a cookie banner, log in, wait for content, then capture.

Command types

ActionFieldsDescription
clickselectorClick an element (CSS selector or visible text)
typeselector, valueType text into an input. E.g. login fields
waitvalueWait the given number of milliseconds
scrollvalueScroll down by the given number of pixels

Example. Dismiss cookies, then capture

curl -X POST https://e.customjs.io/screenshot \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "input": {
      "url": "https://example.com",
      "commands": [
        { "action": "click", "selector": "#accept-cookies" },
        { "action": "type", "selector": "#email", "value": "[email protected]" },
        { "action": "click", "selector": "button[type=submit]" },
        { "action": "wait", "value": 1000 },
        { "action": "scroll", "value": 500 }
      ]
    }
  }' \
  > output.png

Cropping & viewport

Add a box to capture only part of the page. Perfect for charts, product cards, or social previews. The box is applied only when width and height are greater than 0.

Box fields

FieldTypeDescription
box.xnumberX-coordinate of the top-left corner
box.ynumberY-coordinate of the top-left corner
box.widthnumberWidth of the capture area in pixels
box.heightnumberHeight of the capture area in pixels

Example. Crop to a region

curl -X POST https://e.customjs.io/screenshot \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "input": {
      "url": "https://example.com",
      "box": { "x": 0, "y": 0, "width": 1200, "height": 800 }
    }
  }' \
  > output.png

Response Format

On success the API responds with Content-Type: image/png and the raw PNG bytes in the body. Pipe it to a file or stream it to your storage.

HTTP/1.1 200 OK
Content-Type: image/png
x-ratelimit-limit: 500
x-ratelimit-used: 12
x-ratelimit-remaining: 488

[binary PNG data]

Response Headers

HeaderDescription
Content-Typeimage/png on success
x-ratelimit-limitMaximum requests per window
x-ratelimit-usedRequests used in the current window
x-ratelimit-remainingRequests remaining in the current window

Error Codes

CodeMeaning
200Success. Body contains the PNG binary
400Bad request. Missing or invalid input.url
401Unauthorized. Missing or invalid API key
500Internal error. Capture failed

// try it first

Prefer to play before you code?

Open the interactive playground on the product page. Load any URL, point-and-click your automation steps, draw a crop box, and copy the generated curl or SDK snippet straight into your stack.

screenshot.curl
curl -X POST https://e.customjs.io/screenshot \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "input": {
      "url": "https://stripe.com",
      "commands": [
        { "action": "click", "selector": "Accept all" }
      ]
    }
  }' > shot.png

600 free requests / month ยท no credit card

Frequently Asked Questions