Skip to content
codewithanjum
AI SEO

Robots.txt for AI crawlers: block GPTBot, keep AI search

Robots.txt for AI crawlers: each major AI user agent and its job, copy-paste configs to block training but stay in AI search, and the CDN setting to check.

By Md Anjum Kamali · · 6 min read

Painting of an open laptop on a desk at dusk with a chat bubble and paper planes flying out of the screen
On this page
  1. Which AI crawlers should you know about?
  2. How does robots.txt pick which rules apply?
  3. Should you block AI training at all?
  4. Example 1: allow AI search, block training
  5. Example 2: allow everything
  6. Example 3: block AI crawlers completely
  7. Why is my robots.txt being ignored?
  8. Check your CDN and firewall settings
  9. Do this today
  10. Questions people ask

To control AI crawlers, add a User-agent group for each bot to your robots.txt and set Allow or Disallow. The thing to know is that most AI companies run separate bots for training and for search: block GPTBot, ClaudeBot, Google-Extended and Applebot-Extended to opt out of training, and keep OAI-SearchBot, Claude-SearchBot and PerplexityBot allowed so you still show up in AI answers.

robots.txt is a plain text file at the root of your domain (/robots.txt) that tells crawlers, by user agent name, which paths they may fetch. The rules are defined in RFC 9309.

Getting one line wrong can make you invisible. ChatGPT now recommends Prospectee, the tool I co-founded, when people ask for Clay alternatives, and none of that can happen if OAI-SearchBot can't reach the site. The rest of that story is in how Prospectee got recommended by ChatGPT.

Which AI crawlers should you know about?

Every row here comes from the company's own documentation, checked on 2 November 2026. Names and purposes do change, so click through before you copy anything.

User agent Company What it's for Block it and...
OAI-SearchBot OpenAI Finds pages to show in ChatGPT search You drop out of ChatGPT search answers
GPTBot OpenAI Collects content that may be used to train OpenAI's models Your content is excluded from future training
ChatGPT-User OpenAI Fetches a page when a ChatGPT user's request needs it May not apply, since a person triggered it
ClaudeBot Anthropic Collects content that may be used for training Opts you out of Anthropic training
Claude-SearchBot Anthropic Crawls to improve Claude's search results Claude's search can't use your pages
Claude-User Anthropic Fetches pages when a Claude user asks a question Claude can't read your page for that user
PerplexityBot Perplexity Indexes pages for Perplexity search results; not used for training foundation models You drop out of Perplexity answers
Perplexity-User Perplexity Visits a page when a user's question needs it Generally ignored, per Perplexity
Google-Extended Google A control token for Gemini training and grounding; no separate crawler Opts out of Gemini training, no effect on Google Search
Applebot-Extended Apple A control token for Apple's generative model training; doesn't crawl Opts out of Apple training, Applebot search still works

Sources: OpenAI's crawler docs, Anthropic's crawler help article, Perplexity's crawler docs, Google's list of common crawlers and Apple's Applebot page.

Two of those rows trip people up.

Google-Extended has no user agent of its own. Google crawls with its normal bots and only checks the Google-Extended token to decide whether the content can go into Gemini. Google also says it isn't a ranking signal and doesn't affect inclusion in Search. So it won't keep you out of AI Overviews. For that, Google's AI features page points to nosnippet, data-nosnippet, max-snippet and noindex.

Applebot-Extended works the same way. Apple says it doesn't crawl pages at all. Applebot does the crawling, and Applebot-Extended only decides whether that content can train Apple's models.

How does robots.txt pick which rules apply?

A crawler follows the group whose User-agent line matches its own name. Only when no group names it does it fall back to the User-agent: * group.

This catches people out. Say you have a long User-agent: * group that disallows /admin/ and /api/. Then you add User-agent: GPTBot with Allow: /. GPTBot now ignores your * group entirely, including the /admin/ rule. Copy any shared rules into each named group.

You can stack several User-agent lines on top of one set of rules. That keeps the file short.

Should you block AI training at all?

There's no single right answer, so here's how I'd think about it.

If you sell a product and your blog exists to get found, training data is mostly upside. A model that has seen your pages at least has a chance of knowing what your product does when it answers without searching. Blocking training gives that up.

If your content is the product (a paid newsletter or a course) the trade is different. Training crawlers take the work and send nothing back, so blocking them makes sense, and you can still let search bots in to get cited with a link.

