@fingerprintjs/fingerprintjs-pro-server-api

中文文档
6.13.1发布于 2026/09/14MITTypeScriptESM + CJS零依赖构建来源已验证近 30 天下载 41.1万

指印JS Sever API的节点. js 包装器

中文使用文档
文档目录10 节
  1. 所需资源
  2. 如何安装
  3. 开始
  4. 处理错误
  5. 网络呼号
  6. 密封结果
  7. 删除访客数据
  8. 语义版本
  9. 支助和反馈
  10. 许可证

Fingerprint logo

Current NPM version Monthly downloads from NPM Discord server

指纹服务器 API 节点.js SDK

指纹 是一个能提供行业领导精确度的设备智能平台.

指纹服务器节点 SDK 是和指纹互动的简单方法 服务器 API 从您的节点应用程序。 您可以搜索、更新或删除身份识别事件.

折旧通知

此版本的服务器 API 被标记为从 2026年1月7日 将被彻底废除 2027年1月7日 (中文(简体) ) 根据我们 API 折旧政策如果您仍然使用这个版本,请跟随我们 移徙指南 从这个被贬值的版本迁移到新的版本.

指纹服务器 API 允许您在服务器环境中搜索,更新并删除身份识别事件. 它可用于数据出口、决策和数据分析设想。 服务器API是用于服务器侧使用,并非从客户端方面使用,无论是浏览器还是移动设备.

所需资源

类型脚本支持 :

  • 类型脚本4.5.5或以上

支持的运行时间 :

  • 节点.js 18 LTS以上(我们支持所有 终止使用前的节点LTS释放) (中文(简体) ).

  • Deno和Bun可能有用,但没有得到积极测试.

  • "Edge"运行时间可能经过一些修改后起作用,但没有积极测试.

    见“ edge” 运行时间兼容性

    这个 SDK 可以与 JavaScript "edge" 运行时间兼容, 不支持所有节点 API, 例如, Vercel 边缘运行时间,或 云花岗工人。 。 。 .

    为了成功 更换SDK的内置设备 fetch 函数( 依赖于节点 APIS) , 且运行时间为本地 fetch 函数。 将函数传递到有适当绑定的构造器:

    const client = new FingerprintJsServerApiClient({
      region: Region.EU,
      apiKey: apiKey,
      fetch: fetch.bind(globalThis),
    })
    

如何安装

使用您最喜欢的软件包管理器安装软件包 :

  • 国家预防机制:

    npm i @fingerprintjs/fingerprintjs-pro-server-api
    
  • 亚伦:

    yarn add @fingerprintjs/fingerprintjs-pro-server-api
    
  • 时间 :

    pnpm i @fingerprintjs/fingerprintjs-pro-server-api
    

开始

初始化客户端实例并使用它来提出API请求. 您需要指定您的指纹 秘密 API 密钥 和指纹工作区.

import {
  FingerprintJsServerApiClient,
  Region,
} from '@fingerprintjs/fingerprintjs-pro-server-api'

const client = new FingerprintJsServerApiClient({
  apiKey: '<SECRET_API_KEY>',
  region: Region.Global,
})

// Get visit history of a specific visitor
client.getVisits('<visitorId>').then((visitorHistory) => {
  console.log(visitorHistory)
})

// Get a specific identification event
client.getEvent('<requestId>').then((event) => {
  console.log(event)
})

// Search for identification events
client
  .searchEvents({
    limit: 10,
//    pagination_key: previousSearchResult.paginationKey,
    suspect: true,
  })
  .then((events) => {
    console.log(events)
  })

见 实例 更详细的示例文件夹.

处理错误

服务器 API 方法可以丢出 RequestError。 。 。 . 处理错误时, 您可以像这样检查 :

import {
  RequestError,
  FingerprintJsServerApiClient,
  TooManyRequestsError,
} from '@fingerprintjs/fingerprintjs-pro-server-api'

const client = new FingerprintJsServerApiClient({
  apiKey: '<SECRET_API_KEY>',
  region: Region.Global,
})

