Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
f543622
feat(api-v4)!: migrate SDK to APIv4
erayaydin Oct 14, 2025
42cd278
feat: remove accept header for updateEvent
erayaydin Oct 14, 2025
a928611
test: fix update event test expected method
erayaydin Oct 14, 2025
558c352
chore: remove unnecessary commented line
erayaydin Oct 14, 2025
c6a02cd
docs: expand `searchEvents` JSDoc with new filters
erayaydin Oct 15, 2025
696acb3
docs: fix example naming for error handling
erayaydin Oct 15, 2025
3840e16
chore: update OpenAPI schema version
erayaydin Oct 15, 2025
ce2854d
chore: add changeset file for changes
erayaydin Oct 15, 2025
41876b5
docs: update package name for badges
erayaydin Oct 15, 2025
29e8497
docs: use correct package name for installation
erayaydin Oct 15, 2025
8e2343e
chore: remove `getVisitorHistory` example file
erayaydin Oct 22, 2025
174b14d
chore: ignore `fingerprint-server-sdk-smoke-tests`
erayaydin Oct 22, 2025
385b01b
chore: changeset mention about package name change
erayaydin Oct 22, 2025
ef98a92
fix: use correct method for updating event
erayaydin Oct 22, 2025
ba36af2
fix: use response.ok for all success responses
erayaydin Oct 22, 2025
4f21b23
feat: simplify API requests with `callApi`
erayaydin Oct 22, 2025
db81f58
refactor: inline null checks in query serializer
erayaydin Oct 22, 2025
ba552dc
chore: use `EVENT_ID` placeholder example dotenv
erayaydin Oct 22, 2025
60156de
feat: restrict allowed methods via `AllowedMethod`
erayaydin Oct 22, 2025
297d679
fix: normalize HTTP method casing (uppercase)
erayaydin Oct 22, 2025
577660b
feat: add body support to `callApi`
erayaydin Oct 22, 2025
6ff4e05
test: remove unnecessary visitor detail tests
erayaydin Oct 22, 2025
a9d0af3
chore: fix missing quote for linked_id
erayaydin Oct 22, 2025
bfce2df
chore: remove redundant await keyword in callApi
erayaydin Oct 22, 2025
0e4ff4e
refactor: unify response handling and improve type
erayaydin Oct 23, 2025
bbf565b
refactor: simplify error handling
erayaydin Oct 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["fingerprintjs-pro-server-api-node-sdk-example"]
"ignore": ["fingerprint-server-sdk-example"]
}
24 changes: 24 additions & 0 deletions .changeset/early-seas-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
'@fingerprint/fingerprint-server-sdk': major
---

**Server APIv3 -> Server APIv4 migration**

- Switch all endpoints to `/v4/*`.
- Remove `authenticationMode` option when initializing `FingerprintJsServerApiClient`.
- Rename `request_id` to `event_id`.
- Use snake_case fields when updating an event.
- Use `PATCH` method when updating an event.
- Examples, tests, and docs updated.

**BREAKING CHANGES**
- `authenticationMode` option removed.
- Endpoints and method signatures changed.
- Use `eventId` instead of `requestId` when triggering `updateEvent()` function.
- Use `eventId` instead of `requestId` when triggering `getEvent()` function.
- Removed `getVisits()` function.
- Removed `getRelatedVisitors()` function.
- Removed `VisitorHistoryFilter`, `ErrorPlainResponse`, `VisitorsResponse`, `RelatedVisitorsResponse`,
`RelatedVisitorsFilter`, `Webhook`, `EventsUpdateRequest` types.
- Use `tags` instead of `tag` for updating an event.
- Response models changed.
2 changes: 1 addition & 1 deletion .schema-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.12.0
v3.0.1
4 changes: 2 additions & 2 deletions example/.env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
API_KEY=<API_KEY>
VISITOR_ID=<VISITOR_ID>
REQUEST_ID=<REQUEST_ID>
EVENT_ID=<REQUEST_ID>
# "eu" or "ap", "us" is the default
REGION=<REGION>
WEBHOOK_SIGNATURE_SECRET=<WEBHOOK_SIGNATURE_SECRET>
BASE64_KEY=<BASE64_KEY>
BASE64_SEALED_RESULT=<BASE64_SEALED_RESULT>
BASE64_SEALED_RESULT=<BASE64_SEALED_RESULT>
2 changes: 1 addition & 1 deletion example/deleteVisitor.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FingerprintJsServerApiClient, Region, RequestError } from '@fingerprintjs/fingerprintjs-pro-server-api'
import { FingerprintJsServerApiClient, Region, RequestError } from '@fingerprint/fingerprint-server-sdk'
import { config } from 'dotenv'
config()

