Bot detection techniques for developers

Bot detection is classifying automated HTTP clients and enforcing a policy: allow a verified crawler, constrain a script, or deny abuse.

19 min read
In short: Bot detection is classifying automated HTTP clients and enforcing a policy: allow a verified crawler, constrain a script, or deny abuse. No single signal is enough, so you layer robots.txt, User-Agent classification, IP verification, cryptographic signatures (Web Bot Auth and the Personal Agent Protocol), reputation, fingerprints, rate limits, and optional challenges, then combine the results by evidence level: UNVERIFIED, FINGERPRINT, IP, or SIGNATURE.

What problems do bots cause?

Bot detection is the practice of classifying automated HTTP clients and enforcing a policy: allow a verified crawler, constrain a script, or deny abuse. Well-behaved bots have always been part of the web. Search indexers follow robots.txt, fetch at a human-like pace, and send traffic back. Bad bots showed up the moment you exposed a public IP: WordPress scanners, leaked .git probes, SSH brute force, SMTP relay attempts.

Industry measurements now put automated traffic at roughly half of the public web, and in some years a majority. Imperva's 2026 Bad Bot Report attributed more than 53% of observed web traffic in 2025 to automation. Cloudflare has published similar majority-bot figures for HTML requests. Treat those percentages as dated snapshots, not a constant. The direction is stable: machines send a large share of requests, and much of that traffic is not playing fair.

The damage is concrete:

  • Expensive requests. Bots hit dynamic pages that cannot be cached: commit history, faceted search, personalized storefronts. Open-source hosts have documented crawlers walking every Git blame and history view.
  • Large downloads. ISO mirrors, image archives, and documentation sites absorb bandwidth until the bill or the uplink fails. Projects have had to rate-limit or geo-block entire regions during scrape waves.
  • Resource exhaustion. Every request costs CPU, memory, or a downstream query. Brute-force login and relay probing create denial-of-service conditions even when no vulnerability is exploited. Serverless pricing makes "just another request" an invoice.

Good bots mimic human pacing and honor robots.txt. You cannot assume bad bots will. Detection starts with cheap signals and adds harder ones where those fail.

Are AI bots worse than traditional crawlers?

Attribution is messy because User-Agents and IPs are easy to spoof. Traffic logs from open infrastructure still show AI crawlers as a major cost center. Public write-ups have attributed large fractions of some sites' hits to GPTBot, ClaudeBot, or Amazonbot. Read the Docs reported that applying an AI-crawler block list cut bandwidth from about 800 GB/day to about 200 GB/day. Other operators have described crawlers that omit a proper User-Agent entirely.

Incentives explain the hostility. Site owners tolerate Googlebot because the crawl is bounded and search referrals pay for it. robots.txt is enough when the operator cooperates. Training crawls often return no citation and no traffic. If the economic trade is one-way, operators hide. That is why User-Agent blocking alone fails: the clients you most want to stop are the ones least likely to tell the truth.

Not every AI client is a trainer. Search-style fetchers that power answers can send referral traffic. Treat each class separately instead of blocking "all AI."

What happens when agents act on behalf of humans?

Most owners want human traffic. "Good versus bad" is really "is this automation acceptable on this route?" API clients and search indexers are usually acceptable. Scrapers and training crawlers often are not. Agents that act for a person sit in the middle: they hold cookies, complete checkout, or summarize a page the user asked about.

OpenAI's published bots illustrate the split. The following table is a snapshot, as of November 2026, of how those roles differ. Names and identification methods change, so confirm the current OpenAI crawler docs before you write a rule.

BotPurposeTraining?Citations?Identification
OAI-SearchBotCrawls sites to power ChatGPT searchNoYes, can drive referral traffic

Dedicated User-Agent and published IP ranges. Usually treated as beneficial on public content.

ChatGPT-User

Fetches live pages during a ChatGPT session so the model can summarize

NoSometimes

Dedicated User-Agent and published IP ranges. Runs only when a user prompt invokes it.

GPTBotCollects training data for foundation modelsYesNo guaranteed return to the site owner

Documented User-Agent and published IP ranges. Blockable via robots.txt. High bandwidth cost.

ChatGPT agent (browser)A real browser that follows user instructions on the live siteDepends on the sessionDepends on the session

Chrome-like User-Agent. Signs requests with Web Bot Auth, and the signature names chatgpt.com as the operator. Looks like a person unless you verify the signature.

A fifth role acts for one specific person with that person's delegation. Meta's Muse can present a Personal Agent Protocol session, which proves the agent acts for one of its users and signs in through your OAuth server instead of with the person's password. For more information, see what is the Personal Agent Protocol.

