Help us shape the future of Go! Take the 2026 Go Developer Survey

idanalyzer

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 11 Imported by: 0

README

ID Analyzer Go SDK (API v2)

Official Go client library for the ID Analyzer API v2 — worldwide passport, driver license and ID card scanning, biometric face/liveness verification, AML/PEP screening, DocuPass remote verification & e-signature, KYC profile management and contract generation.

It targets the load-balanced api2.idanalyzer.com fleet (US, default) or api2-eu.idanalyzer.com (EU). Standard library only — no third-party dependencies.

Replaces the legacy v1 Go SDK. New projects should use this module.

Installation

go get github.com/idanalyzer/id-analyzer-v2-go

Base URL / Region

By default the SDK targets the US fleet. Select EU either via the environment variable IDANALYZER_REGION=eu or with the WithRegion option:

client, _ := idanalyzer.NewClient("YOUR_API_KEY", idanalyzer.WithRegion("eu"))

For an on-premise ID Fort host, use idanalyzer.WithBaseURL("https://your-host"). The API key also falls back to the IDANALYZER_KEY environment variable.

Quick start

package main

import (
	"fmt"
	"log"

	idanalyzer "github.com/idanalyzer/id-analyzer-v2-go"
)

func main() {
	client, err := idanalyzer.NewClient("YOUR_API_KEY")
	if err != nil {
		log.Fatal(err)
	}

	profile := idanalyzer.NewProfile(idanalyzer.SecurityMedium)
	result, err := client.Scanner.Scan(idanalyzer.ScanRequest{
		DocumentFront: "id_front.jpg",
		Face:          "selfie.jpg",
		Profile:       profile,
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(result["decision"])
}

API Coverage

The SDK exposes the full ID Analyzer API v2 surface via service fields on the client:

  • client.Scanner — Scan, QuickScan, VeryQuickScan
  • client.Biometric — VerifyFace, VerifyLiveness
  • client.AML — Search (/aml), SearchV3 (/amlv3)
  • client.Contract — Generate + template CRUD
  • client.Transaction — Get, List, Update, Delete, Export, SaveImage, SaveFile
  • client.Docupass — Create, List, Get, Delete
  • client.Profile — KYC profile Create/List/Get/Update/Delete/Export
  • client.Webhook — List, Resend, Delete
  • client.Account — Get (/myaccount)

Errors

API-level errors are returned as *idanalyzer.APIError (with Code and Message); invalid client-side arguments are returned as *idanalyzer.InvalidArgumentError.

Documentation

Guide: developer.idanalyzer.com/help/go · Knowledge base: developer.idanalyzer.com/help

License

MIT

Documentation

Overview

Package idanalyzer is the official Go client library for the ID Analyzer API v2.

It targets the load-balanced api2.idanalyzer.com fleet (US, default) or api2-eu.idanalyzer.com (EU). Create a client with NewClient and use the service fields (Scanner, Biometric, AML, Contract, Transaction, Docupass, Profile, Webhook, Account).

Index

Constants

View Source
const (
	SecurityNone   = "security_none"
	SecurityLow    = "security_low"
	SecurityMedium = "security_medium"
	SecurityHigh   = "security_high"
)

Preset KYC profile IDs.

Variables

This section is empty.

Functions

func ParseInput

func ParseInput(input string, allowCache bool) (string, error)

ParseInput accepts a file path, base64 string, URL, or (when allowCache) a "ref:" cache reference, and returns the value to send to the API.

Types

type AMLSearchRequest

type AMLSearchRequest struct {
	Name      string
	IDNumber  string
	Entity    int // 0=Person, 1=Corporation/Legal Entity
	Country   string
	Database  []string
	BirthYear string
}

AMLSearchRequest holds parameters for an AML v1 search (POST /aml).

type AMLService

type AMLService struct {
	// contains filtered or unexported fields
}

func (*AMLService) Search

func (a *AMLService) Search(req AMLSearchRequest) (map[string]any, error)

Search screens against the AML database (POST /aml).

func (*AMLService) SearchV3

func (a *AMLService) SearchV3(text, id string, limit, page int) (map[string]any, error)

SearchV3 screens against the AML v3 database (POST /amlv3). Provide Text or ID.

type APIError

type APIError struct {
	Code    string
	Message string
}

APIError is returned when the API responds with an error object.

func (*APIError) Error

func (e *APIError) Error() string

type AccountService

type AccountService struct {
	// contains filtered or unexported fields
}

func (*AccountService) Get

func (a *AccountService) Get() (map[string]any, error)

Get retrieves the current account profile, quota and usage (GET /myaccount).

type BiometricService

type BiometricService struct {
	// contains filtered or unexported fields
}

func (*BiometricService) VerifyFace

func (b *BiometricService) VerifyFace(profile *Profile, referenceFaceImage, facePhoto, faceVideo, customData string) (map[string]any, error)

VerifyFace performs 1:1 face verification against a reference image (POST /face).

func (*BiometricService) VerifyLiveness

func (b *BiometricService) VerifyLiveness(profile *Profile, facePhoto, faceVideo, customData string) (map[string]any, error)

VerifyLiveness performs a standalone liveness check (POST /liveness).

type Client

type Client struct {
	Scanner     *ScannerService
	Biometric   *BiometricService
	AML         *AMLService
	Contract    *ContractService
	Transaction *TransactionService
	Docupass    *DocupassService
	Profile     *ProfileService
	Webhook     *WebhookService
	Account     *AccountService
	// contains filtered or unexported fields
}

Client is an ID Analyzer API v2 client.

func NewClient

func NewClient(apiKey string, opts ...Option) (*Client, error)

NewClient creates a new client. The API key falls back to the IDANALYZER_KEY environment variable. The region falls back to IDANALYZER_REGION (default "us").

type ContractService

type ContractService struct {
	// contains filtered or unexported fields
}

func (*ContractService) CreateTemplate

func (c *ContractService) CreateTemplate(name, content, orientation, timezone, font string) (map[string]any, error)

CreateTemplate creates a contract template (POST /contract).

func (*ContractService) DeleteTemplate

func (c *ContractService) DeleteTemplate(templateID string) (map[string]any, error)

DeleteTemplate deletes a contract template (DELETE /contract/{id}).

func (*ContractService) Generate

func (c *ContractService) Generate(templateID, format, transactionID string, fillData map[string]any) (map[string]any, error)

Generate generates a document from a template (POST /generate).

func (*ContractService) GetTemplate

func (c *ContractService) GetTemplate(templateID string) (map[string]any, error)

GetTemplate retrieves a contract template (GET /contract/{id}).

func (*ContractService) ListTemplate

func (c *ContractService) ListTemplate(order, limit, offset int, filterTemplateID string) (map[string]any, error)

ListTemplate lists contract templates (GET /contract).

func (*ContractService) UpdateTemplate

func (c *ContractService) UpdateTemplate(templateID, name, content, orientation, timezone, font string) (map[string]any, error)

UpdateTemplate updates a contract template (POST /contract/{id}).

type DocupassCreateRequest

type DocupassCreateRequest struct {
	Profile               string // KYC profile ID (required)
	Mode                  int    // 0=Document+Face, 1=Document, 2=Face, 3=e-Signature
	ContractFormat        string
	ContractGenerate      string
	ContractSign          string
	ContractPrefill       string
	Reusable              bool
	CustomData            string
	Language              string
	ReferenceDocument     string
	ReferenceDocumentBack string
	ReferenceFace         string
	UserPhone             string
	VerifyAddress         string
	VerifyAge             string
	VerifyDOB             string // note: docupass uses the upper-case "verifyDOB" field
	VerifyDocumentNumber  string
	VerifyName            string
	VerifyPostcode        string
}

DocupassCreateRequest holds parameters for creating a Docupass (POST /docupass).

type DocupassService

type DocupassService struct {
	// contains filtered or unexported fields
}

func (*DocupassService) Create

func (d *DocupassService) Create(req DocupassCreateRequest) (map[string]any, error)

Create creates a Docupass link (POST /docupass).

func (*DocupassService) Delete

func (d *DocupassService) Delete(reference string) (map[string]any, error)

Delete deletes a Docupass (DELETE /docupass/{reference}).

func (*DocupassService) Get

func (d *DocupassService) Get(reference string) (map[string]any, error)

Get retrieves a single Docupass (GET /docupass/{reference}).

func (*DocupassService) List

func (d *DocupassService) List(order, limit, offset int) (map[string]any, error)

List lists Docupass records (GET /docupass).

type InvalidArgumentError

type InvalidArgumentError struct{ Message string }

InvalidArgumentError is returned for invalid client-side arguments.

func (*InvalidArgumentError) Error

func (e *InvalidArgumentError) Error() string

type Option

type Option func(*Client) error

Option configures a Client.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the API base URL entirely (e.g. for an on-premise ID Fort host).

func WithHTTPClient

func WithHTTPClient(h *http.Client) Option

WithHTTPClient sets a custom *http.Client.

func WithRegion

func WithRegion(region string) Option

WithRegion sets the API region ("us" or "eu"). Overrides IDANALYZER_REGION.

type Profile

type Profile struct {
	ID       string
	Override map[string]any
}

Profile builds a KYC profile / profileOverride object that can be attached to scan, biometric and docupass calls, or used to create/update a stored profile via ProfileService.

func NewProfile

func NewProfile(profileID string) *Profile

NewProfile creates a Profile. If profileID is empty, SecurityNone is used.

func (*Profile) AAMVABarcodeParsing

func (p *Profile) AAMVABarcodeParsing(b bool) *Profile

func (*Profile) AutoCrop

func (p *Profile) AutoCrop(crop, advancedCrop bool) *Profile

AutoCrop enables cropping of the output image.

func (*Profile) CanvasSize

func (p *Profile) CanvasSize(pixels int) *Profile

func (*Profile) DecisionTrigger

func (p *Profile) DecisionTrigger(reviewTrigger, rejectTrigger float64) *Profile

DecisionTrigger sets the review/reject score triggers.

func (*Profile) InferFullName

func (p *Profile) InferFullName(b bool) *Profile

func (*Profile) ObjectDetection

func (p *Profile) ObjectDetection(b bool) *Profile

func (*Profile) Obscure

func (p *Profile) Obscure(fieldKeys []string) *Profile

func (*Profile) OrientationCorrection

func (p *Profile) OrientationCorrection(b bool) *Profile

func (*Profile) OutputImage

func (p *Profile) OutputImage(enable bool, format string) *Profile

OutputImage controls whether an output image is returned, and its format.

func (*Profile) OutputSize

func (p *Profile) OutputSize(pixels int) *Profile

func (*Profile) RestrictDocumentCountry

func (p *Profile) RestrictDocumentCountry(countryCodes string) *Profile

RestrictDocumentCountry restricts accepted issuing countries (ISO Alpha-2, comma separated).

func (*Profile) RestrictDocumentState

func (p *Profile) RestrictDocumentState(states string) *Profile

RestrictDocumentState restricts accepted issuing states (comma separated).

func (*Profile) RestrictDocumentType

func (p *Profile) RestrictDocumentType(documentType string) *Profile

RestrictDocumentType restricts accepted document types (e.g. "PD").

func (*Profile) SaveResult

func (p *Profile) SaveResult(saveTransaction, saveImages bool) *Profile

SaveResult controls whether transaction results and output images are stored.

func (*Profile) SetTimezone

func (p *Profile) SetTimezone(tz string) *Profile

func (*Profile) SetWarning

func (p *Profile) SetWarning(code string, enabled bool, reviewThreshold, rejectThreshold, weight float64) *Profile

SetWarning fine-tunes how a validation component affects the decision.

func (*Profile) SplitFirstName

func (p *Profile) SplitFirstName(b bool) *Profile

func (*Profile) Threshold

func (p *Profile) Threshold(key string, value float64) *Profile

Threshold sets a single validation threshold.

func (*Profile) TransactionAuditReport

func (p *Profile) TransactionAuditReport(b bool) *Profile

func (*Profile) Webhook

func (p *Profile) Webhook(url string) *Profile

type ProfileService

type ProfileService struct {
	// contains filtered or unexported fields
}

func (*ProfileService) Create

func (s *ProfileService) Create(name string, p *Profile) (map[string]any, error)

Create creates a KYC profile (POST /profile).

func (*ProfileService) Delete

func (s *ProfileService) Delete(profileID string) (map[string]any, error)

Delete deletes a KYC profile (DELETE /profile/{id}).

func (*ProfileService) Export

func (s *ProfileService) Export(profileID string) (map[string]any, error)

Export exports a KYC profile (GET /export/profile/{id}).

func (*ProfileService) Get

func (s *ProfileService) Get(profileID string) (map[string]any, error)

Get retrieves a KYC profile (GET /profile/{id}).

func (*ProfileService) List

func (s *ProfileService) List(order, limit, offset int) (map[string]any, error)

List lists KYC profiles (GET /profile).

func (*ProfileService) Update

func (s *ProfileService) Update(profileID, name string, p *Profile) (map[string]any, error)

Update updates a KYC profile (PUT /profile/{id}).

type ScanRequest

type ScanRequest struct {
	DocumentFront string // file path, base64, URL, or "ref:" cache reference (required)
	DocumentBack  string
	Face          string // selfie photo for biometric verification
	FaceVideo     string // selfie video for biometric verification
	Profile       *Profile

	RestrictCountry      string
	RestrictState        string
	RestrictType         string
	VerifyName           string
	VerifyDob            string // YYYY/MM/DD
	VerifyAge            string // e.g. "18-40"
	VerifyAddress        string
	VerifyPostcode       string
	VerifyDocumentNumber string
	ContractGenerate     string
	ContractFormat       string
	ContractPrefill      map[string]any
	IP                   string
	CustomData           string
}

ScanRequest holds the inputs and options for a standard scan (POST /scan).

type ScannerService

type ScannerService struct {
	// contains filtered or unexported fields
}

func (*ScannerService) QuickScan

func (s *ScannerService) QuickScan(documentFront, documentBack string, cacheImage bool) (map[string]any, error)

QuickScan initiates a quick OCR-only scan.

func (*ScannerService) Scan

func (s *ScannerService) Scan(req ScanRequest) (map[string]any, error)

Scan initiates a full identity document scan and optional biometric verification.

func (*ScannerService) VeryQuickScan

func (s *ScannerService) VeryQuickScan(documentFront, documentBack string, cacheImage bool) (map[string]any, error)

VeryQuickScan initiates a very fast OCR-only scan.

type TransactionListOptions

type TransactionListOptions struct {
	Order            int
	Limit            int
	Offset           int
	CreatedAtMin     int
	CreatedAtMax     int
	FilterCustomData string
	FilterDecision   string
	FilterDocupass   string
	FilterProfileID  string
}

TransactionListOptions holds filters for listing/exporting transactions.

type TransactionService

type TransactionService struct {
	// contains filtered or unexported fields
}

func (*TransactionService) Delete

func (t *TransactionService) Delete(transactionID string) (map[string]any, error)

Delete deletes a transaction (DELETE /transaction/{id}).

func (*TransactionService) Export

func (t *TransactionService) Export(dest, exportType string, transactionIDs []string, ignoreUnrecognized, ignoreDuplicate bool, opts TransactionListOptions) error

Export requests a transaction archive and downloads it to dest (POST /export/transaction).

func (*TransactionService) Get

func (t *TransactionService) Get(transactionID string) (map[string]any, error)

Get retrieves a single transaction (GET /transaction/{id}).

func (*TransactionService) List

List retrieves transaction history (GET /transaction).

func (*TransactionService) SaveFile

func (t *TransactionService) SaveFile(fileName, dest string) error

SaveFile downloads a vault file to dest (GET /filevault/{name}).

func (*TransactionService) SaveImage

func (t *TransactionService) SaveImage(imageToken, dest string) error

SaveImage downloads a vault image to dest (GET /imagevault/{token}).

func (*TransactionService) Update

func (t *TransactionService) Update(transactionID, decision string) (map[string]any, error)

Update updates a transaction decision (PATCH /transaction/{id}).

type WebhookService

type WebhookService struct {
	// contains filtered or unexported fields
}

func (*WebhookService) Delete

func (w *WebhookService) Delete(webhookID string) (map[string]any, error)

Delete deletes a webhook delivery log (DELETE /webhook/{id}).

func (*WebhookService) List

func (w *WebhookService) List(order, limit, offset int, event string, success int, createdAtMin, createdAtMax string) (map[string]any, error)

List lists webhook delivery logs (GET /webhook).

func (*WebhookService) Resend

func (w *WebhookService) Resend(webhookID string) (map[string]any, error)

Resend resends a webhook delivery (POST /webhook/{id}).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL