Docs
Dashboard
API reference / WebBeta

Screenshot a page

Screenshot a page.

POST/v1/screenshot

Request

Method and pathPOST/v1/screenshot
Base URLhttps://api.boxline.dev
AuthenticationYour API key in the x-api-key header (or Authorization: Bearer). The examples read it from BOXLINE_API_KEY.
Rate limitYes. See Rate limits for the numbers and headers.

Body

JSON with content-type: application/json. Required.

NameTypeDefaultAllowed valuesDescription
urlrequiredstring––An http(s) URL.
proxyboolean | null | object | object[]––true = a residential US proxy; an object = one proxy; a list = rules by site (at most 10); null or false = none.
proxy.typerequiredstring–residential, datacenter, custom
proxy.countrystring––Two-letter country code (residential and datacenter).
proxy.statestring––Residential, US states, e.g. us_california (implies US).
proxy.citystring––Residential, e.g. los_angeles (needs country).
proxy.ipstring–sticky, rotatingDefault sticky for sessions and crawls, rotating for fetch, screenshot, pdf and extract.
proxy.scopestringbrowserbrowser, allall also routes the session's shell.
proxy.serverstring––custom: your proxy, http://host:port or https://host:port, on a public address.
proxy.usernamestring––
proxy.passwordstring––Stored encrypted; never returned.
proxy[].domainPatternstring––Up to 256 characters.
browserboolean | object––true or omitted: a browser with the defaults; false: none; an object: a browser with these settings.
browser.modestringstandardstandard, realisticrealistic puts the clock and language on the proxy's country. It never changes what the browser reports about itself.
browser.localestring––BCP 47, e.g. de-DE. Wins over the mode.
browser.timezonestring––IANA, e.g. Europe/Berlin. Wins over the mode.
blockAdsbooleanfalse–Refuse requests to ad and tracker sites inside the machine (its local proxy), with or without a session proxy. Blocked requests are counted in blockedRequests and reported in lifecycle events.
waitUntilstringloadload, domcontentloaded, networkidle, commit
timeoutMsinteger––
delayMsinteger––Extra wait after the page loads. From 0 to 10000.
viewportobject––
viewport.widthinteger––
viewport.heightinteger––
fullPagebooleanfalse–
formatstringpngpng, jpeg
qualityinteger80–JPEG only. From 1 to 100.
selectorstring––Only this element.
curl -X POST "https://api.boxline.dev/v1/screenshot" \  -H "x-api-key: $BOXLINE_API_KEY" \  -H "content-type: application/json" \  -d '{"url":"https://example.com","fullPage":true}' \  -o page.png

Responses

200 OK

The image.

  • image/png: An image (image/png).
  • image/jpeg: An image (image/jpeg).

Headers

  • x-final-url: The page's URL after redirects (URI-encoded).
  • x-page-status: The page's HTTP status (empty when unknown).
  • x-page-title: The page's title, URI-encoded, at most 200 characters.
  • x-page-captcha: A CAPTCHA kind waiting for a person on the page, or empty.
  • x-render-ms: How long rendering took (ms).
  • RateLimit-Limit: Requests allowed in the current window of this route's limit. (Rate limits)
  • RateLimit-Remaining: Requests left in the current window. (Rate limits)
  • RateLimit-Reset: Seconds until the window starts again. (Rate limits)
Response 200
An image (image/png)An image (image/jpeg)

Errors

Errors have a matching HTTP status and the same body. code is stable, so check it in your code; message is for people. See Errors and request ids.

StatusCodesWhen
400 Bad Requestinvalid_request, invalid_json, invalid_cursor, invalid_idempotency_key, invalid_extension, variables_with_extensions, terms_not_accepted, invalid_reset_token, invalid_confirmation_code, wrong_password, no_password, invalid_next, invalid_oauth_tokenThe request is not valid.
401 UnauthorizedunauthorizedMissing or invalid API key.
402 Payment Requiredfeature_not_in_plan, spend_limit, out_of_credit, plan_limit, spend_limit, out_of_credit, organization, project, plan, creditThe plan does not include this, a monthly allowance or spending limit is used up, the organization has no credit left, or the plan allows no more of this. spend_limit and out_of_credit carry error.details.limit: organization, project, plan or credit.
429 Too Many Requestsrate_limited, concurrency_limitToo many requests, or the organization's concurrent sessions (its plan's) or the project's concurrencyCap are in use.
502 Bad Gatewaymachine_error, machine_unreachable, page_unreachableThe session machine failed or could not be reached, or, for fetch, screenshot, pdf and extract, the page could not be loaded.
503 Service Unavailableno_capacity, proxy_unavailable, provider_unavailable, search_unavailable, webhooks_unavailable, mail_unavailable, browser_unreachableNo machine free in time, proxies not set up, the model provider is not configured or has no key, or web search is not set up or its provider is not answering, or webhook delivery is not set up, or an email cannot be sent, or the session's browser did not answer in time.
504 page_timeoutThe page did not finish loading within timeoutMs.
Error body
{  "error": {    "code": "not_found",    "message": "session not found",    "requestId": "req_4fJx0aQm2Lk9Pz7N"  }}

Learn more

These docs describe a beta API. Endpoints, fields and SDK methods may change before general availability; breaking changes will be listed in the changelog.