Blocking every AI client is a blunt instrument. Allowing a search-style bot can keep you visible as users move from classic search to answer engines. Blocking a training crawler can save bandwidth. Denying a browser agent on /signup is a different decision from allowing it on /docs. robots.txt is the polite version of that split. Enforce it in the application, because the clients that ignore the file are the ones you care about.

How do you detect and block bots?

Write robots.txt first. It forces you to decide what you want. Google and other well-behaved crawlers follow it. Then assume the rest will not, and stack defenses from cheap to expensive: headers, IP reputation and verification, TLS or HTTP fingerprints, rate limits, then challenges.

A surprising number of abusive clients still send default library User-Agents (curl, python-urllib, Go-http-client). Libraries such as isbot (Node.js) or CrawlerDetect (PHP and Python) catch those. Two limits remain. New bots appear constantly, and any client can copy Googlebot's header.

Arcjet's detectBot rule uses an allow or deny list of named bots and managed categories. Pass exactly one of allow or deny. An empty allow list blocks every detected bot. Categories such as CATEGORY:SEARCH_ENGINE stay current as the underlying list updates.

import arcjet, { detectBot, shield, fixedWindow } from "@arcjet/next";
const aj = arcjet({
key: process.env.ARCJET_KEY!,
rules: [
shield({ mode: "LIVE" }),
detectBot({
mode: "LIVE",
allow: ["CATEGORY:SEARCH_ENGINE"],
}),
fixedWindow({ mode: "LIVE", window: "1h", max: 100 }),
],
});
export async function GET(req: Request) {
const decision = await aj.protect(req);
if (decision.isDenied()) {
if (decision.reason.isBot()) {
return new Response("Forbidden", { status: 403 });
}
if (decision.reason.isRateLimit()) {
return new Response("Too Many Requests", { status: 429 });
}
return new Response("Forbidden", { status: 403 });
}
return new Response("OK");
}

Pin @arcjet/next to v1. After an allow decision, still verify the bot. A client can present a search-engine User-Agent from the wrong network.

The rule is the same shape outside JavaScript. In Python the categories are an enum and the spoof check is a plain function over the results:

from arcjet import BotCategory, Mode, arcjet, detect_bot, is_spoofed_bot, shield
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
app = FastAPI()
aj = arcjet(
key=ARCJET_KEY,
rules=[
shield(mode=Mode.LIVE),
detect_bot(mode=Mode.LIVE, allow=[BotCategory.SEARCH_ENGINE]),
],
)
@app.get("/")
async def index(request: Request):
decision = await aj.protect(request)
if decision.is_denied():
return JSONResponse({"error": "Forbidden"}, status_code=403)
# Allowed by name, but the address does not back the claim.
if any(is_spoofed_bot(result) for result in decision.results):
return JSONResponse({"error": "Forbidden"}, status_code=403)
return {"message": "ok"}

Use arcjet_sync and drop the await for Flask or Django. Python takes integer seconds for rate-limit windows rather than duration strings, and denial reasons are read as decision.reason_v2.type, not reason.isBot().

How do you verify claimed user agents?

Verification answers "is this really Googlebot?" Large operators publish a method: Applebot, Bing, Datadog, Google, and OpenAI among them. The common pattern is reverse DNS plus a forward confirmation. Some also publish IP lists.

To verify a Google crawler:

  1. Reverse-lookup the client IP. Confirm the PTR hostname ends in googlebot.com, google.com, or googleusercontent.com.
  2. Forward-lookup that hostname. Confirm the address matches the original IP.

If either step fails, treat the request as spoofed. Published IP ranges give the same answer without DNS lookups. A confirmed match is IP evidence in Arcjet's bot identity, and a contradicted claim sets spoofed. For more information about impersonation and the isSpoofedBot / isVerifiedBot helpers, see detect bot spoofing.

How do cryptographic signatures identify bots and AI agents?

A cryptographic signature identifies a bot by proof of a private key, not by a header the client chooses or the network it uses. Two standards apply to bots and AI agents: Web Bot Auth, which proves which operator sent a request, and the Personal Agent Protocol, which proves which agent sent it and that the agent acts for one of its users. Signatures are the strongest technique tier, because a client can't produce a valid one without the operator's key.

