Skip to content

Page images (galleries included)

$0.01 per callUSDC via x402POST /api/page-images

List every image on a public web page, with sliders and lightbox galleries...

Category: Web & documentsTags: images photos gallery slider carousel lightbox srcset alt-textAlso found as: image-urls extract-images gallery-images page-photos

Try in playground →

Details

List every image on a public web page, with sliders and lightbox galleries: the page is loaded in headless Chromium and each image comes back with its largest srcset URL, alt text, size in pixels where known, and position on the page. "Next" buttons and "view photos" buttons are clicked (up to 40 clicks), and a gallery's own list in the page is read. minWidth leaves out icons and logos narrower than that; an image of unknown width is kept. includeText: true adds the page's visible text with its headings. notReached says what was left out (an endless gallery, an embedded frame) and complete is true when nothing was. Up to 200 images. robots.txt is honored. Addresses only: no image is stored or returned. Deterministic code, no model; to ask what a photo shows, send the URLs to image-describe.

Parameters

NameTypeRequiredDescription
urlstringyesPublic http(s) URL of the page Also accepted as link, uri, href, page.
minWidthintegernoLeave out images known to be narrower than this many pixels (default 0) The example sends 200.
includeTextbooleannotrue adds the page's visible text, headings marked with # (default false)

Example request

curl -i -X POST https://agent402.tools/api/page-images \
  -H "Content-Type: application/json" \
  -d '{"url":"https://agent402.tools/fixtures/sample-rooms.html","minWidth":200}'

Watch a call get paid

RequestPOST /api/page-images
402$0.01 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "url": "https://agent402.tools/fixtures/sample-rooms.html",
  "finalUrl": "https://agent402.tools/fixtures/sample-rooms.html",
  "title": "Sample rooms",
  "images": [
    {
      "url": "https://agent402.tools/fixtures/sample-kitchen.png",
      "alt": "Garden Studio kitchen",
      "width": 800,
      "height": 500,
      "position": {
        "x": 8,
        "y": 166,
        "width": 400,
        "height": 250
      },
      "inGallery": true,
      "foundIn": "img"
    },
    {
      "url": "https://agent402.tools/fixtures/sample-bedroom.png",
      "alt": "Harbor Suite bedroom",
      "width": 800,
      "height": 500,
      "position": {
        "x": 8,
        "y": 522,
        "width": 400,
        "height": 250
      },
      "inGallery": true,
      "foundIn": "img"
    }
  ],
  "imagesPartial": {
    "returned": 2,
    "matched": 2,
    "complete": true,
    "truncated": false
  },
  "gallery": {
    "controls": 0,
    "clicks": 0,
    "stopped": "none found"
  },
  "notReached": [],
  "complete": true,
  "untrustedContent": true
}
FieldTypeAlways presentIn the example
urlstringyeshttps://agent402.tools/fixtures/sample-rooms.html
finalUrlstringyeshttps://agent402.tools/fixtures/sample-rooms.html
titlestringyesSample rooms
imagesarray of objectsyes2 items in the example
imagesPartialobjectyes4 fields: returned, matched, complete, truncated
galleryobjectyes3 fields: controls, clicks, stopped
notReachedarrayyes0 items in the example
completebooleanyestrue
untrustedContentbooleanyestrue
textstringnoThe page's visible text, headings marked with #: present when includeText is true

From an MCP client

catalog.call {
  "slug": "page-images",
  "params": {
    "url": "https://agent402.tools/fixtures/sample-rooms.html",
    "minWidth": 200
  }
}

Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.21.0): pays from a wallet or AGENT402_CREDITS_KEY.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.01" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/page-images", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "https://agent402.tools/fixtures/sample-rooms.html",
    "minWidth": 200
  }),
});

Get a wallet or run npx -y agent402-mcp@0.21.0 wallet new.

The quote (Python)

import base64, json, urllib.error, urllib.request

req = urllib.request.Request("https://agent402.tools/api/page-images", method="POST", data="{\"url\":\"https://agent402.tools/fixtures/sample-rooms.html\",\"minWidth\":200}".encode(), headers={"Content-Type": "application/json"})
try:
    urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
    quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
    print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]])  # the price, per chain, in base units

Part of these workflows

Related tools