Home / How-to guides / Safe Fetch

How to fetch pages for AI without hidden text

Fetch a page as clean Markdown for your AI agent, with hidden text and invisible Unicode removed and a prompt-injection risk score.

Open on Apify ↗Actor page

Updated 2026-11-24

The problem

An agent that reads a web page also reads what a visitor never sees: display:none blocks, white-on-white text, HTML comments, invisible Unicode. Instructions aimed at the AI can sit there, and a plain fetch step passes all of it through.

Steps

  1. Open the Actor on Apify. Create a free Apify account if you do not have one. Every account gets free monthly credit, enough to try this on real data. Safe Fetch ↗
  2. Fill in the input. The input is a small JSON. These are the first fields and example values:
input.json
{
  "urls": [
    "https://example.com/"
  ],
  "respectRobots": true,
  "includeFindings": true
}
  1. Run it. Press Start in the console, or call it from the API, a schedule, n8n, Make or Zapier. See the run guide for code you can copy. Run guide (API, n8n, Make, MCP)
  2. Take the results. Open the Output tab to preview the dataset and download it as JSON, CSV or Excel. Through the API you read the same dataset items.

A tip for this Actor

Turn on includeFindings and read riskScore together with the findings. Articles about prompt injection use the same phrases and can be flagged as medium risk, and external stylesheets are not evaluated. The score is a signal to review, not a guarantee either way.

Input fields

FieldTypeDescription
urlsarrayPublic http(s) pages to fetch.
respectRobotsbooleanSkip URLs disallowed by the site's robots.txt for this crawler.
includeFindingsbooleanReturn the list of suspicious fragments with the reason (hiding technique) and matched phrase types.
maxCharsnumberTruncate the Markdown to this many characters. 0 means no limit.

Real output sample

First item of 5 from a real run, shortened for display. The full sample is a download on the Actor page.

safe-fetch.json
{
  "type": "page",
  "url": "https://example.com/",
  "fetchedAt": "2026-11-25T05:16:42.748Z",
  "finalUrl": "https://example.com/",
  "httpStatus": 200,
  "status": "ok",
  "blocked": false,
  "title": "Example Domain",
  "riskScore": 0,
  "riskLevel": "none",
  "findingsCount": 0,
  "hiddenTextRemoved": 0,
  "invisibleUnicodeRemoved": 0,
  "markdown": "This domain is for use in documentation examples without needing permission. This is not a service; avoid r…",
  "chars": 156,
  "truncated": false,
  "findings": []
}

What it costs

Pay per event: page is charged $0.01 each. Apify platform usage is billed separately and is usually a few cents per run.

ResultsResult events
100$0.80
1,000$8
10,000$80
100,000$800

Limits you should know

  • It does not guarantee a page is safe: it catches common hiding techniques and instruction-like phrases. Treat the score as a signal, not a guarantee.
  • It does not run JavaScript, so pages that render client-side may return little text.
  • Sites with anti-bot protection are returned as blocked: the Actor does not bypass them and uses no proxies.
  • Articles that discuss prompt injection contain the same phrases and can be flagged as medium risk.

Questions

Does it guarantee a page is safe?

No. It catches common hiding techniques and instruction-like phrases. New techniques appear constantly; treat the score as a signal, not a guarantee, and keep least-privilege on your agents.

Why are some quoted phrases flagged?

Articles that discuss prompt injection contain the same phrases. Those are reported as visible-injection-phrase (medium) and kept in the text unless redactVisible is on.

What about sites with anti-bot protection?

They are returned as blocked. The Actor does not bypass protections and uses no proxies. It also does not run JavaScript, so pages that render client-side may return little text.

Rate it on Apify

Used it? A rating or review on Apify helps other people judge it, and tells us what to fix.

Rate it on Apify ↗

More guides