Web Bot Auth builds on RFC 9421 HTTP Message Signatures, and its own profile is an IETF draft. The client sends three headers: Signature-Agent names the operator's key directory, Signature-Input lists the signed components with the tag web-bot-auth, and Signature carries the signature. You fetch the public keys from /.well-known/http-message-signatures-directory on the operator's domain and verify. A cloud browser agent such as ChatGPT agent sends a Chrome User-Agent header, so the signature is what separates it from a person. For more information about headers, key directories, and which operators sign, see what is Web Bot Auth.

The Personal Agent Protocol (Poppy) is a protocol for a person's AI agent to act at a business on their behalf. The agent identifies itself with an HTTPS client_id that points to its metadata and keys. With each request it sends a short-lived Poppy-Session token, signed by a delegated key and bound to the request method and URL. It signs in through the business's own OAuth server, with scopes the person approves, instead of with their password. Specification 1.0 was published on November 14, 2026, and Meta describes its Muse agent as the first personal agent to support it. For more information about sessions, delegation, and adoption, see what is the Personal Agent Protocol.

Signatures have limits that the other techniques don't share:

  • A signature identifies an operator, not a person. Hosted browser platforms such as Browserbase, Kernel, and Cloudflare Browser Run sign for many customers. A valid signature from one of them tells you the platform sent the request, not whose agent it was or what it intends.
  • A Poppy session never identifies the user. It proves that the agent acts for one of its users, with an ID that differs for each business. It doesn't prove that the person approved a specific action.
  • Replay is possible within the expiry. A Web Bot Auth signature that covers only @authority can be replayed until it expires.
  • Not every operator signs. Many crawlers publish only IP ranges or reverse DNS names, and a missing signature isn't evidence of a fake. Keep IP verification in place for them.
  • Agents in a person's own browser can't sign. An agent such as Claude in Chrome or Perplexity Comet runs in the person's browser and looks like that person to your server.

Arcjet verifies both standards in the detectBot rule and reports the result in the same bot identity, so you don't integrate each protocol separately. It verifies the signers in the open well-known-bots catalog by bot ID, and other Web Bot Auth signers that you name with SIGNED_BOT:<directory URL>. It verifies Poppy sessions only for agents that the catalog vets, and never fetches a client_id that a request supplies. For setup, see Web Bot Auth and agents that act for a user in the Arcjet docs.

What about privacy tokens?

Apple shipped a related browser primitive, Private Access Tokens, in 2022. RFC 9577 (Privacy Pass HTTP Authentication Scheme) was published in June 2024. A token attests that a device passed a check, not which bot or agent sent the request. Adoption outside Apple's ecosystem remains limited. Safari can participate. Other browsers have not shipped comparable built-in support, though extensions exist. Do not design your only bot control around a token that most clients cannot present.

How useful is IP reputation?

Reputation is a prior, not an identity. If an address recently sent bot traffic, the next request from it is more likely automated. Commercial databases (MaxMind, IPinfo, and others) attach owner, connection type, and risk scores. Hosting and cloud ranges are disproportionately automated, which is why signup forms often challenge or deny them.

Treat single-provider percentages as historical. One widely cited 2024 Cloudflare figure put AWS at 12.7% of observed bot traffic. That number will not stay current. The useful fact is the pattern: a few cloud networks originate a lot of automation, and operators sometimes block entire countries or ASNs during a spike. Those blocks have collateral damage.

IP data is imperfect. Geolocation is wrong for mobile and satellite networks. Attackers rotate addresses and buy residential proxies. Blocking solely on reputation creates false positives. Use the signal to raise friction (review an order, tighten a quota) rather than as a permanent country ban. Arcjet returns IP analysis on the decision so your handler can choose the response.

Do proof-of-work and CAPTCHA still work?

Challenges raise the cost of each request. A human can spend a fraction of a second. A crawler doing millions of fetches cannot, in theory. Proof-of-work reverse proxies (Anubis, Checkpoint, and similar) implement that idea. CAPTCHAs are the interactive version: distorted text, image grids, or invisible behavioral scores.

Both are an arms race. Modern vision models solve many image challenges. Human solver services finish the rest for a fraction of a cent. Proof-of-work hurts accessibility and still gets evaded or poisoned. Use a challenge as a graduated step-up on a high-value action, not as the foundation. For more information about why puzzles fail as a primary control, see CAPTCHA alternatives.

How do JA3 and JA4 fingerprints help?

JA3 hashed TLS ClientHello fields so the same client stack produced the same fingerprint across IPs. Reordering cipher suites was enough to change the hash, so JA3 is largely deprecated. JA4 is the successor. Both require access to the TLS handshake. If you terminate TLS on Vercel, Netlify, or Fly.io, you may only see a vendor-injected header, or nothing.

