Skip to main content
Read and evaluate a stored identification, then verify raw-body webhook signatures in your backend. This guide uses the supported ShieldLabs package API, not a standalone generated client.

Before you start

Node.js 18+ with a Private API Key. The browser must already send a Request ID to your server. Register and verify the website domain in your analytics dashboard. Use credentials from the same domain and environment as the browser check. For a fresh account, start with Quick Start.

Get your credentials

Copy the domain’s Private API Key from Integration > API keys and store it as SHIELDLABS_API_KEY in your server environment. For webhook verification, also set SHIELDLABS_WEBHOOK_SECRET from Integration > Webhooks. Never expose either secret to the browser.

Install the SDK

Use yarn add or pnpm add with the same package names if your project uses that package manager. Framework packages remain the application’s responsibility.

Add the integration

Environment variables used throughout: SHIELDLABS_API_KEY (Private API Key, sec_...), SHIELDLABS_WEBHOOK_SECRET (endpoint signing secret, whsec_...), SHIELDLABS_SECRET_KEY and SHIELDLABS_DOMAIN (Management API), and SHIELDLABS_API_BASE_URL / SHIELDLABS_MANAGEMENT_BASE_URL to point at another host in development and tests (https, or plain http on localhost). The SDK never reads the environment itself: pass the values to the constructors. For development and staging, register a separate domain in the analytics dashboard and use its keys. A runnable version of this flow is in examples/node-http.

Test the complete flow

  1. Use the Request ID from a real browser check on the same domain as the Private API Key.
  2. Confirm the server retrieves that identification and its Risk Score.
  3. Test an invalid or missing ID and an unavailable API: none should be treated as a clean identification.
  4. For webhooks, test the original raw body with its signature, then change one byte and confirm rejection.
In-memory replay stores in examples are demonstrations, not shared production storage. Claim accepted IDs atomically in a durable database or cache, enforce freshness, authenticate the action, and check the expected domain and user association. Reading a valid identification alone does not authorize a business action.

Troubleshooting

  • No History row: confirm the registered domain, credential/environment match and that the browser remained open while collectors posted.
  • Missing or pending verdict: scoring is asynchronous. The server helper waits within a bounded budget; handle a missing result and API errors explicitly.
  • Authentication error: use the Private API Key for History, not a Public Key, Management Secret Key or MCP OAuth token.
  • Invalid webhook signature: verify the original raw bytes with the endpoint’s full signing secret, before trusting parsed JSON.

Next steps