Page images (galleries included)
POST /api/page-imagesList every image on a public web page, with sliders and lightbox galleries...
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
| Name | Type | Required | Description |
|---|---|---|---|
url | string | yes | Public http(s) URL of the page Also accepted as link, uri, href, page. |
minWidth | integer | no | Leave out images known to be narrower than this many pixels (default 0) The example sends 200. |
includeText | boolean | no | true 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
POST /api/page-images$0.01 USDCPAYMENT-SIGNATUREon 14 chains200 OKAgent402-ReceiptEd25519Example 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
}| Field | Type | Always present | In the example |
|---|---|---|---|
url | string | yes | https://agent402.tools/fixtures/sample-rooms.html |
finalUrl | string | yes | https://agent402.tools/fixtures/sample-rooms.html |
title | string | yes | Sample rooms |
images | array of objects | yes | 2 items in the example |
imagesPartial | object | yes | 4 fields: returned, matched, complete, truncated |
gallery | object | yes | 3 fields: controls, clicks, stopped |
notReached | array | yes | 0 items in the example |
complete | boolean | yes | true |
untrustedContent | boolean | yes | true |
text | string | no | The 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
- Pay $0.01 per call over x402 or MPP. Wallet-only: this tool reaches the network or stored state, so it has no proof-of-work tier. A prepaid card-credits key (
Authorization: Bearer a402_...) also pays it. - Required:
url; a rejected input answers 4xx witherror,tool,expected,requiredandexample. - On this route, a call ending in any status of 400 or above is not charged over x402, MPP or a credits key. A Tempo push credential pays before the call; a failure is a refund owed.
- A bodyless
GETorHEADreturns the same 402 quote. - An
Idempotency-Keyreplays the first 200 uncharged (an answer larger than 1 MB is not replayed).
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