Expand Down
10 changes: 5 additions & 5 deletions example/getEvent.mjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { FingerprintJsServerApiClient, Region, RequestError } from '@fingerprintjs/fingerprintjs-pro-server-api'
import { FingerprintJsServerApiClient, Region, RequestError } from '@fingerprint/fingerprint-server-sdk'
import { config } from 'dotenv'
config()

const apiKey = process.env.API_KEY
const requestId = process.env.REQUEST_ID
const eventId = process.env.EVENT_ID
const envRegion = process.env.REGION

if (!requestId) {
console.error('Request ID not defined')
if (!eventId) {
console.error('Event ID not defined')
process.exit(1)
}

Expand All @@ -26,7 +26,7 @@ if (envRegion === 'eu') {
const client = new FingerprintJsServerApiClient({ region, apiKey })

try {
const event = await client.getEvent(requestId)
const event = await client.getEvent(eventId)
console.log(JSON.stringify(event, null, 2))
} catch (error) {
if (error instanceof RequestError) {
Expand Down
4 changes: 2 additions & 2 deletions example/getVisitorHistory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Region,
RequestError,
TooManyRequestsError,
} from '@fingerprintjs/fingerprintjs-pro-server-api'
} from '@fingerprint/fingerprint-server-sdk'
import { config } from 'dotenv'
config()

Expand Down Expand Up @@ -31,7 +31,7 @@ if (envRegion === 'eu') {
const client = new FingerprintJsServerApiClient({ region, apiKey })

try {
const visitorHistory = await client.getVisits(visitorId, { limit: 10 })
const visitorHistory = await client.searchEvents({ visitor_id: visitorId, limit: 10 })
console.log(JSON.stringify(visitorHistory, null, 2))
} catch (error) {
if (error instanceof RequestError) {
Expand Down
4 changes: 2 additions & 2 deletions example/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "fingerprintjs-pro-server-api-node-sdk-example",
"name": "fingerprint-server-sdk-example",
"version": "1.0.0",
"description": "",
"main": "index.mjs",
Expand All @@ -10,7 +10,7 @@
"author": "",
"license": "MIT",
"dependencies": {
"@fingerprintjs/fingerprintjs-pro-server-api": "workspace:*",
"@fingerprint/fingerprint-server-sdk": "workspace:*",
"dotenv": "^16.4.5"
}
}
43 changes: 0 additions & 43 deletions example/relatedVisitors.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion example/searchEvents.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FingerprintJsServerApiClient, Region, RequestError } from '@fingerprintjs/fingerprintjs-pro-server-api'
import { FingerprintJsServerApiClient, Region, RequestError } from '@fingerprint/fingerprint-server-sdk'
import { config } from 'dotenv'
config()

Expand Down
2 changes: 1 addition & 1 deletion example/unsealResult.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { unsealEventsResponse, DecryptionAlgorithm } from '@fingerprintjs/fingerprintjs-pro-server-api'
import { unsealEventsResponse, DecryptionAlgorithm } from '@fingerprint/fingerprint-server-sdk'
import { config } from 'dotenv'
config()

Expand Down
14 changes: 7 additions & 7 deletions example/updateEvent.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { FingerprintJsServerApiClient, RequestError, Region } from '@fingerprintjs/fingerprintjs-pro-server-api'
import { FingerprintJsServerApiClient, RequestError, Region } from '@fingerprint/fingerprint-server-sdk'
import { config } from 'dotenv'

config()

const apiKey = process.env.API_KEY
const requestId = process.env.REQUEST_ID
const eventId = process.env.EVENT_ID
const envRegion = process.env.REGION

if (!requestId) {
console.error('Request ID not defined')
if (!eventId) {
console.error('Event ID not defined')
process.exit(1)
}

Expand All @@ -29,13 +29,13 @@ const client = new FingerprintJsServerApiClient({ region, apiKey })
try {
await client.updateEvent(
{
tag: {
tags: {
key: 'value',
},
linkedId: 'new_linked_id',
linked_id: 'new_linked_id',
suspect: false,
},
requestId
eventId
)

console.log('Event updated')
Expand Down
2 changes: 1 addition & 1 deletion example/validateWebhookSignature.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isValidWebhookSignature } from '@fingerprintjs/fingerprintjs-pro-server-api'
import { isValidWebhookSignature } from '@fingerprint/fingerprint-server-sdk'

/**
* Webhook endpoint handler example
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fingerprintjs/fingerprintjs-pro-server-api",
"version": "6.10.0",
"description": "Node.js wrapper for FingerprintJS Sever API",
"name": "@fingerprint/fingerprint-server-sdk",
"version": "7.0.0",
"description": "Node.js wrapper for Fingerprint Server API",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 11 additions & 33 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<a href="https://discord.gg/39EpE2neBg"><img src="https://img.shields.io/discord/852099967190433792?style=logo&label=Discord&logo=Discord&logoColor=white" alt="Discord server"></a>
</p>

# Fingerprint Server API Node.js SDK
# Fingerprint Server Node.js SDK

[Fingerprint](https://fingerprint.com) is a device intelligence platform offering industry-leading accuracy.

Expand Down Expand Up @@ -55,16 +55,16 @@ Install the package using your favorite package manager:
- NPM:

```sh
npm i @fingerprintjs/fingerprintjs-pro-server-api
npm i @fingerprint/fingerprintjs-server-sdk
```

- Yarn:
```sh
yarn add @fingerprintjs/fingerprintjs-pro-server-api
yarn add @fingerprint/fingerprintjs-server-sdk
```
- pnpm:
```sh
pnpm i @fingerprintjs/fingerprintjs-pro-server-api
pnpm i @fingerprint/fingerprintjs-server-sdk
```

## Getting started
Expand All @@ -75,20 +75,20 @@ Initialize the client instance and use it to make API requests. You need to spec
import {
FingerprintJsServerApiClient,
Region,
} from '@fingerprintjs/fingerprintjs-pro-server-api'
} from '@fingerprint/fingerprint-server-sdk'

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

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

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

Expand Down Expand Up @@ -116,7 +116,7 @@ import {
RequestError,
FingerprintJsServerApiClient,
TooManyRequestsError,
} from '@fingerprintjs/fingerprintjs-pro-server-api'
} from '@fingerprint/fingerprint-server-sdk'

const client = new FingerprintJsServerApiClient({
apiKey: '<SECRET_API_KEY>',
Expand All @@ -125,7 +125,7 @@ const client = new FingerprintJsServerApiClient({

// Handling getEvent errors
try {
const event = await client.getEvent(requestId)
const event = await client.getEvent(eventId)
console.log(JSON.stringify(event, null, 2))
} catch (error) {
if (error instanceof RequestError) {
Expand All @@ -136,28 +136,6 @@ try {
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...
// }
}
```

### Webhooks
Expand All @@ -167,9 +145,9 @@ try {
When handling [Webhooks](https://dev.fingerprint.com/docs/webhooks) coming from Fingerprint, you can cast the payload as the built-in `VisitWebhook` type:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When handling [Webhooks](https://dev.fingerprint.com/docs/webhooks) coming from Fingerprint, you can cast the payload as the built-in `VisitWebhook` type:
When handling [Webhooks](https://dev.fingerprint.com/reference/posteventwebhook#/) coming from Fingerprint, you can cast the payload as the built-in `Event` type:

Not sure about the link, but it should be more relevant.


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

const visit = visitWebhookBody as unknown as VisitWebhook
const visit = visitWebhookBody as unknown as Event
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const visit = visitWebhookBody as unknown as Event
const visit = eventWebhookBody as unknown as Event

```

#### Webhook signature validation
Expand Down
Loading
Loading