Skip to main content
Identify a visitor, send an Identification ID with your application action and verify the result on your server. This guide uses the supported ShieldLabs package API, not a standalone generated client.

Before you start

An existing Svelte 5 application. The complete SvelteKit example below uses Svelte 5 and separates public and private environment variables. Register 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 Public Key for your domain from Integration > API keys. A public frontend environment variable may contain this key, but never a Private API Key or webhook signing secret.

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

A SvelteKit signup form. Add your Public Key and your Private API Key to .env:
use:enhance sends the form with fetch, so the page stays alive while the agent posts the identification (see Keep the page alive). Without JavaScript, or when the agent cannot load, the form is still sent without a identificationId, and your server treats the signup as unverified. Resolve SHIELDLABS_DOMAIN_ID with shieldlabs.entities.domains() as shown in the Node.js guide. Replace the demonstration Set with an atomic shared database claim on (domain UUID, Identification ID). For authenticated actions, also match the User HID to the signed-in account. History becomes available asynchronously; the SDK waits within a bounded budget. To have the verdict ready by the time the user submits, start the identification when the user begins the action (see Start when the user begins the action).
Test on a registered domain. ShieldLabs records identifications only for the domains registered in your account. On localhost the page still receives a identificationId, but the browser ID alone does not confirm that a result was stored. Test on a development domain with its own keys, as described in Environments.

Test the complete flow

  1. Run the application on the registered HTTPS domain with its Public Key.
  2. Trigger the protected form once and check that an Identification ID is sent to your own backend.
  3. Retrieve that same ID using a server SDK or locate it in the analytics dashboard.
  4. Test a missing ID and an agent load failure: your backend must treat the action as unverified.
The /api/signup routes shown in examples belong to your application; they are not ShieldLabs API endpoints. Connect one of the server quick starts before testing the full action. A successful browser call does not prove scoring is complete.

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