# @fingerprintjs/fingerprintjs-pro-server-api 中文文档

规范地址：https://npmcn.com/package/%40fingerprintjs/fingerprintjs-pro-server-api/

版本：6\.13\.1
npm 元数据更新时间：2026-09-14T10:46:07.230Z
中文译文更新时间：2026-11-14T18:49:00.771Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40fingerprintjs/fingerprintjs-pro-server-api
原文对照：https://npmcn.com/package/%40fingerprintjs/fingerprintjs-pro-server-api/?lang=original
项目主页：https://github.com/fingerprintjs/node-sdk#readme
源码仓库：https://github.com/fingerprintjs/node-sdk

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：354 kB，20 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=18\.17\.0
- 运行依赖：0 个
- 首次发布：2021-07-28T12:42:08.878Z
- 最新版本发布：2026-09-14T10:46:06.838Z
- 近 30 天下载量：411380（2026-10-15 至 2026-11-13，npm 官方下载统计）
- 已发布版本数：65（近 12 个月 4 个）

## 中文简介

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

## 安装

```sh
npm install @fingerprintjs/fingerprintjs-pro-server-api
```

也可以使用：`pnpm add @fingerprintjs/fingerprintjs-pro-server-api`、`yarn add @fingerprintjs/fingerprintjs-pro-server-api`、`bun add @fingerprintjs/fingerprintjs-pro-server-api`

## README

[![Fingerprint logo](https://fingerprintjs.github.io/home/resources/logo_dark.svg)](https://fingerprint.com/)

[![Current NPM version](https://img.shields.io/npm/v/@fingerprintjs/fingerprintjs-pro-server-api.svg)](https://www.npmjs.com/package/@fingerprintjs/fingerprintjs-pro-server-api) [![Monthly downloads from NPM](https://img.shields.io/npm/dm/@fingerprintjs/fingerprintjs-pro-server-api.svg)](https://www.npmjs.com/package/@fingerprintjs/fingerprintjs-pro-server-api) [![Discord server](https://img.shields.io/discord/852099967190433792?style=logo&label=Discord&logo=Discord&logoColor=white)](https://discord.gg/39EpE2neBg)

# 指纹服务器 API 节点.js SDK

[指纹](https://fingerprint.com/) 是一个能提供行业领导精确度的设备智能平台.

指纹服务器节点 SDK 是和指纹互动的简单方法 [服务器 API](https://dev.fingerprint.com/reference/pro-server-api) 从您的节点应用程序。 您可以搜索、更新或删除身份识别事件.

> 折旧通知
> 
> 此版本的服务器 API 被标记为从 **2026年1月7日** 将被彻底废除 **2027年1月7日 (中文(简体) )** 根据我们 [API 折旧政策](https://dev.fingerprint.com/reference/api-deprecation-policy)如果您仍然使用这个版本,请跟随我们 [移徙指南](https://dev.fingerprint.com/reference/migrating-from-server-api-v3-to-v4) 从这个被贬值的版本迁移到新的版本.

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

## 所需资源

类型脚本支持 :

-   类型脚本4.5.5或以上

支持的运行时间 :

-   节点.js 18 LTS以上(我们支持所有 [终止使用前的节点LTS释放](https://nodejs.dev/en/about/releases/)) (中文(简体) ).
    
-   Deno和Bun可能有用,但没有得到积极测试.
    
-   "Edge"运行时间可能经过一些修改后起作用,但没有积极测试.
    
    见“ edge” 运行时间兼容性
    
    这个 SDK 可以与 JavaScript "edge" 运行时间兼容, 不支持所有节点 API, 例如, [Vercel 边缘运行时间](https://edge-runtime.vercel.app/),或 [云花岗工人](https://developers.cloudflare.com/workers/)。 。 。 .
    
    为了成功 更换SDK的内置设备 `fetch` 函数( 依赖于节点 APIS) , 且运行时间为本地 `fetch` 函数。 将函数传递到有适当绑定的构造器:
    
    ```js
    const client = new FingerprintJsServerApiClient({
      region: Region.EU,
      apiKey: apiKey,
      fetch: fetch.bind(globalThis),
    })
    ```
    

## 如何安装

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

-   国家预防机制:
    
    ```sh
    npm i @fingerprintjs/fingerprintjs-pro-server-api
    ```
    
-   亚伦:
    
    ```sh
    yarn add @fingerprintjs/fingerprintjs-pro-server-api
    ```
    
-   时间 :
    
    ```sh
    pnpm i @fingerprintjs/fingerprintjs-pro-server-api
    ```
    

## 开始

初始化客户端实例并使用它来提出API请求. 您需要指定您的指纹 [秘密 API 密钥](https://dev.fingerprint.com/docs/quick-start-guide#4-get-smart-signals-to-your-server) 和指纹工作区.

```ts
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)
  })
```

见 [实例](https://github.com/fingerprintjs/node-sdk/tree/api-v3/example) 更详细的示例文件夹.

### 处理错误

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

```typescript
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 类型

处理时 [网络呼号](https://dev.fingerprint.com/docs/webhooks) 从指印上,你可以把有效载荷铸成内置的 `VisitWebhook` 类型 :

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

const visit = visitWebhookBody as unknown as VisitWebhook
```

#### Webhook 签名验证

企业计划的客户可以 [Webhook 签名](https://dev.fingerprint.com/docs/webhooks-security) 以加密方式验证进入的网络用户的真实性. 这个SDK为验证所接收到的webhook请求的HMAC签名提供了一种效用方法.

要学更多,看 [实例/ 验证WebhookSignature.mjs](https://github.com/fingerprintjs/node-sdk/tree/api-v3/example/validateWebhookSignature.mjs)。 。 。 .

### 密封结果

企业计划的客户可以 [密封结果](https://dev.fingerprint.com/docs/sealed-client-results) 以接收客户端的完整设备智能结果,并将其解封在服务器上。 这种SDK提供了解码密封结果的实用方法.

要学更多,看 [实例/未担保](https://github.com/fingerprintjs/node-sdk/tree/api-v3/example/unsealResult.mjs)。 。 。 .

### 删除访客数据

企业计划的客户可以 [删除与特定访问者有关的所有数据](https://dev.fingerprint.com/reference/deletevisitordata) 遵守隐私条例。 见 [实例/删除Visitor.mjs](https://github.com/fingerprintjs/node-sdk/tree/api-v3/example/deleteVisitor.mjs)。 。 。 .

## 语义版本

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

## 支助和反馈

报告问题、提问或反馈,请使用 [问题](https://github.com/fingerprintjs/node-sdk/issues)。如果你需要私人支持,你可以发电子邮件给我们 [oss- support@指印.com](mailto:oss-support@fingerprint.com)。 。 。 .

## 许可证

本项目根据以下规定获得许可证: [麻省理工学院许可证](https://github.com/fingerprintjs/node-sdk/tree/main/LICENSE)。 。 。 .

## 常见问题

### @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 和提交记录判断。

