← Back

Identify & Verify Agents With Node.js

Step 1: Install the NPM Package

Download and include the package via NPM:

npm install @knownagents/sdk

Step 2: Initialize the Client

In your code, create an instance of KnownAgents with your project's access token.

import { KnownAgents } from "@knownagents/sdk"

const knownAgents = new KnownAgents("YOUR_ACCESS_TOKEN")

Step 3: Identify & Verify Agents

Call identifyAgent to identify a single incoming request:

const identification = await knownAgents.identifyAgent(request)

Call identifyAgents to identify multiple requests at once:

const identifications = await knownAgents.identifyAgents([
    {
        request_id: "request-1",
        request_headers: request1.headers,
        request_path: request1.url
    },
    {
        request_id: "request-2",
        request_headers: request2.headers,
        request_path: request2.url
    }
])

These methods return an object (or array of objects) with the following fields: