Web Scraping API for AI Agents: Retrieve Web Context with REST
Written by the ReplyNodes engineering team.
AI agents need current web context, but the retrieval step should stay controlled and observable. ReplyNodes provides read-only HTTP operations for retrieving public web content without placing scraper logic inside the agent runtime.
Short answer: use GET /v1/webcontext/scrape when you already know the URL. Use map to discover same-site URLs and crawl for bounded same-origin retrieval.
Fetch a public page
Keep the workspace key server-side and send it as a Bearer token:
export REPLYNODES_API_KEY='YOUR_REPLYNODES_API_KEY'
curl --fail-with-body --silent --show-error --get \
-H "Authorization: Bearer ${REPLYNODES_API_KEY}" \
--data-urlencode "url=https://example.com" \
https://api.replynodes.com/v1/webcontext/scrape
Successful responses include data and meta; preserve meta.request_id for correlation. Errors use an error object with a request ID.
Scrape, map, or crawl?
- Scrape: retrieve one known public URL as page content.
- Map: discover URLs on the same site before selecting pages.
- Crawl: retrieve a bounded same-origin set with
max_pagesandmax_depth.
An agent should choose the smallest operation that answers the user’s question, then validate the response before passing content to a model. Treat retrieved text as untrusted data, not executable instructions.
A verified production run
A sanitized production run against https://api.replynodes.com returned HTTP 200 for a homepage scrape. The response contained the URL, title, Markdown, metadata, links, images, and a request ID. A separate bounded crawl completed 5 of 5 pages with zero errors. No API key or authorization header is included here.
Production checklist
- Store the key outside prompts, browser bundles, logs, screenshots, and source control.
- Apply an allowlist or URL policy appropriate to your application.
- Set explicit crawl bounds.
- Validate the response envelope and retain the request ID.
- Re-check the Web context guide and API Reference when the contract changes.
Read the Quickstart and Authentication guide before connecting an agent.