Skip to main content

How to install

Get the package from GitHub using go get.
Bash
Initialize the client instance and use it to make API requests. You need to specify your secret API key and region (if it is not US/Global).
Go

Migration guide for Go SDK v8

Version 8 migrates the SDK from Server API v3 to v4. This is a breaking change. This section summarizes the most important changes from previous versions.

Module rename

The module path changed from github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7 to github.com/fingerprintjs/go-sdk/v8.
Bash
Go
The v7 and v8 modules can be used side-by-side if you would like to migrate your codebase to the new version in stages.

Client construction

In v7, you created a context to pass your API key. In v8, you pass the API key when you create the client.
Go

Get an event

GetEvent is now a method on the client, rather than nested in the FingerprintAPI interface, and returns *fingerprint.Event instead of EventsGetResponse. The event data structure is flatter. For example, the ID of the event, previously called the request ID, is now available at the top level as EventID, and identification fields moved from Products.Identification.Data to the top level.
Go

Search events

SearchEvents uses a builder to construct the request rather than positional arguments and an options struct.
Go

GetVisits replaced by SearchEvents

GetVisits has been removed. Use SearchEvents with VisitorID to query a visitor’s history.
Go

Sealed results

UnsealEventsResponse is now part of the main fingerprint package instead of a separate sealed subpackage.
Go

Error handling

Use fingerprint.AsErrorResponse to inspect errors. It returns a structured response with Error.Code and Error.Message. SDK calls also return an *http.Response, which you can read to use the raw response body when handling errors.
Go

Handling sealed client results from a v3 JavaScript agent

Go SDK v8 will fail to deserialize the decrypted payload of a sealed client result sent by a v3 JavaScript agent into an Event because the payload is an EventsGetResponse (i.e., the v3 event format), not an Event. To upgrade to Go SDK v8 without requiring a concurrent upgrade to the v4 JavaScript agent, you can fall back to using the Server API if unsealing the sealed client results fails. To enable this fallback path, your frontend must send the event ID alongside the sealed client results, as recommended by the sealed client results guide.
Go

Documentation

You can find the full documentation in the official GitHub repository. The repository also contains an example app demonstrating the usage of the library.