AI agents read your pages differently from people. They want facts, not stories. So some sites try to serve them a different version. That can be fine. It can also be cloaking. The difference is what you change, and why.
This guide shows three safe ways to give agents structured data. It also shows where the risk starts, using Google’s spam policy and the HTTP standard.
If you only do one thing
Keep the facts identical for every visitor. Change only the format. Then test the page the way Googlebot sees it.
Table of Contents
ToggleWhere does cloaking start?
Google defines cloaking as presenting different content to users and search engines [1]. Its example: a page about travel for search engines and a page about discount drugs for users. It also treats adding keywords only when the visitor is a search engine as cloaking [1].
Google’s policy does not say that every difference by user agent is cloaking. It also does not describe formats for AI agents. So we cannot say that a JSON version for agents is approved or banned. What we can say is that a page that tells a crawler one thing and a person another is the risky pattern.
Watch out: Prices, availability, legal terms and warnings must match in every version. If an agent sees a different price from a person, you have a trust problem, whatever the policy says.
Read the workflow as text
- The rule. Same facts for every visitor. Change only the format.
- Question 1: do agents need more than the page says? If no, keep one page and add JSON-LD next to the visible text. One URL, one source of truth.
- If yes, question 2: can every version come from one source? If no, fix the source first. Do not ship two hand-edited versions.
- If yes: one URL or two? On one URL, negotiate on the Accept header and send a Vary header. On two URLs, link them with rel="alternate".
- Never show agents different prices, terms or warnings, choose by user-agent name alone, or point rel=canonical at the JSON.
What are three safe ways to serve agents?
| Method | How it works | Main risk |
|---|---|---|
| Structured data in the same page | Add JSON-LD next to the visible text. One URL, one source of truth. | The data can drift away from the visible text. Check it on every edit. |
| Content negotiation on one URL | The server picks a format based on the Accept header, for example HTML or JSON [2] | Caches can serve the wrong version if you forget Vary [2] |
| Separate URL for each format | For example a JSON file or feed next to the page. Link them with rel="alternate" [3] | Two places to keep in sync. Content drifts. |
For most sites, the first method is enough. It adds no new URL and no detection logic.
What does drift look like?
The risk with a second version is that the facts drift apart. Here is a made-up example.
Visible text on the page (example)
Plan: Standard
Price: [amount shown to visitors] per month
Cancel: any timeFails: the agent version has a different price (example)
{ "plan": "Standard", "price": "[a different amount]", "cancel": "any time" }Passes: both generated from one record (example)
record = { plan: "Standard", price: "[amount]", cancel: "any time" }
visible text <- built from record
agent version <- built from recordPaste both into the comparer below and it will show the difference in the numbers.
How does content negotiation work, and what can go wrong?
Content negotiation lets one URL return different representations, such as another language or file type. In the usual server-driven form, the client sends headers like Accept and the server chooses [2]. The server sends a Vary header to say which request headers it used. Caches need that to store the right copy [2].
MDN lists real drawbacks. The server does not fully know what the client can handle. Shared caches work less well. More headers also mean more fingerprinting risk [2]. MDN also calls choosing by User-Agent a bad practice for features, though some uses are fine [2].
So prefer the Accept header over guessing from a user-agent name. It says what the client asked for. A user-agent name only says who it claims to be.
What about canonical tags?
Do not use rel="canonical" to point at other formats. Google ignores canonical links that carry attributes such as type or hreflang. For other versions of a page, it says to use rel="alternate" instead [3]. For the same content at different URLs, choose one preferred URL and signal it with a redirect or a canonical link [3].
How do you test for safety?
- Compare the facts. Request the page as a browser and as an agent. Check every price, date, spec and warning matches.
- Check what Googlebot gets. Use the URL Inspection tool’s live test in Search Console and read the rendered page.
- Check your CDN. Firewalls sometimes treat bots differently from what you intended.
- Set one source of truth. Generate every version from the same data, so they cannot drift.
Our technical SEO fundamentals guide covers the wider crawl and index checks.
Worth knowing: We rewrote this article in November 2026. The earlier version quoted statistics attributed to Gartner and SEMrush, a quote attributed to MDN, and called user-agent switching “SEO-safe”. We could not verify those claims, so we removed them.
From our own site: On 8 November 2026 we requested one of our own pages twice, once with
Accept: text/htmland once withAccept: application/json. Both returned HTTP 200, and theVaryheader listed onlyAccept-Encoding. So aiseojournal.net does not negotiate content by Accept. It serves everyone the same page. On 9 November 2026 we repeated the test and added user-agent names, from one ordinary internet address. The Chrome-style name,OAI-SearchBot,ClaudeBotandPerplexityBoteach got HTTP 200 and a page of about 269 KB. TheGooglebotandbingbotnames got HTTP 403. TheGPTBotname got HTTP 429 in two separate runs. Our robots.txt allows all crawlers, so those blocks come from the server or its firewall, not from robots.txt. A fake Googlebot name is not real Googlebot, so this does not show what Google receives. Use URL Inspection for that [4]. It does show that the server treats user-agent names differently.
How do you check what real Googlebot gets?
Do not test with a fake user-agent name. Anyone can send one. Google says to verify that a request really comes from Google by a reverse DNS lookup and a forward lookup, or by checking the IP against its published ranges [5].
- Use the URL Inspection tool. Enter the full URL and choose Test live URL. Then View tested page to see the screenshot, the HTML and the HTTP headers. The tool also has a daily limit per property [4].
- Compare that HTML with what a browser gets. Use the comparer below.
- Check your logs for real Googlebot requests, verified by DNS or IP range [5], and compare the responses.
- Check your firewall and CDN rules. Our own test below shows why.
What about paywalled pages?
Google says a paywall is not cloaking if Google can see the full gated content, as a person with access would, and the site follows Google’s Flexible Sampling guidance [1]. Check that guidance before you gate anything.
Paste the visible text of a page, then the version you serve to agents, such as the JSON values. The tool lists numbers, amounts and words that appear in only one version. It compares the text you paste. It does not fetch pages, test what Googlebot sees or judge intent, and it stores nothing. Nothing leaves this page.
Frequently asked questions
Is serving JSON to AI agents cloaking?
Google defines cloaking as presenting different content to users and search engines. It does not rule on formats for AI agents. Keep the facts identical and change only the format, and test what Googlebot sees.
Should I detect agents by user-agent string?
Prefer the Accept header. MDN calls user-agent sniffing for features a bad practice. A user-agent string is easy to fake and changes often.
Do I need a Vary header?
Yes, if one URL returns different formats. It tells caches which request headers decided the response.
Can I use rel=canonical to link to the JSON version?
No. Google ignores canonical links with attributes like type. Use rel=alternate for other versions.
What is the simplest safe option?
Put structured data in the same page and generate it from the same source as the visible text.
How do I know a request really comes from Googlebot?
Do not trust the user-agent name. Google says to verify with a reverse DNS lookup followed by a forward lookup, or to match the IP address against its published ranges.
Is a paywall cloaking?
Google says it is not, if Google can see the full gated content as a person with access would, and the site follows its Flexible Sampling guidance.
What should you do next?
Pick one method. For most sites that is structured data inside the page. Then test it with a normal browser request, an agent-style request and the URL Inspection tool. Our technical SEO fundamentals guide has the wider crawl checks.
Sources
- Google Search Central — Spam policies for Google web search (cloaking)
- MDN — Content negotiation
- Google Search Central — Consolidate duplicate URLs
- Google Search Console Help — URL Inspection tool (checked 9 November 2026)
- Google Search Central — Verify requests from Google crawlers and fetchers (checked 9 November 2026)







