# How to set up robots.txt for AI crawlers

Set up robots.txt for AI crawlers by deciding three things separately: whether AI search engines may crawl you (OAI-SearchBot, PerplexityBot, Claude-SearchBot), whether your content may be used for model training (GPTBot, ClaudeBot, Google-Extended), and how to handle user-triggered fetchers. Most businesses should allow the search crawlers, choose a training policy, and test that their firewall agrees.


## The short answer

To set up robots.txt for AI crawlers, allow the bots that put you in AI search answers, make a deliberate choice about the bots that collect training data, and leave Googlebot and Bingbot alone. AI companies now run several crawlers each, with different jobs, and a single "block AI" rule usually blocks more than people intend.

robots.txt is a plain text file at the root of your domain, such as example.com/robots.txt, that tells crawlers which paths they may request. It is a request that reputable crawlers honour. It doesn't hide pages or stop bad actors.


## Know the three kinds of AI crawler

Each major AI company now documents its user agents. The table below summarizes what [OpenAI](https://developers.openai.com/api/docs/bots), [Anthropic](https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler), [Perplexity](https://docs.perplexity.ai/guides/bots) and [Google](https://developers.google.com/search/docs/crawling-indexing/google-common-crawlers) say about theirs.

| User agent or token | Company | Job | Effect of blocking |
|---|---|---|---|
| OAI-SearchBot | OpenAI | Search results in ChatGPT | Site isn't shown in ChatGPT search answers |
| GPTBot | OpenAI | Training data | Signals content shouldn't be used for training |
| ChatGPT-User | OpenAI | User-requested visits | OpenAI says robots.txt rules may not apply |
| Claude-SearchBot | Anthropic | Search quality | May reduce visibility in Claude search results |
| ClaudeBot | Anthropic | Training data | Future content excluded from training |
| Claude-User | Anthropic | User-requested visits | Claude can't fetch your pages for users |
| PerplexityBot | Perplexity | Search results | Site not surfaced in Perplexity results |
| Perplexity-User | Perplexity | User-requested visits | Generally ignores robots.txt |
| Google-Extended | Google | Gemini training and grounding | No effect on Google Search inclusion or ranking |

Google-Extended is a control token with no crawler of its own. Google says it governs whether content may be used to train future Gemini models and for grounding, where Search index content is given to the model at prompt time. Blocking it doesn't remove you from Google Search or AI Overviews, but it can limit how Gemini apps use your pages.

User-triggered fetchers sit in a grey area. When someone pastes your URL into ChatGPT or asks Perplexity about your page, the visit happens because a person asked for it, so OpenAI and Perplexity say robots.txt may not apply. If you truly need a page kept away from these tools, put it behind a login. robots.txt alone won't keep it private.


## How robots.txt rules are read

The rules are defined in the [Robots Exclusion Protocol, RFC 9309](https://www.rfc-editor.org/rfc/rfc9309), published by the IETF in 2022. A few details trip people up.


### Groups and matching

A file is made of groups. Each group starts with one or more User-agent lines and lists Allow and Disallow rules. Within a group, the longest matching path wins, and if an Allow and a Disallow rule are equally specific, Allow takes precedence.


#### Why a named group overrides the wildcard

A crawler looks for a group that names its own token. If it finds one, it follows that group and ignores the "User-agent: *" group entirely. So if your wildcard group blocks /admin/ and you add a separate group allowing GPTBot, GPTBot can crawl /admin/ unless you repeat the rule. Copy shared rules into every named group.


### One file per host

Rules apply per protocol and host, so shop.example.com needs its own file. Anthropic makes the same point for subdomains. The file must be UTF-8 plain text, and RFC 9309 says a 5xx server error on robots.txt should be treated as a full disallow, which can quietly stop crawling during an outage.


## A template most businesses can use

This setup allows search and user-triggered crawlers, opts out of model training, and keeps a shared private folder closed for everyone. Adjust the training lines to match your own policy.

| Group | Lines | Why |
|---|---|---|
| Everyone | User-agent: * / Disallow: /admin/ | Default rules for all other crawlers |
| AI search crawlers | User-agent: OAI-SearchBot, PerplexityBot, Claude-SearchBot (one line each) / Disallow: /admin/ | Stay visible in AI answers; repeat shared rules |
| Training crawlers | User-agent: GPTBot, ClaudeBot (one line each) / Disallow: / | Opt out of future training data |
| Gemini training | User-agent: Google-Extended / Disallow: / | Optional; also limits Gemini grounding |
| Sitemap | Sitemap: https://example.com/sitemap.xml | Helps every crawler find your URLs |

Several user agents can share one group by listing a User-agent line for each before the rules. Don't add groups for Googlebot or Bingbot unless you have a specific reason, since many AI products depend on those indexes.


### Common mistakes to avoid

- Copying a "block all AI bots" list from a forum that includes OAI-SearchBot or PerplexityBot.
- Adding a named group for a crawler and forgetting to repeat the shared Disallow rules.
- Blocking CSS and JavaScript folders, which stops crawlers from rendering your pages properly.
- Leaving a staging-site "Disallow: /" in place after launch.
- Writing "User-agent: GPTbot" with odd spacing or typos. Matching ignores case, but a misspelled token matches nothing.

Blocking training crawlers is a business decision. SEO doesn't require it either way. Some brands want their information in future models; others don't. Neither choice affects whether OAI-SearchBot or PerplexityBot can cite you today.


## Test and maintain the file

1. Open yourdomain.com/robots.txt in a browser and confirm it returns the file, not an error page.
2. Check server or CDN logs for each AI user agent and confirm they receive 200 responses on normal pages.
3. Review firewall and bot-protection rules. Perplexity and OpenAI both publish IP ranges you can allow.
4. Allow time to propagate. OpenAI says about 24 hours; Perplexity says up to 24 hours.
5. Recheck the file every quarter, because companies add and rename crawlers.

robots.txt is one part of AI visibility. Pair it with a sensible [llms.txt file](https://tcomconsultants.com/blog/llms-txt-examples-template/) for AI agents, and read our explainer on [what llms.txt is](https://tcomconsultants.com/answers/what-is-llms-txt/) to see how the two differ. For the wider picture, start with [what generative engine optimization is](https://tcomconsultants.com/blog/what-is-generative-engine-optimization/).


## How Tcom can help

We audit robots.txt, firewall rules and server logs together, because a mismatch between them is a frequent reason AI search engines can't reach a site. See our [AI search visibility service](https://tcomconsultants.com/services/ai-search-visibility/), try our free [tools](https://tcomconsultants.com/tools/), or [contact us](https://tcomconsultants.com/contact/) to have your setup checked.

## Sources

- Overview of OpenAI crawlers (OpenAI): https://developers.openai.com/api/docs/bots
- Does Anthropic crawl data from the web, and how can site owners block the crawler? (Anthropic (Claude Help Center)): https://support.claude.com/en/articles/8896518-does-anthropic-crawl-data-from-the-web-and-how-can-site-owners-block-the-crawler
- Perplexity crawlers (Perplexity): https://docs.perplexity.ai/guides/bots
- Google's common crawlers (Google Search Central): https://developers.google.com/search/docs/crawling-indexing/google-common-crawlers
- RFC 9309: Robots Exclusion Protocol (IETF): https://www.rfc-editor.org/rfc/rfc9309

Source: https://tcomconsultants.com/blog/robots-txt-for-ai-crawlers/