JA4H hashes HTTP request metadata instead. It is proprietary, unlike JA4. Once you have a hash you still have to decide which hashes to deny, the same problem as IP denylists. Combine fingerprints with reputation and application context. Don't block on a hash alone.

How should you rate limit bots?

Per-IP limits stop naive scripts and fail against rotation. Key the limit on a session, user ID, API key, or a compound of IP, path, and fingerprint. Allow verified search crawlers a different budget from anonymous clients. Give each AI agent its own budget, keyed by its bot ID, so one agent can't use up capacity your other visitors need. For more information about algorithm choice, see the rate limiting guide.

How do you combine bot detection techniques by evidence level?

You combine bot detection techniques by recording how strongly each one proves who sent the request, and letting the strongest proof decide. An evidence ladder orders the results from weakest to strongest: UNVERIFIED, FINGERPRINT, IP, and SIGNATURE. A bot name without an evidence level is only a claim, so write policy against the level, not the name.

Arcjet reports this ladder on one primary bot identity for each request that a bot rule detects. The identity has a kind (AI_AGENT, AI_CRAWLER, AUTOMATION, or OTHER), a botId, and an evidence level. The following table maps each level to the techniques in this article:

EvidenceTechnique that produces itWhat it provesHow an attacker defeats it
UNVERIFIEDUser-Agent classification or IP reputationWhat the client claims, or that the address has a historyCopy the header, or use a clean residential address
FINGERPRINTBrowser checks from advanced signalsA program drives the browser, but not which onePatch the automation framework until the checks pass
IP

Published IP ranges, IP data that names a crawler, or forward-confirmed reverse DNS

The request left the operator's network

Run on the operator's own infrastructure, such as a shared cloud range

SIGNATUREWeb Bot Auth or a Personal Agent Protocol sessionThe sender controls a private key the operator publishedSteal the key, or replay a signature before it expires

Two more fields carry the rest of the combination:

  • spoofed is true when IP or reverse DNS verification shows that a claim is false, such as Googlebot from an address Google doesn't publish. A spoofed identity always has UNVERIFIED evidence. Treat it as a sign of intent, not as a missing check.
  • delegated is true for a verified Personal Agent Protocol session, which means the agent acts for one of its users. It's set only with SIGNATURE evidence.

When a request matches several bots, Arcjet reports the one with the strongest evidence. On a tie it prefers an AI agent, then an AI crawler, then other bots, then automation. Only Arcjet Cloud computes the identity, so a decision that the SDK makes locally has none. For more information about each level and the policy it supports, see AI agent evidence levels and bot identity in the Arcjet docs.

The following examples allow search engines and AI agents, then require IP or SIGNATURE evidence before an AI agent reaches the handler. A scraper that only claims to be an agent in its User-Agent header gets UNVERIFIED evidence and a 403. The isAiAgent helper skips spoofed identities but doesn't check evidence, so the handler reads evidence itself.

Require verified evidence in JavaScript

import arcjet, { detectBot } from "@arcjet/next";
import { isAiAgent, isSpoofedBot } from "@arcjet/inspect";
const aj = arcjet({
key: process.env.ARCJET_KEY!,
rules: [
detectBot({
mode: "LIVE",
allow: ["CATEGORY:SEARCH_ENGINE", "CATEGORY:AI_AGENT"],
}),
],
});
export async function GET(req: Request) {
const decision = await aj.protect(req);
if (decision.isDenied() || decision.results.some(isSpoofedBot)) {
return new Response("Forbidden", { status: 403 });
}
for (const result of decision.results) {
if (isAiAgent(result) && result.reason.isBot()) {
const evidence = result.reason.identity?.evidence;
// A User-Agent claim or a failed browser check isn't enough here
if (evidence !== "IP" && evidence !== "SIGNATURE") {
return new Response("Forbidden", { status: 403 });
}
}
}
return new Response("OK");
}

Require verified evidence in Python

import os
from arcjet import BotCategory, Mode, arcjet, detect_bot, is_ai_agent, is_spoofed_bot
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
app = FastAPI()
aj = arcjet(
key=os.environ["ARCJET_KEY"],
rules=[
detect_bot(
mode=Mode.LIVE,
allow=[BotCategory.SEARCH_ENGINE, BotCategory.AI_AGENT],
),
],
)
@app.get("/")
async def index(request: Request):
decision = await aj.protect(request)
if decision.is_denied() or any(
is_spoofed_bot(r) for r in decision.results
):
return JSONResponse({"error": "Forbidden"}, status_code=403)
for result in decision.results:
reason = result.reason_v2
if is_ai_agent(result) and reason.type == "BOT":
# A User-Agent claim or a failed browser check isn't enough here
if reason.identity.evidence not in ("IP", "SIGNATURE"):
return JSONResponse({"error": "Forbidden"}, status_code=403)
return {"message": "ok"}