// Handling getEvent errors
try {
  const event = await client.getEvent(requestId)
  console.log(JSON.stringify(event, null, 2))
} catch (error) {
  if (error instanceof RequestError) {
    console.log(error.responseBody) // Access parsed response body
    console.log(error.response) // You can also access the raw response
    console.log(`error ${error.statusCode}: `, error.message)
  } else {
    console.log('unknown error: ', error)
  }
}

// Handling getVisits errors
try {
  const visitorHistory = await client.getVisits(visitorId, {
    limit: 10,
  })
  console.log(JSON.stringify(visitorHistory, null, 2))
} catch (error) {
  if (error instanceof RequestError) {
    console.log(error.status, error.error)
    if (error instanceof TooManyRequestsError) {
      retryLater(error.retryAfter) // Needs to be implemented on your side
    }
  } else {
    console.error('unknown error: ', error)
  }

  // You can also check for specific error instance
  // if(error instanceof VisitorsError403) {
  //    Handle 403 error...
  // }
}

网络呼号

Webhook 类型

处理时 网络呼号 从指印上,你可以把有效载荷铸成内置的 VisitWebhook 类型 :

import { VisitWebhook } from '@fingerprintjs/fingerprintjs-pro-server-api'

const visit = visitWebhookBody as unknown as VisitWebhook

Webhook 签名验证

企业计划的客户可以 Webhook 签名 以加密方式验证进入的网络用户的真实性. 这个SDK为验证所接收到的webhook请求的HMAC签名提供了一种效用方法.

要学更多,看 实例/ 验证WebhookSignature.mjs。 。 。 .

密封结果

企业计划的客户可以 密封结果 以接收客户端的完整设备智能结果,并将其解封在服务器上。 这种SDK提供了解码密封结果的实用方法.

要学更多,看 实例/未担保。 。 。 .

删除访客数据

企业计划的客户可以 删除与特定访问者有关的所有数据 遵守隐私条例。 见 实例/删除Visitor.mjs。 。 。 .

语义版本

  • 变动至 类型 在此寄存器中,被认为是不破解的,通常作为 PATCH 或 MINOR semver 的修改而发布(否则,每增加一个计划将是主要的版本升级).
  • 强烈建议您将您的软件包版本锁定到特定的 PATCH 发布并升级,期望类型可以在任何发布之间升级.
  • 节点SDK的运行时间(与类型无关)公共API仍然严格遵循semver.

支助和反馈

报告问题、提问或反馈,请使用 问题。如果你需要私人支持,你可以发电子邮件给我们 oss- support@指印.com。 。 。 .

许可证

本项目根据以下规定获得许可证: 麻省理工学院许可证。 。 。 .

版本与发布记录

@fingerprintjs/fingerprintjs-pro-server-api 共发布 65 个版本,首次发布于 2021/07/28;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
6.13.1latest2026/09/142 个月前
6.13.02026/09/092 个月前
6.12.02026/08/043 个月前
6.11.02026/04/147 个月前
6.10.02025/09/101.2 年前
6.10.0-test.1test2025/09/081.2 年前

关于 @fingerprintjs/fingerprintjs-pro-server-api 的常见问题

@fingerprintjs/fingerprintjs-pro-server-api 是什么?

指印JS Sever API的节点. js 包装器

如何安装 @fingerprintjs/fingerprintjs-pro-server-api?

在项目目录运行 npm install @fingerprintjs/fingerprintjs-pro-server-api,或使用 pnpm add / yarn add / bun add。

@fingerprintjs/fingerprintjs-pro-server-api 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fingerprintjs/fingerprintjs-pro-server-api 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fingerprintjs/fingerprintjs-pro-server-api 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.17.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fingerprintjs/fingerprintjs-pro-server-api 可以商用吗?

@fingerprintjs/fingerprintjs-pro-server-api 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fingerprintjs/fingerprintjs-pro-server-api 的下载量有多少?

根据 npm 官方下载统计,@fingerprintjs/fingerprintjs-pro-server-api 在 2026/10/15 – 2026/11/13 这 30 天内被下载 411,380 次,日均约 13,713 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fingerprintjs/fingerprintjs-pro-server-api 还在维护吗?

最新版本 6.13.1 发布于 2026/09/14(2 个月前);至今共发布 65 个版本,其中过去 12 个月发布了 4 个;首次发布于 2021/07/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。