Skip to main content
GET
/
web
/
scrape
/
images
JavaScript
import ContextDev from 'context.dev';

const client = new ContextDev({
  apiKey: process.env['CONTEXT_DEV_API_KEY'], // This is the default and can be omitted
});

const response = await client.web.webScrapeImages({ url: 'https://example.com' });

console.log(response.images);
{
  "images": [
    {
      "src": "<string>",
      "alt": "<string>",
      "enrichment": {
        "width": 123,
        "height": 123,
        "mimetype": "<string>",
        "url": "<string>"
      }
    }
  ],
  "url": "<string>"
}
1 Credit Enriched: 5 Credits

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

url
string<uri>
required

Page URL to inspect. Must include http:// or https://.

maxAgeMs
integer
default:86400000

Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days).

Required range: 0 <= x <= 2592000000
enrichment
object

Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true.

waitForMs
integer

Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds).

Required range: 0 <= x <= 30000
headers
object

Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache.

timeoutMS
integer

Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes).

Required range: 1000 <= x <= 300000

Response

Successful response

success
enum<boolean>
required

Always true on success.

Available options:
true
images
object[]
required

Images found on the page.

url
string
required

Page URL that was scraped.