LayerCall

Web Bot Auth tells you who signed, not what they may do

Does a verified Web Bot Auth signature mean the agent is allowed?

A Web Bot Auth signature answers one question: did the holder of this published key sign this exact request? When it verifies, you know who the operator is and that the method, host and path are the ones they signed. You do not know whether you want them on your signup form, your checkout or your account-deletion page. The protocol leaves that to you on purpose. So there are two separate jobs here: verification, which is arithmetic, and a policy, which is a decision you write down. Most trouble comes from letting the first stand in for the second.

  1. 1

    Keep the two questions apart

    Verification tells you the request came from whoever controls the key listed in the operator's directory, and that it was signed for this method, host and path within a short time window. It does not tell you whether the operator is honest, whether a person asked for the request, or how many of them are coming. Those are policy questions. If your code has one boolean called something like isTrustedBot that a valid signature flips to true, the two have already been merged and the policy is "anyone with a key".

  2. 2

    Verify the request the agent made to you, not your own

    The signature covers the agent's request to your site, so that is what has to be checked: its method, its full URL and its headers. Here is a real one, signed by LayerCall's own demo agent for a POST to a signup page, sent to a policy check. The signature expired five minutes after it was made, so sending this exact request now gets a deny. That is the window doing its job.

    curl -X POST "https://www.layercall.com/v1/agent/authorize" \
      -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
      -d '{
        "method": "POST",
        "url": "https://yoursite.example/signup",
        "headers": {
          "signature-agent": "\"https://www.layercall.com\"",
          "signature-input": "sig1=(\"@method\" \"@authority\" \"@path\");created=1795476383;expires=1795476683;keyid=\"uuBSPVi2KztxTpsiXdIVTZ-ima9QFIDadJC4AsbtZBM\";nonce=\"VB6Jd3mr6Eiy5UXrwh_05A\";tag=\"web-bot-auth\"",
          "signature": "sig1=:BZMySXlBvZxX/itoeL4K6izjTsPhUUFT…AJP96iaLAPBIRk01GZxBg==:"
        }
      }'
  3. 3

    Read which rule decided, not only the decision

    The answer came back allow, and it is worth being precise about why. The signature verified, which established who this is. The allow came from a policy rule: this operator publishes a Signature Agent Card declaring trigger: fetcher, meaning a person asked for the request, and when none of your own rules matches, the default for a verified fetcher is to let it through. matched names that rule. If you later add a rule that denies this agent on this path, the signature will verify exactly as before and the decision will change. That is the whole separation, in one response.

    {
      "decision": "allow",
      "matched": "default:verified_fetcher",
      "reason": "LayerCall Demo Agent is verified and declares itself user-initiated. Refusing this refuses the customer who asked for it.",
      "agent": {
        "verified": true,
        "host": "www.layercall.com",
        "name": "LayerCall Demo Agent",
        "trigger": "fetcher",
        "publishes_card": true,
        "signature_reason": null,
        "expires_in": 299
      },
      "requests_last_hour": 0
    }
  4. 4

    A signature covers one request and no other

    Same headers, sent a moment later, with one change: the url now says /account/delete instead of /signup. The signature was made over the path, so it no longer matches, and the answer is deny with signature_mismatch. Note what the default does with that. A request that presents an identity and cannot prove it is treated as worse than one that presents none, because nobody sends a broken signature by accident.

    {
      "decision": "deny",
      "matched": "default:signature_failed",
      "reason": "A Signature-Agent header was present but did not verify. An unverifiable claim of identity is worth less than no claim at all.",
      "agent": {
        "verified": false,
        "host": "www.layercall.com",
        "trigger": null,
        "signature_reason": "signature_mismatch"
      }
    }
  5. 5

    No signature is not a verdict

    Most traffic, including most well-behaved automation, carries no signature at all, and a user-agent string that says "assistant" proves nothing. With nothing signed there is no identity to authorize, so the honest answer is review: decide on the request's other evidence, such as its IP, its email and how many look like it, rather than on a claim nobody made.

    {
      "decision": "review",
      "matched": "default:unsigned",
      "reason": "No Web Bot Auth signature. This endpoint cannot say anything about identity — score the request with /v1/score/user instead.",
      "agent": {
        "verified": false,
        "host": null,
        "signature_reason": "no_signature"
      }
    }
  6. 6

    Write the policy down

    A policy is a short ordered list: which operator or which kind of agent, on which paths, with which methods, and what to do. On LayerCall it is a list of rules, checked in order with the first match winning, and the defaults above only apply when none of your rules matched. Rules can name an agent host, a trigger, a purpose, a path prefix and methods, and an allow rule can carry max_per_hour so a welcome operator still has a ceiling.

    curl -X PUT "https://www.layercall.com/v1/agent/policy" \
      -H "X-Api-Key: YOUR_KEY" -H "Content-Type: application/json" \
      -d '{ "rules": [
        { "path": "/account/delete", "action": "deny", "reason": "people only, signed or not" },
        { "trigger": "fetcher", "path": "/signup", "action": "allow", "max_per_hour": 20 },
        { "trigger": "crawler", "methods": ["POST", "PUT", "PATCH", "DELETE"], "action": "deny" }
      ] }'
  7. 7

    Or keep the policy in your own code

    None of this needs us. If you verify signatures yourself, the policy is a function you can read in one screen, and keeping it separate from the verifier is what stops the two from merging again. This one mirrors the defaults described above: the sensitive path first, a failed signature next, and the operator's declared trigger only once identity is settled.

    // Runs after your verifier. First match wins.
    function decide({ signatureFailed, verified, trigger, method, path }) {
      if (path.startsWith("/account/delete")) return "deny";  // people only, signed or not
      if (signatureFailed) return "deny";                      // a claim it could not prove
      if (!verified) return "review";                          // no identity: judge the request instead
      if (trigger === "fetcher") return "allow";               // a person asked for this
      if (trigger === "crawler") return ["POST", "PUT", "PATCH", "DELETE"].includes(method) ? "deny" : "allow";
      return "review";                                         // known operator, intent unknown
    }

What this gets wrong

Every check here has a cost in real customers. These are the ones that actually bite — several because we shipped them ourselves.

  • Treating verified as allowed. A valid signature says the request came from whoever holds that key. Operators you would never let near your checkout can sign perfectly well.
  • Verifying against the URL your app sees rather than the one the agent requested. The signature covers the method, host and path the agent sent; behind a proxy that rewrites the host or the path, every honest agent fails with signature_mismatch. Rebuild the URL from what arrived at your edge.
  • Writing an allow rule that names neither an agent nor a trigger. Your rules run before the defaults, so a rule like { "path": "/api", "action": "allow" } also matches unsigned requests and failed signatures. Put denies for sensitive paths first, and give every allow an agent or a trigger.
  • Caching one decision per operator. The same agent can be welcome on GET /pricing and not on POST /account/delete; the answer depends on the method and the path as well as on who signed.
  • Reading trigger: fetcher as a limit on volume. It means a person asked for this request. It does not stop one person asking for fifty accounts, which is what a max_per_hour on the rule and scoring the signup itself are for.
  • Letting a failed signature fall through to the unsigned path. A request that claims an identity it cannot prove deserves less benefit of the doubt than one that claims nothing.

Try it before you integrate

Paste any IP, email, phone or domain into the playground — no signup. Or get a free API key for 1,000 lookups a month, no card.