Skip to content
looot docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Context API / Scrape Images

Context.dev tool context-dev-web-scrape-images on looot: input fields, $0.0125 per call, output shape, and code to run it with curl, JavaScript or Python.

Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit, or 2 credits with browser actions. When enrichment is enabled, the entire call costs 5 credits, including requests that also use actions.

  • Tool id: context-dev-web-scrape-images
  • Provider: Context.dev
  • Job: Images web scrape (web.scrape.images)
  • Price: $0.0125 per call. A call that fails at the provider costs $0.

Inputs

Name Type Required Description
actions string no Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions.
dedupe boolean no When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false.
enrichment string no Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true.
headers string no 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.
maxAgeMs string no Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days).
tags array no Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters.
timeoutMS integer no 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).
url string yes Page URL to inspect. Must include http:// or https://. Example: “https://www.example.com”
waitForMs string no Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds).

Output

Shape of the run’s result, checked against 1 real answer:

{ url, images: unknown[], success, request_id, key_metadata: { credits_consumed, credits_remaining }, finalDOMState, cache_metadata: { age_ms, status } }

Run it

Every call needs your API token in LOOOT_TOKEN; Sign in shows how to get one. Each run also needs a new idempotency key, so a retry never pays twice. With wait: 30 the answer comes back inline when the run ends within 30 seconds. Otherwise you get the running run back: poll GET /v1/runs/<runId>.

Example input with placeholder values:

curl -X POST "https://api.looot.ai/v1/runs" \
  -H "Authorization: Bearer $LOOOT_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"endpointId":"context-dev-web-scrape-images","input":{"url":"https://www.example.com","tags":["production","team-alpha"]},"wait":30}'
const response = await fetch("https://api.looot.ai/v1/runs", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LOOOT_TOKEN}`,
    "Content-Type": "application/json",
    "Idempotency-Key": crypto.randomUUID(),
  },
  body: JSON.stringify({
    endpointId: "context-dev-web-scrape-images",
    input: {
      url: "https://www.example.com",
      tags: ["production", "team-alpha"],
    },
    wait: 30,
  }),
});
const run = await response.json();
console.log(run.status, run.result);
import os
import uuid

import requests

response = requests.post(
    "https://api.looot.ai/v1/runs",
    headers={
        "Authorization": f"Bearer {os.environ['LOOOT_TOKEN']}",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "endpointId": "context-dev-web-scrape-images",
        "input": {
            "url": "https://www.example.com",
            "tags": ["production", "team-alpha"],
        },
        "wait": 30,
    },
    timeout=90,
)
run = response.json()
print(run["status"], run.get("result"))

To let looot pick among every provider of this job instead, send job:web.scrape.images as endpointId; see the job page.

Was this page helpful?