A bot check sits on the pages that matter most: the login, the sign-up, the checkout. That is what makes it useful, and also what makes it dangerous. If every checkout waits on it, then the day it is slow, your checkout is slow; the day it is down, so are you.
Fail open, fail closed
When the check cannot answer, there are two choices. Fail closed blocks the visitor: safe against bots, fatal for business, because every real customer is blocked too. Fail open lets the visitor through: during the outage, bots get in as they did before you had a check, and nobody else notices.
For almost every site, fail open is right. A few minutes without bot protection costs a little; a few minutes without a checkout costs a lot, and the trust of the people who saw it.
Four rules for calling a bot check
- A short timeout. Pick the most you will add to the page, 100 to 200 ms, and enforce it in your code. Never rely on the provider's side to be fast.
- Any error lets the visitor through. A timeout, a connection error, a 5xx, a 402 for an exhausted plan, or a body you cannot parse: all mean "no answer", and no answer means proceed.
- Act on the answer's
action. Block only when it saysblock: your settings decide when, and monitor mode never does. For an uncertain visitor you let through, add friction such as an emailed code, never a wall. - Log the misses. Count the timeouts and errors, so an outage is a graph, not a mystery.
What it looks like in code
const d = await fetch(API + "/v1/decide", {
method: "POST",
headers: { Authorization: `Bearer ${KEY}` },
body: JSON.stringify({ ip, ip_from: "peer", user_agent, token, path }),
// The timeout for your server's region: https://korzen.dev/bot-protection/docs/server-call#latency
signal: AbortSignal.timeout(200),
}).then((r) => r.json()).catch(() => null);
if (d?.action === "block") return res.status(403).end();
// anything else, including no answer: carry on
The catch is the whole policy: whatever goes wrong becomes null, and null is never a bot.
The browser side fails open too
The script on your page should never hold it up either. If it cannot reach the service, the page works exactly as it would without it; the server's decision simply has less evidence that time.
How Bot Protection is built for it
Bot Protection is a call from your server, not a proxy in front of your site, so it is never in the path of a request you did not choose to check. Its tag waits a bounded time and gives up silently. At your plan's limit it answers 402, which your code treats like any other error: visitors flow, and you get an email before it happens.