Website screenshot
POST https://tools.yukai.uk/api/v1/screenshot
Screenshot a web page. Returns the image bytes by default (response=image), or JSON with the image as base64 (response=json).
Cost
Credits: 9 ($0.0009) per successful call. Failed calls are free. Source price: website-screenshot-pdf-markdown/screenshot.
Input
Send a JSON body (POST) or the same fields as a query string (GET).
Required: url.
| Field | Type | Default | Description |
|---|---|---|---|
url required | string | Page URL. A bare domain such as example.com is accepted (https is assumed). Private, local and cloud-metadata addresses are refused. | |
format | string | "png" | Image format. |
width | integer | 1280 | Viewport width (CSS px). |
height | integer | 800 | Viewport height (CSS px). |
fullPage | boolean | false | Capture the whole scrollable page. |
maxHeight | integer | 8000 | Full-page captures are cut at this height (CSS px); truncated tells you when. |
quality | integer | 80 | JPEG/WebP quality. |
scale | integer | 1 | Device scale factor (2 = retina). |
selector | string | Capture only the first element matching this CSS selector. | |
response | string | "image" | image returns the bytes; json returns metadata plus base64. |
device | string | "custom" | Viewport preset. custom uses width/height. |
waitUntil | string | "networkidle2" | When the page counts as loaded. |
timeoutMs | integer | 20000 | Page-load timeout in milliseconds. |
delayMs | integer | 0 | Extra wait after load (animations, late content). |
darkMode | boolean | false | Emulate prefers-color-scheme: dark. |
hideCookieBanners | boolean | true | Remove common cookie/consent banners before capturing. |
blockAds | boolean | false | Block common ad, analytics and tracking hosts. |
lazyLoad | boolean | false | Scroll through the page first so lazy-loaded images appear. |
waitForSelector | string | Wait for this CSS selector before capturing (captures anyway on timeout). | |
hideSelectors | string | Comma-separated CSS selectors removed before capturing. |
Examples
Replace tt_live_XXXX with your key from the pricing page.
curl
curl -i -X POST "https://tools.yukai.uk/api/v1/screenshot" \
-H "Authorization: Bearer tt_live_XXXX" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","response":"json"}'JavaScript (fetch)
const res = await fetch("https://tools.yukai.uk/api/v1/screenshot", {
method: "POST",
headers: { "Authorization": "Bearer tt_live_XXXX", "Content-Type": "application/json" },
body: JSON.stringify({"url":"https://example.com","response":"json"}),
});
console.log(res.status, res.headers.get("x-credits-charged"), res.headers.get("x-credits-balance"));
console.log(await res.json());Python (requests)
import requests
r = requests.post(
"https://tools.yukai.uk/api/v1/screenshot",
headers={"Authorization": "Bearer tt_live_XXXX"},
json={"url": "https://example.com", "response": "json"},
timeout=120,
)
print(r.status_code, r.headers.get("x-credits-charged"), r.headers.get("x-credits-balance"))
print(r.json())
Response
JSON with "success": true and the result fields; on failure {"success": false, "error": {"code", "message", "retryable"}} and no credits are used. Every answer carries x-credits-charged (credits used) and x-credits-balance (balance after the call); check the balance any time with GET https://tools.yukai.uk/v1/billing/balance.
Full field list and response schema: OpenAPI spec website-screenshot (its servers entry is the marketplace gateway; call https://tools.yukai.uk with your key).