1
Get your API key
Log in to the Knock2 dashboard and navigate to Settings → API Keys. Click Create API Key, give it a descriptive name (for example,
production-server), and copy the generated key.API keys are prefixed with kn_live_ so you can identify them at a glance in logs and configuration files.2
Verify your API key
Before embedding anything on your site, confirm that your key is valid by calling the A valid key returns a
/v1/me endpoint. A successful response tells you the tenant your key is scoped to and which permissions it carries.200 OK with a payload like this:GET /v1/me intentionally returns the minimum possible payload — it doesn’t include the key’s scopes.3
Install the tracking script
Knock2 generates a personalised embed snippet for your tenant. Fetch it by calling The response includes an The script is served from Knock2’s own API (not a separate CDN domain), and the tenant slug is baked into the URL path server-side — there’s no If you use a JavaScript framework, add the snippet inside the
GET /v1/script:embed_html field containing the ready-to-paste snippet. Copy the value and add it to the <head> of every page on your site:data-slug attribute to set.The
async attribute ensures the Knock2 script never blocks your page’s critical rendering path. You can also load it via a tag manager such as Google Tag Manager or Segment if you prefer not to modify your HTML directly.<Head> component of your root layout so it loads on every route:Next.js (App Router)
4
Verify the script is live
After adding the snippet, open your site in a browser (an incognito window works great) and load a page. Then call Once Knock2 has recorded at least one real page view, the
GET /v1/script/status to confirm Knock2 received the first beacon:is_installed field returns true:5
Fetch your first identified accounts
Once real traffic starts flowing, call A successful response returns a paginated list of identified account objects:
GET /v1/accounts to retrieve the companies Knock2 has identified on your site:Identification is not instantaneous. Knock2 processes session signals asynchronously, so there may be a short lag (typically under 60 seconds) between a visit and the account appearing in the API response. Most customers see their first identified accounts within a few hours of the script going live.
Next steps
You’re live. Now explore what you can do with the data Knock2 is collecting.Set up Webhooks
Push real-time alerts to Slack, your CRM, or any HTTP endpoint the moment a high-intent visitor lands on your site.
API Reference
Explore the full REST API — accounts, contacts, enrichment, filter sets, webhooks, and more.