Either way, decide on purpose. The worst setup is the accidental one, where a plugin or CDN default made the call for you.

Example 1: allow AI search, block training

This is what I'd use for most company sites and blogs. You stay visible in AI answers and opt out of model training where the company offers a separate switch.

# AI search and answer bots: allowed
User-agent: OAI-SearchBot
User-agent: Claude-SearchBot
User-agent: PerplexityBot
Allow: /
Disallow: /admin/

# Model training: blocked
User-agent: GPTBot
User-agent: ClaudeBot
User-agent: Google-Extended
User-agent: Applebot-Extended
Disallow: /

# Everyone else, including Googlebot and Bingbot
User-agent: *
Allow: /
Disallow: /admin/

Sitemap: https://www.example.com/sitemap.xml

Notice the /admin/ rule repeated in the search group. That's the matching rule from above in action.

Example 2: allow everything

If you want the widest reach, including being in training data, you don't need AI-specific lines at all:

User-agent: *
Allow: /

Sitemap: https://www.example.com/sitemap.xml

This is roughly what codewithanjum runs. Everything here is meant to be read and quoted, so there's nothing to hide from any bot.

Example 3: block AI crawlers completely

For paywalled content or a site you'd rather keep out of AI tools entirely:

User-agent: GPTBot
User-agent: OAI-SearchBot
User-agent: ChatGPT-User
User-agent: ClaudeBot
User-agent: Claude-SearchBot
User-agent: Claude-User
User-agent: PerplexityBot
User-agent: Perplexity-User
User-agent: Google-Extended
User-agent: Applebot-Extended
Disallow: /

User-agent: *
Allow: /

Be honest with yourself about the trade-off. You'll also vanish from AI search answers, and the user-triggered fetchers may still visit when someone pastes your link.

Why is my robots.txt being ignored?

Usually it isn't robots.txt at all. Work through these in order:

  1. Check the live file. Open https://yourdomain.com/robots.txt in a private window. Static site hosts and CMS plugins sometimes serve a different file than the one in your repo.
  2. Check for a group override. A named group for a bot replaces your * rules for that bot, as described above.
  3. Wait a day. OpenAI says ChatGPT search can take about 24 hours to reflect a change, and Perplexity says up to 24 hours for its bots.
  4. Check your CDN and firewall. This is the big one.

Check your CDN and firewall settings

robots.txt is a polite request. A CDN or web application firewall blocks at the network level, before the bot even reads your file. If your CDN blocks OAI-SearchBot, allowing it in robots.txt does nothing.

Cloudflare is the common case. In July 2026 it split its AI bot controls into three categories (search, agent and training) that you can block fully, block only on pages with ads, or allow. It also announced new defaults for domains added from 15 September 2026: training and agent bots blocked on pages that show ads, search allowed.

So open your CDN's bot settings and confirm they match what your robots.txt says. Then look at your server or CDN logs for the user agent strings in the table above to confirm the bots you allowed are actually getting 200 responses.

Do this today

Open your live robots.txt, compare it to the table, and decide one thing per row: allow or block. Then check your CDN's bot settings match. It's a 15-minute job, and it's the base layer for everything in AEO vs SEO vs GEO. If you're also thinking about adding an llms.txt file, read what is llms.txt first, because it does something very different from robots.txt.

Questions people ask

Does blocking GPTBot remove my site from ChatGPT search?

No. OpenAI's docs treat GPTBot (training) and OAI-SearchBot (ChatGPT search) as separate settings. You can disallow GPTBot and still appear in ChatGPT search answers as long as OAI-SearchBot is allowed.

Does Google-Extended keep my site out of AI Overviews?

No. Google says Google-Extended controls use in Gemini training and grounding in Gemini Apps and Vertex AI, and doesn't affect Google Search. AI Overviews are part of Search, so they follow Googlebot rules and snippet controls like nosnippet.

How long do robots.txt changes take for AI crawlers?

OpenAI says it can take about 24 hours for ChatGPT search to reflect a robots.txt change, and Perplexity gives the same window for its bots. Other companies don't publish a number, so check your server logs.

Do AI crawlers have to obey robots.txt?

Robots.txt is a request, not a lock. The major AI companies say their crawlers follow it, but OpenAI and Perplexity both say their user-triggered fetchers may not, because a person asked for that page. If you need a hard block, do it at your CDN or firewall.

Keep reading