Install
openclaw skills install snapshot-to-apiDiscover hidden APIs behind web pages and replace expensive browser snapshots with lightweight API calls. Saves ~15-20x tokens and 2x speed on browser automation tasks. **Use when:** (1) You just completed a browser snapshot workflow and want to optimize it (2) User asks to "find the API" or "make this faster" for a browser task (3) A snapshot is too large, truncated, or unreliable (4) You need structured data from a web page (tables, lists, details) (5) User mentions "api discovery", "snapshot to api", "browser optimization"
openclaw skills install snapshot-to-apiReplace browser snapshots with direct API calls. 15-20x fewer tokens, 2x faster, 100% complete data.
Browser snapshots return the full DOM tree — menus, buttons, refs, styling — when you only need the data. A typical table page: 45 KB DOM → ~15k tokens, ~15% useful. The same data via API: 3.5 KB JSON → ~1k tokens, ~90% useful.
browser(action=open, url="<target_url>", profile=openclaw)
Purpose: establish cookie/session auth. You don't need to read the page.
// Evaluate in the browser tab
() => {
const entries = performance.getEntriesByType('resource')
.filter(e => e.name.includes(window.location.hostname) &&
!e.name.match(/\.(js|css|png|jpg|webp|svg|woff|ttf)(\?|$)/))
.map(e => e.name);
return JSON.stringify(entries, null, 2);
}
This returns all API calls the page made during loading — the data sources behind the UI.
Look for URLs containing:
/api/, /v2/, /v3/schema, table, list, detail, query, search)GET endpoints with query params like id=, name=, type=Ignore: analytics, tracking, user-info, config, SDK URLs.
// Replace <API_PATH> with the path from Step 3
() => {
return fetch('<API_PATH>')
.then(r => r.json())
.then(data => {
// Inspect the structure
const keys = Object.keys(data?.data || data || {});
return JSON.stringify({
topLevelKeys: keys,
sample: JSON.stringify(data).substring(0, 1000)
});
});
}
Once you understand the response shape, write a focused extractor:
() => {
return fetch('<API_PATH>')
.then(r => r.json())
.then(data => {
// Extract only what you need — return clean JSON
return JSON.stringify({ /* structured result */ });
});
}
browser(action=close, targetId="<targetId>")
Many APIs need specific parameters to return full data. Common pattern:
Different environments (regions, clusters, staging/prod) may have:
app.example.com vs app-eu.example.com)/api/v2/ vs /api_eu/v2/)@0 vs @10)Always test each environment separately.
See references/comparison.md for detailed benchmark data (token counts, timing, completeness).