{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "name": "Add Edge Shield via the Agent API | Edge Docs",
  "headline": "Add Edge Shield via the Agent API | Edge Docs",
  "description": "Let your AI agent add free Edge Shield bot protection to the forms and pages it deploys: create a widget, inject the embed and wire up server-side verification.",
  "url": "https://edge.network/docs/agent/shield",
  "image": "https://edge.network/og/docs__agent__shield.png",
  "inLanguage": "en",
  "publisher": {
    "@type": "Organization",
    "name": "Edge Network",
    "url": "https://edge.network",
    "logo": "https://edge.network/favicon.svg"
  },
  "isPartOf": {
    "@type": "WebSite",
    "name": "Edge Network",
    "url": "https://edge.network"
  },
  "breadcrumb": {
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "Home",
        "item": "https://edge.network"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "Docs",
        "item": "https://edge.network/docs"
      },
      {
        "@type": "ListItem",
        "position": 3,
        "name": "Agent",
        "item": "https://edge.network/docs/agent"
      },
      {
        "@type": "ListItem",
        "position": 4,
        "name": "Shield",
        "item": "https://edge.network/docs/agent/shield"
      }
    ]
  },
  "section": "documentation/agent",
  "articleBody": "Docs CDN Deployments, domains, caching, purging and on-the-fly image optimisation. Getting started \n Deployments \n Domains & SSL \n Compute Virtual machines in seconds: networking, firewalls, backups and SSH keys. Getting started \n Creating VMs \n Managing VMs \n DNS Zones, records, geo-routing, backups and development domains. Getting started \n Zone management \n DNS records \n Storage S3-compatible buckets, access keys, presigned URLs and multipart uploads. Getting started \n Buckets \n Access keys \n Shield Privacy-first bot protection: widget modes, siteverify and verified agents. Getting started \n Widget modes \n JavaScript API \n Assist AI answers from your own content: widget, ingestion and the API. Getting started \n Widget & embedding \n Content ingestion \n REST API Manage every Edge resource over HTTPS with API keys. Authentication \n Errors \n Versioning \n Compute \n CDN \n DNS \n CLI One binary for macOS, Linux and Windows to script every product. Installation \n Authentication \n Compute commands \n CDN commands \n DNS commands \n Storage commands \n Dev tooling Command palette and keyboard shortcuts across the console. Command palette \n Agent tooling Let AI agents deploy and manage infrastructure: discovery, MCP and access codes. Start with the overview MCP server \n MCP tool reference \n Connect your tool \n Framework wrappers \n Self-signup \n Access codes \n Discovery endpoint \n Deploy a static site \n Deploy an app \n Projects \n Bot protection \n AI answers \n Account & support Teams, security, audit logs, alerts, billing tools and support. Start with the overview Teams \n Referral programme \n Cost Advisor \n Security \n Two-factor auth \n Audit log \n Alerts \n Support tickets \n Search the docs ⌘K Console Products\n\n CDN Compute DNS Storage Shield Assist Developer tools\n\n REST API CLI Dev tooling Agents\n\n Agent tooling Overview MCP server MCP tool reference Connect your tool Framework wrappers Self-signup Access codes Discovery endpoint Deploy a static site Deploy an app Projects Bot protection AI answers Account\n\n Account & support Why use Shield through the Agent API Copy Anchor Link \n\n Free, forever: unlimited widgets and verifications. Shield never counts against an agent&#x27;s budget cap.\n Ready-to-paste embed: The create response includes the exact script tag, widget div and siteverify contract, so the agent doesn&#x27;t need to look anything up in the docs.\n Agent-aware: set an agent_policy to allow, challenge or block cryptographically verified AI agents (Web Bot Auth) on the protected page.\n Stats built in: Agents can report solve rates, humanity scores and blocked replays back to the user on request.\n API endpoints Copy Anchor Link \n\n Output Copy Text GET /agent/shield/widgets # List widgets \n POST /agent/shield/widgets # Create a widget (returns secret + embed snippet) \n PATCH /agent/shield/widgets/{id} # Update name, hostnames, mode, agent_policy \n DELETE /agent/shield/widgets/{id} # Revoke a widget \n GET /agent/shield/widgets/{id}/stats # Hourly traffic stats (?hours=24, max 720) Requires an agent access code with the shield product. Creating, updating and revoking widgets require the manage permission. All write endpoints support X-Dry-Run: true .\n\n Creating a widget Copy Anchor Link \n\n HTTP Copy Text POST /agent/shield/widgets \n Authorization: Bearer ea_live_... \n \n { \n \" name \": \" Contact form \", \n \" hostnames \": [\" portfolio.example.com \"], \n \" mode \": \" managed \", \n \" agent_policy \": \" allow \" \n } \n \n # Response: \n { \n \" widget \": { \n \" id \": \" wgt-abc123 \", \n \" name \": \" Contact form \", \n \" sitekey \": \" es_6206c6fdb43e7a3cb948507e6f3e5a11 \", \n \" mode \": \" managed \", \n \" agentPolicy \": \" allow \", \n \" hostnames \": [\" portfolio.example.com \"] \n }, \n \" secret \": \" ss_4f8e2a1b9c7d6e5f4a3b2c1d0e9f8a7b \", \n \" embed \": { \n \" script \": \" <script src=\\\"https://shield.edge.network/api.js\\\" defer></script> \", \n \" widget \": \" <div class=\\\"edge-shield\\\" data-sitekey=\\\"es_6206...\\\"></div> \", \n \" verify \": { \n \" endpoint \": \" https://shield.edge.network/siteverify \", \n \" method \": \" POST \", \n \" body \": { \" secret \": \" <widget secret> \", \" response \": \" <edge-shield-response form field> \" } \n } \n }, \n \" tell_user \": \" Shield widget \\\"Contact form\\\" created. IMPORTANT: the secret is \n shown only once. Store it as a server-side environment variable now... \" \n } Warning\n\n The secret is returned only on creation. A well-behaved agent stores it as a server-side environment variable (never in client code or the repository) and tells the user where it was put. If the secret is lost, revoke the widget and create a new one.\n\n Typical agent workflow Copy Anchor Link \n\n Create the widget: scoped to the site&#x27;s hostname, in managed mode unless the user asks otherwise.\n Inject the embed snippet: the script tag in the page head, the widget div inside the form being protected.\n Wire up verification: the form handler posts the edge-shield-response field to /siteverify with the secret, and rejects submissions that fail.\n Redeploy and report back: including where the secret is stored.\n Checking traffic Copy Anchor Link \n\n HTTP Copy Text GET /agent/shield/widgets/wgt-abc123/stats?hours=168 \n Authorization: Bearer ea_live_... \n \n # Response: \n { \n \" totals \": { \n \" hours \": 168 , \n \" challenges_issued \": 14382 , \n \" challenges_solved \": 9041 , \n \" solve_rate_pct \": 62.9 , \n \" verify_success \": 1204 , \n \" verify_replay \": 17 , \n \" verified_agents \": 93 \n }, \n \" stats \": [ /* hourly rows */ ], \n \" anomaly \": null , \n \" tell_user \": \" Last 168h: 14382 challenges issued, 62.9% solved, \n 1204 verified submissions, 17 replayed tokens blocked. \" \n } If a drift anomaly is flagged on the widget, the response includes an anomaly object and the tell_user summary mentions it.\n\n See also Copy Anchor Link \n\n Server-side validation : The siteverify contract in full\n Discovery endpoint : The agent&#x27;s entry point\n Something unclear or out of date? Tell us , or read this page as Markdown .\n\n Projects\n\n Previous\n\n AI answers\n\n Next",
  "headings": [
    {
      "level": 1,
      "text": "Bot protection"
    }
  ],
  "relatedLinks": [
    {
      "@type": "WebPage",
      "name": "Network",
      "url": "https://edge.network/network"
    },
    {
      "@type": "WebPage",
      "name": "Pricing",
      "url": "https://edge.network/pricing"
    },
    {
      "@type": "WebPage",
      "name": "Docs",
      "url": "https://edge.network/docs"
    },
    {
      "@type": "WebPage",
      "name": "Sign in",
      "url": "https://edge.network/console/access"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/cdn/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Deployments",
      "url": "https://edge.network/docs/cdn/deployments"
    },
    {
      "@type": "WebPage",
      "name": "Domains &amp; SSL",
      "url": "https://edge.network/docs/cdn/domains"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/compute/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Creating VMs",
      "url": "https://edge.network/docs/compute/creating-vms"
    },
    {
      "@type": "WebPage",
      "name": "Managing VMs",
      "url": "https://edge.network/docs/compute/managing-vms"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/dns/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Zone management",
      "url": "https://edge.network/docs/dns/zones"
    },
    {
      "@type": "WebPage",
      "name": "DNS records",
      "url": "https://edge.network/docs/dns/records"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/storage/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Buckets",
      "url": "https://edge.network/docs/storage/buckets"
    },
    {
      "@type": "WebPage",
      "name": "Access keys",
      "url": "https://edge.network/docs/storage/access-keys"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/shield/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Widget modes",
      "url": "https://edge.network/docs/shield/widget-modes"
    },
    {
      "@type": "WebPage",
      "name": "JavaScript API",
      "url": "https://edge.network/docs/shield/js-api"
    },
    {
      "@type": "WebPage",
      "name": "Getting started",
      "url": "https://edge.network/docs/assist/getting-started"
    },
    {
      "@type": "WebPage",
      "name": "Widget &amp; embedding",
      "url": "https://edge.network/docs/assist/widget"
    },
    {
      "@type": "WebPage",
      "name": "Content ingestion",
      "url": "https://edge.network/docs/assist/ingestion"
    },
    {
      "@type": "WebPage",
      "name": "Authentication",
      "url": "https://edge.network/docs/api/authentication"
    },
    {
      "@type": "WebPage",
      "name": "Errors",
      "url": "https://edge.network/docs/api/errors"
    },
    {
      "@type": "WebPage",
      "name": "Versioning",
      "url": "https://edge.network/docs/api/versioning"
    },
    {
      "@type": "WebPage",
      "name": "Compute",
      "url": "https://edge.network/docs/api/compute"
    },
    {
      "@type": "WebPage",
      "name": "CDN",
      "url": "https://edge.network/docs/api/cdn"
    },
    {
      "@type": "WebPage",
      "name": "DNS",
      "url": "https://edge.network/docs/api/dns"
    },
    {
      "@type": "WebPage",
      "name": "Installation",
      "url": "https://edge.network/docs/cli/installation"
    },
    {
      "@type": "WebPage",
      "name": "Authentication",
      "url": "https://edge.network/docs/cli/authentication"
    }
  ],
  "alternateFormats": [
    {
      "@type": "MediaObject",
      "contentType": "text/html",
      "url": "https://edge.network/docs/agent/shield",
      "name": "HTML version"
    }
  ],
  "dateModified": "2026-11-23T21:33:31.573Z"
}