Require verified evidence in Go

package main
import (
"log"
"net/http"
"os"
"github.com/arcjet/arcjet-go"
)
func main() {
aj, err := arcjet.NewClient(arcjet.Config{
Key: os.Getenv("ARCJET_KEY"),
Rules: []arcjet.Rule{
arcjet.DetectBot(arcjet.BotOptions{
Mode: arcjet.ModeLive,
Allow: []string{
arcjet.BotCategorySearchEngine,
arcjet.BotCategoryAIAgent,
},
}),
},
})
if err != nil {
log.Fatal(err)
}
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
decision, err := aj.Protect(r.Context(), r)
if err != nil {
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
return
}
if decision.IsDenied() || decision.IsSpoofedBot() {
http.Error(w, "Forbidden", http.StatusForbidden)
return
}
if decision.IsAIAgent() {
for _, result := range decision.Results {
bot := result.Reason.Bot
if bot == nil || bot.Identity == nil ||
bot.Identity.Kind != arcjet.BotKindAIAgent {
continue
}
// A User-Agent claim or a failed browser check isn't enough here
e := bot.Identity.Evidence
if e != arcjet.BotEvidenceIP && e != arcjet.BotEvidenceSignature {
http.Error(w, "Forbidden", http.StatusForbidden)
return
}
}
}
w.Write([]byte("OK"))
})
log.Fatal(http.ListenAndServe(":8080", nil))
}

How do you layer these techniques?

No single technique is enough, so layer them and let the evidence level decide how far to trust the result. Start with robots.txt for operators who cooperate. Classify User-Agents against a maintained list. Verify the ones you allow by IP range or reverse DNS, and accept a Web Bot Auth signature or Personal Agent Protocol session where the operator provides one. Add IP reputation as a prior. Fingerprint when you terminate TLS. Rate-limit the scarce operation, not "HTTP" in general. Keep CAPTCHA and proof-of-work as optional friction.

Match the evidence you require to the route. A User-Agent claim can be enough for a public blog. An account API can require IP or SIGNATURE. A purchase still needs your own authorization checks, because even a signed, delegated agent doesn't prove that the person approved that order.

Put those checks in the request handler so the rule can see the route and the user. For more information about why that context matters, see application-layer bot detection. Dry-run new denies, then promote them. Review false positives from shared networks, previews, and uptime monitors. Allow CATEGORY:MONITOR and CATEGORY:PREVIEW if those clients matter to you.

Frequently asked questions

How much of web traffic is bots?

Large networks report about half, and in some years a majority. Imperva's 2026 report put automated traffic at more than 53% of observed web traffic in 2025. Treat the percentage as a dated snapshot. Design as if automation is common.

Should I block all AI bots?

No. Search-style fetchers can send referral traffic. Training crawlers often do not. Browser agents look like people unless they sign their requests. Decide per bot class and per route.

Is User-Agent blocking enough?

No. It catches default library clients. Anyone can copy Googlebot's header. Verify allowlisted bots by IP range, reverse DNS, or signature, and add rate limits plus reputation.

What is the strongest way to identify a bot?

A cryptographic signature. A Web Bot Auth signature or a Personal Agent Protocol session proves the sender controls a key the operator published, which a copied header or a borrowed address can't. Not every operator signs, so keep IP verification for the rest.

Does a Web Bot Auth signature identify the user?

No. It identifies the operator of the key directory. Hosted browser platforms sign for many customers. A Personal Agent Protocol session proves the agent acts for one of its users, but never identifies that user or proves they approved a specific action.

How do I allow search engines with Arcjet v1?

Use detectBot({ mode: "LIVE", allow: ["CATEGORY:SEARCH_ENGINE"] }) and branch on decision.isDenied() plus decision.reason.isBot(). Then check isSpoofedBot.

Do CAPTCHA and proof-of-work still work?

They raise cost for naive scripts. Solver farms and models bypass many puzzles. Use them as a step-up, not as the foundation.

Is RFC 9577 widely adopted?

RFC 9577 was published in June 2024. Built-in browser support remains largely Apple's Private Access Tokens in Safari. Do not depend on it as your only control.

Application security in your code

Protect your application with Arcjet

Combine User-Agent checks, IP verification, and Web Bot Auth and Personal Agent Protocol signatures in one bot rule, and act on the evidence level in your request handler.