Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

botid

FreeNo executable scriptsNot checked

Protect specific routes and server actions from bots in code with Vercel BotID (`botid` npm package). Use when installing BotID, calling `initBotId()` or…

vercelby vercel★ 356 GitHub stars

About this skill

Vercel BotID

You are an expert in Vercel BotID — invisible, per-route bot protection added in code.

What It Is

  • Client: a script attaches challenge headers to the requests you list in protect
  • Server: checkBotId() sends those headers to Vercel and returns a verdict for the current request
  • No CAPTCHA, no score header to read in proxy or middleware
  • Vercel only: needs the request context and an OIDC token, so it fails self-hosted or under next start
  • Levels: Basic (free, all plans) and Deep Analysis (Kasada, Pro $1 per 1,000 checkBotId() calls, Enterprise custom). Only checkBotId() calls are billed

Setup

npm i botid

No config wrapper or rewrites needed: Vercel routes BotID requests automatically. Remove any old withBotId, botid/nuxt or BotID vercel.json rewrites.

Client: declare protected routes

// instrumentation-client.ts (Next.js 15.3+)
import { initBotId } from 'botid/client/core';

initBotId({
  protect: [
    { path: '/api/signup', method: 'POST' },
    { path: '/api/user/*', method: 'POST' },
    { path: '/checkout', method: 'POST' }, // server action invoked from /checkout
  ],
});
  • * matches any characters, including / and nothing; method: '*' matches any method
  • Next.js < 15.3: <BotIdClient protect={routes} /> from botid/client in the root layout <head>
  • Nuxt: plugins/botid.client.ts with enforce: 'pre'. SvelteKit: init() in src/hooks.client.ts
  • Requests must use fetch or XHR. Traditional <form action method> posts aren't supported; use onSubmit + fetch or a server action

Server: check before the expensive work

import { checkBotId } from 'botid/server';

export async function POST(request: Request) {
  const { isBot } = await checkBotId();
  if (isBot) return Response.json({ error: 'Access denied' }, { status: 403 });
  // inference, writes, payments
}

Same call at the top of a server action. Result fields: isBot, isHuman, isVerifiedBot, verifiedBotName, verifiedBotCategory, bypassed. Pages Router in development: pass advancedOptions: { headers: req.headers }.

Verified Bots

Allow specific agents (botid 1.5.0+) from the verified bots directory:

const { isBot, isVerifiedBot, verifiedBotName } = await checkBotId();
if (isBot && !(isVerifiedBot && verifiedBotName === 'chatgpt-operator')) {
  return Response.json({ error: 'Access denied' }, { status: 403 });
}

For a trusted service not in the directory, use a separate authenticated route or a WAF bypass rule scoped to its IPs. Bypassed traffic returns bypassed: true.

Advanced Options

  • Deep Analysis: dashboard Firewall → Rules → Vercel BotID Deep Analysis, or vercel firewall rules update bot-id --action deep-analysis (staged; basic reverts). Billed, so confirm with the user and let them publish
  • Per-route level: advancedOptions.checkLevel: 'deepAnalysis' | 'basic' (1.4.5+) on both the protect entry and checkBotId(); a mismatch fails verification
  • Separate frontend host: checkBotId({ advancedOptions: { extraAllowedHosts: ['app.example.com'] } })
  • Check once per visit: verify on page load and issue a signed cookie only when isHuman && !bypassed. It's a bearer credential; keep auth, rate limits and CSRF protection

Testing

  • Local (NODE_ENV=development): returns human. Force a verdict with checkBotId({ developmentOptions: { bypass: 'BAD-BOT' } }) (or 'HUMAN', 'GOOD-BOT')
  • Deployed: test from the app UI or a fetch on a page that loaded the script. curl, Postman and the address bar are reported as bots, as expected
  • Monitor: Firewall traffic view, filtered to BotID; Observability Plus adds metrics

Common Pitfalls

  • Always a bot: route missing from protect, path/method mismatch, or a non-browser caller. The logged misconfiguration warning names the { path, method } to add
  • Always human: checkBotId() not called in the handler, or its result ignored
  • VERCEL_OIDC_TOKEN is not set: running outside Vercel

When to Use

  • Signup, login, checkout, form posts and server actions called by your own frontend
  • AI inference and other expensive endpoints

When NOT to Use

  • Site-wide page and crawler traffic → Bot Protection or AI Bots managed rules (vercel-firewall skill)
  • Public APIs called by servers, webhooks or CLIs → API keys, rate limits or WAF rules
  • Targeting a bot by name or category → custom rules (vercel-firewall skill)

References

Full SKILL.md on GitHub

Install botid in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

Bundled files

.vercel.approvers

FAQ

What does the botid skill do?

Protect specific routes and server actions from bots in code with Vercel BotID (`botid` npm package). Use when installing BotID, calling `initBotId()` or `checkBotId()`, mounting `<BotIdClient />`, gating signup, login, checkout or AI inference endpoints, allowing verified bots such as ChatGPT agents through, enabling Deep Analysis, or debugging a route that always reports a bot. For site-wide bot rules (Bot Protection, AI Bots, custom rules on bot name or category), use the `vercel-firewall` skill.

How do I install the botid skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the botid skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare botid with