{"slug":"agent402-tools-api-html-select-ef5d06","title":"Run a CSS selector against an HTML string and return the matches (text, attrs, a","host":"agent402.tools","method":"POST","resource":"https://agent402.tools/api/html-select","category":"code","description":"Run a CSS selector against an HTML string and return the matches (text, attrs, and optionally outerHTML for each). The deterministic alternative to regex when you already have the HTML and know the selector - pairs with /api/render or any page you've fetched yourself.","price_listed":0.001,"price_asked":0.001,"state":"answering","state_label":"Answering","checks_7d":1,"answered_7d":1,"latency_ms_median":937,"reported_calls_30d":5,"reported_payers_30d":1,"networks":["algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=","eip155:10","eip155:1329","eip155:137","eip155:143","eip155:42161","eip155:42220","eip155:43114","eip155:4663","eip155:8453","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","stellar:pubnet"],"badge":"unverified","paid_checks_7d":0,"paid_ok_7d":0,"example_input":{"body":{"html":"<html><body><h1>One</h1><h1>Two</h1></body></html>","limit":25,"selector":"h1"},"bodyType":"json","method":"POST","type":"http"},"output_schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","properties":{"input":{"additionalProperties":false,"properties":{"body":{"properties":{"attr":{"description":"When set, return only this attribute's value per match (e.g. \"href\", \"data-id\") - keeps responses compact","type":"string"},"html":{"description":"Raw HTML string to query (max 5MB)","type":"string"},"includeHtml":{"description":"Include outerHTML of each match (default false - text + attrs only)","type":"boolean"},"limit":{"description":"Max matches to return, 1-200 (default 25)","type":"number"},"selector":{"description":"CSS selector (e.g. \"h1\", \".price\", \"article > p:first-of-type\")","type":"string"}},"required":["html","selector"]},"bodyType":{"enum":["json","form-data","text"],"type":"string"},"method":{"enum":["POST"],"type":"string"},"type":{"const":"http","type":"string"}},"required":["type","method","bodyType","body"],"type":"object"},"output":{"properties":{"example":{"properties":{"count":{"type":"integer"},"matches":{"items":{"properties":{"attrs":{"type":"object"},"text":{"type":"string"}},"type":"object"},"type":"array"}},"required":["count","matches"],"type":"object"},"type":{"type":"string"}},"required":["type"],"type":"object"}},"required":["input"],"type":"object"},"history":[{"day":"2026-09-24","reachable":true,"status":402,"valid_402":true,"asked_usdc":0.001,"price_match":true,"latency_ms":937,"error":null}],"description_full":"Run a CSS selector against an HTML string and return the matches (text, attrs, and optionally outerHTML for each). The deterministic alternative to regex when you already have the HTML and know the selector - pairs with /api/render or any page you've fetched yourself.","last_updated":"2026-09-21T11:08:59.343Z","schemes":["exact","upto"]}