Documentation
¶
Overview ¶
Package idanalyzer is the official Go client library for the ID Analyzer API v2.
It targets the api2.idanalyzer.com endpoint (US, default) or api2-eu.idanalyzer.com (EU). Create a client with NewClient and use the service fields (Scanner, Biometric, AML, KYB, Contract, Transaction, Docupass, Profile, Webhook, Account).
Index ¶
- Constants
- func ParseInput(input string, allowCache bool) (string, error)
- type AMLSearchRequest
- type AMLService
- type APIError
- type AccountService
- type BiometricService
- type Client
- type ContractService
- func (c *ContractService) CreateTemplate(name, content, orientation, timezone, font string) (map[string]any, error)
- func (c *ContractService) DeleteTemplate(templateID string) (map[string]any, error)
- func (c *ContractService) Generate(templateID, format, transactionID string, fillData map[string]any) (map[string]any, error)
- func (c *ContractService) GetTemplate(templateID string) (map[string]any, error)
- func (c *ContractService) ListTemplate(order, limit, offset int, filterTemplateID string) (map[string]any, error)
- func (c *ContractService) UpdateTemplate(templateID, name, content, orientation, timezone, font string) (map[string]any, error)
- type DocupassCreateRequest
- type DocupassService
- func (d *DocupassService) Create(req DocupassCreateRequest) (map[string]any, error)
- func (d *DocupassService) Delete(reference string) (map[string]any, error)
- func (d *DocupassService) Get(reference string) (map[string]any, error)
- func (d *DocupassService) List(order, limit, offset int) (map[string]any, error)
- type InvalidArgumentError
- type KYBService
- type KYBVerifyRequest
- type Option
- type Profile
- func (p *Profile) AAMVABarcodeParsing(b bool) *Profile
- func (p *Profile) AutoCrop(crop, advancedCrop bool) *Profile
- func (p *Profile) CanvasSize(pixels int) *Profile
- func (p *Profile) DecisionTrigger(reviewTrigger, rejectTrigger float64) *Profile
- func (p *Profile) InferFullName(b bool) *Profile
- func (p *Profile) ObjectDetection(b bool) *Profile
- func (p *Profile) Obscure(fieldKeys []string) *Profile
- func (p *Profile) OrientationCorrection(b bool) *Profile
- func (p *Profile) OutputImage(enable bool, format string) *Profile
- func (p *Profile) OutputSize(pixels int) *Profile
- func (p *Profile) RestrictDocumentCountry(countryCodes string) *Profile
- func (p *Profile) RestrictDocumentState(states string) *Profile
- func (p *Profile) RestrictDocumentType(documentType string) *Profile
- func (p *Profile) SaveResult(saveTransaction, saveImages bool) *Profile
- func (p *Profile) SetTimezone(tz string) *Profile
- func (p *Profile) SetWarning(code string, enabled bool, reviewThreshold, rejectThreshold, weight float64) *Profile
- func (p *Profile) SplitFirstName(b bool) *Profile
- func (p *Profile) Threshold(key string, value float64) *Profile
- func (p *Profile) TransactionAuditReport(b bool) *Profile
- func (p *Profile) Webhook(url string) *Profile
- type ProfileService
- func (s *ProfileService) Create(name string, p *Profile) (map[string]any, error)
- func (s *ProfileService) Delete(profileID string) (map[string]any, error)
- func (s *ProfileService) Export(profileID string) (map[string]any, error)
- func (s *ProfileService) Get(profileID string) (map[string]any, error)
- func (s *ProfileService) List(order, limit, offset int) (map[string]any, error)
- func (s *ProfileService) Update(profileID, name string, p *Profile) (map[string]any, error)
- type ScanRequest
- type ScannerService
- type TransactionListOptions
- type TransactionService
- func (t *TransactionService) Delete(transactionID string) (map[string]any, error)
- func (t *TransactionService) Export(dest, exportType string, transactionIDs []string, ...) error
- func (t *TransactionService) Get(transactionID string) (map[string]any, error)
- func (t *TransactionService) List(opts TransactionListOptions) (map[string]any, error)
- func (t *TransactionService) SaveFile(fileName, dest string) error
- func (t *TransactionService) SaveImage(imageToken, dest string) error
- func (t *TransactionService) Update(transactionID, decision string) (map[string]any, error)
- type WebhookService
Constants ¶
const ( SecurityNone = "security_none" // no enforced validation rules SecurityLow = "security_low" // minimal validation SecurityMedium = "security_medium" // balanced validation SecurityHigh = "security_high" // strictest validation )
Preset KYC profile IDs. These built-in profiles select progressively stricter verification rules and can be passed to NewProfile.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AMLSearchRequest ¶
type AMLSearchRequest struct {
Name string // full name of the person or entity to screen
IDNumber string // government/registration ID number to screen
Entity int // 0=Person, 1=Corporation/Legal Entity
Country string // ISO Alpha-2 country to bias/limit the search
Database []string // specific watchlist databases to query (default: all)
BirthYear string // year of birth, to disambiguate matches
}
AMLSearchRequest holds parameters for an AML v1 search (POST /aml). Either Name or IDNumber must be set.
type AMLService ¶
type AMLService struct {
// contains filtered or unexported fields
}
AMLService provides anti-money-laundering / sanctions screening operations. Access it via Client.AML.
func (*AMLService) Search ¶
func (a *AMLService) Search(req AMLSearchRequest) (map[string]any, error)
Search screens a name or ID number against the AML watchlists (POST /aml). It returns the decoded JSON response, or an error.
func (*AMLService) SearchV3 ¶
SearchV3 screens against the AML v3 database (POST /amlv3). Provide either a free-text query (text) or a record id; limit caps the number of results (sent only when positive) and page selects the result page (1-based, sent only when positive). It returns the decoded JSON response, or an error.
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
AccountService provides access to the authenticated account's profile and usage. Access it via Client.Account.
type BiometricService ¶
type BiometricService struct {
// contains filtered or unexported fields
}
BiometricService provides face matching and liveness operations. Access it via Client.Biometric.
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). profile (required) selects the KYC profile; referenceFaceImage (required) is the known face to match against; supply exactly one of facePhoto or faceVideo as the live capture to verify; customData is an optional string echoed on the transaction. It returns the decoded JSON response, or an error.
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). profile (required) selects the KYC profile; supply exactly one of facePhoto or faceVideo as the live capture; customData is an optional string echoed on the transaction. It returns the decoded JSON response, or an error.
type Client ¶
type Client struct {
Scanner *ScannerService
Biometric *BiometricService
AML *AMLService
KYB *KYBService
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.
type ContractService ¶
type ContractService struct {
// contains filtered or unexported fields
}
ContractService provides contract/document template management and document generation. Access it via Client.Contract.
func (*ContractService) CreateTemplate ¶
func (c *ContractService) CreateTemplate(name, content, orientation, timezone, font string) (map[string]any, error)
CreateTemplate creates a contract template (POST /contract). name and content (the template HTML body) are required; orientation, timezone and font set the rendering options. It returns the decoded JSON response, or an error.
func (*ContractService) DeleteTemplate ¶
func (c *ContractService) DeleteTemplate(templateID string) (map[string]any, error)
DeleteTemplate deletes the contract template identified by templateID (required) (DELETE /contract/{id}). It returns the decoded JSON response, or an error.
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). templateID (required) names the template; format defaults to "PDF" when empty; transactionID optionally links the document to an existing transaction whose data prefills the template; fillData supplies additional key/value pairs. It returns the decoded JSON response, or an error.
func (*ContractService) GetTemplate ¶
func (c *ContractService) GetTemplate(templateID string) (map[string]any, error)
GetTemplate retrieves a contract template by its templateID (required) (GET /contract/{id}). It returns the decoded JSON response, or an error.
func (*ContractService) ListTemplate ¶
func (c *ContractService) ListTemplate(order, limit, offset int, filterTemplateID string) (map[string]any, error)
ListTemplate lists contract templates (GET /contract). order sets the sort direction (1 ascending, -1 descending), limit caps the page size, offset skips records for pagination, and filterTemplateID (when non-empty) returns only the matching template. It returns the decoded JSON response, or an error.
func (*ContractService) UpdateTemplate ¶
func (c *ContractService) UpdateTemplate(templateID, name, content, orientation, timezone, font string) (map[string]any, error)
UpdateTemplate updates the contract template identified by templateID (required) (POST /contract/{id}). name, content, orientation, timezone and font replace the stored template's corresponding fields. It returns the decoded JSON response, or an error.
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 // generated contract format (default "pdf")
ContractGenerate string // contract template ID to generate and present
ContractSign string // contract template ID requiring an e-signature
ContractPrefill string // key/value data (JSON) merged into the contract
Reusable bool // allow the link to be used more than once
CustomData string // arbitrary string echoed on the transaction
Language string // UI language code for the hosted page
ReferenceDocument string // reference document front to match against
ReferenceDocumentBack string // reference document back to match against
ReferenceFace string // reference face image to match against
UserPhone string // end-user phone number (e.g. for SMS delivery)
VerifyAddress string // assert the holder's address matches this value
VerifyAge string // assert the age falls in this range, e.g. "18-40"
VerifyDOB string // assert the date of birth; docupass uses the upper-case "verifyDOB" field
VerifyDocumentNumber string // assert the document number matches this value
VerifyName string // assert the holder's name matches this value
VerifyPostcode string // assert the postcode matches this value
}
DocupassCreateRequest holds parameters for creating a Docupass (POST /docupass). Profile is required; all other fields are optional.
type DocupassService ¶
type DocupassService struct {
// contains filtered or unexported fields
}
DocupassService provides hosted-verification ("Docupass") link management. Access it via Client.Docupass.
func (*DocupassService) Create ¶
func (d *DocupassService) Create(req DocupassCreateRequest) (map[string]any, error)
Create creates a Docupass hosted-verification link from req (POST /docupass). req.Profile is required. It returns the decoded JSON response, or an error.
func (*DocupassService) Delete ¶
func (d *DocupassService) Delete(reference string) (map[string]any, error)
Delete deletes the Docupass identified by reference (required) (DELETE /docupass/{reference}). It returns the decoded JSON response, or an error.
func (*DocupassService) Get ¶
func (d *DocupassService) Get(reference string) (map[string]any, error)
Get retrieves the single Docupass identified by reference (required) (GET /docupass/{reference}). It returns the decoded JSON response, or an error.
func (*DocupassService) List ¶
func (d *DocupassService) List(order, limit, offset int) (map[string]any, error)
List lists Docupass records (GET /docupass). order sets the sort direction (1 ascending, -1 descending), limit caps the page size and offset skips records for pagination. It returns the decoded JSON response, or an error.
type InvalidArgumentError ¶
type InvalidArgumentError struct{ Message string }
InvalidArgumentError is returned for invalid client-side arguments.
func (*InvalidArgumentError) Error ¶
func (e *InvalidArgumentError) Error() string
type KYBService ¶ added in v1.1.0
type KYBService struct {
// contains filtered or unexported fields
}
KYBService provides Know Your Business (KYB) verification: it verifies a business from its registration/incorporation document by extracting the company details, checking official company registries, screening against sanctions/PEP watchlists, and returning directors and owners to verify. Access it via Client.KYB.
func (*KYBService) Verify ¶ added in v1.1.0
func (k *KYBService) Verify(req KYBVerifyRequest) (map[string]any, error)
Verify verifies a business from its registration/incorporation document (POST /kyb). A document is required; an optional profile selects the KYC profile. It extracts the company details, checks official company registries, screens against sanctions/PEP watchlists, and returns directors and owners to verify. It returns the decoded JSON response, or an error.
type KYBVerifyRequest ¶ added in v1.1.0
type KYBVerifyRequest struct {
Document string // registration/incorporation document: file path, raw base64, URL, or data URL (required)
Profile string // optional KYC profile to apply to the verification
}
KYBVerifyRequest holds parameters for a business verification (POST /kyb). A Document is required; Profile is optional.
type Option ¶
Option configures a Client.
func WithBaseURL ¶
WithBaseURL overrides the API base URL entirely (e.g. for an on-premise ID Fort host).
func WithHTTPClient ¶
WithHTTPClient sets a custom *http.Client.
func WithRegion ¶
WithRegion sets the API region ("us" or "eu"). Overrides IDANALYZER_REGION.
type Profile ¶
type Profile struct {
ID string // preset or stored profile ID (see the Security* constants)
Override map[string]any // per-call setting overrides applied on top of the profile
}
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. Its setter methods mutate the receiver and return it, so they can be chained.
func NewProfile ¶
NewProfile creates a Profile. If profileID is empty, SecurityNone is used.
func (*Profile) AAMVABarcodeParsing ¶
AAMVABarcodeParsing enables parsing of the AAMVA PDF417 barcode on North American IDs. It returns the receiver for chaining.
func (*Profile) AutoCrop ¶
AutoCrop enables cropping of the output image. crop enables basic edge cropping; advancedCrop enables perspective-corrected cropping. It returns the receiver for chaining.
func (*Profile) CanvasSize ¶
CanvasSize sets the maximum dimension, in pixels, to which input images are scaled before processing. It returns the receiver for chaining.
func (*Profile) DecisionTrigger ¶
DecisionTrigger sets the aggregate score triggers that move a transaction to "review" (reviewTrigger) or "reject" (rejectTrigger). It returns the receiver for chaining.
func (*Profile) InferFullName ¶
InferFullName enables deriving the full name when only name parts are present. It returns the receiver for chaining.
func (*Profile) ObjectDetection ¶
ObjectDetection enables detection of physical/screen/printout document presentation. It returns the receiver for chaining.
func (*Profile) Obscure ¶
Obscure lists result field keys whose values should be redacted from the response. It returns the receiver for chaining.
func (*Profile) OrientationCorrection ¶
OrientationCorrection enables automatic rotation of misaligned document images. It returns the receiver for chaining.
func (*Profile) OutputImage ¶
OutputImage controls whether an output image is returned and, when enable is true, its format (e.g. "jpg" or "png"). It returns the receiver for chaining.
func (*Profile) OutputSize ¶
OutputSize sets the maximum dimension, in pixels, of returned output images. It returns the receiver for chaining.
func (*Profile) RestrictDocumentCountry ¶
RestrictDocumentCountry restricts accepted issuing countries to countryCodes (ISO Alpha-2, comma separated). It returns the receiver for chaining.
func (*Profile) RestrictDocumentState ¶
RestrictDocumentState restricts accepted issuing states to states (comma separated). It returns the receiver for chaining.
func (*Profile) RestrictDocumentType ¶
RestrictDocumentType restricts accepted document types to documentType (a combination of the type codes, e.g. "PD" for passport and driver license). It returns the receiver for chaining.
func (*Profile) SaveResult ¶
SaveResult controls whether transaction results and output images are stored. saveTransaction enables persisting the transaction record; saveImages (honored only when saveTransaction is true) also stores the images. It returns the receiver for chaining.
func (*Profile) SetTimezone ¶
SetTimezone sets the timezone (e.g. "America/New_York") used for timestamps in results and reports. It returns the receiver for chaining.
func (*Profile) SetWarning ¶
func (p *Profile) SetWarning(code string, enabled bool, reviewThreshold, rejectThreshold, weight float64) *Profile
SetWarning fine-tunes how the validation component identified by code affects the decision: enabled toggles the component, reviewThreshold and rejectThreshold set its per-component score triggers, and weight scales its contribution. It returns the receiver for chaining.
func (*Profile) SplitFirstName ¶
SplitFirstName enables splitting a combined first/middle name into separate fields. It returns the receiver for chaining.
func (*Profile) Threshold ¶
Threshold sets a single named validation threshold (key) to value within the profile's thresholds map. It returns the receiver for chaining.
func (*Profile) TransactionAuditReport ¶
TransactionAuditReport enables generation of a PDF audit report for the transaction. It returns the receiver for chaining.
type ProfileService ¶
type ProfileService struct {
// contains filtered or unexported fields
}
ProfileService provides server-side KYC profile management. Access it via Client.Profile.
func (*ProfileService) Create ¶
Create creates a KYC profile (POST /profile). name (required) is the profile label; the optional p supplies the profile's settings via its Override map. It returns the decoded JSON response, or an error.
func (*ProfileService) Delete ¶
func (s *ProfileService) Delete(profileID string) (map[string]any, error)
Delete deletes the KYC profile identified by profileID (required) (DELETE /profile/{id}). It returns the decoded JSON response, or an error.
func (*ProfileService) Export ¶
func (s *ProfileService) Export(profileID string) (map[string]any, error)
Export exports the full settings of the KYC profile identified by profileID (required) (GET /export/profile/{id}). It returns the decoded JSON response, or an error.
func (*ProfileService) Get ¶
func (s *ProfileService) Get(profileID string) (map[string]any, error)
Get retrieves the KYC profile identified by profileID (required) (GET /profile/{id}). It returns the decoded JSON response, or an error.
func (*ProfileService) List ¶
func (s *ProfileService) List(order, limit, offset int) (map[string]any, error)
List lists KYC profiles (GET /profile). order sets the sort direction (1 ascending, -1 descending), limit caps the page size and offset skips records for pagination. It returns the decoded JSON response, or an error.
type ScanRequest ¶
type ScanRequest struct {
DocumentFront string // file path, base64, URL, or "ref:" cache reference (required)
DocumentBack string // back of the document, same accepted forms as DocumentFront
Face string // selfie photo for biometric verification
FaceVideo string // selfie video for biometric verification (used when Face is empty)
Profile *Profile // KYC profile to apply (required; build with NewProfile)
RestrictCountry string // accept only these issuing countries (ISO Alpha-2, comma separated)
RestrictState string // accept only these issuing states (comma separated)
RestrictType string // accept only these document types (e.g. "PD")
VerifyName string // assert the holder's name matches this value
VerifyDob string // assert the date of birth (YYYY/MM/DD)
VerifyAge string // assert the age falls in this range, e.g. "18-40"
VerifyAddress string // assert the holder's address matches this value
VerifyPostcode string // assert the postcode matches this value
VerifyDocumentNumber string // assert the document number matches this value
ContractGenerate string // contract template ID to fill from the scan result
ContractFormat string // generated contract format (e.g. "PDF")
ContractPrefill map[string]any // extra key/value data merged into the contract
IP string // end-user IP address, for geolocation/risk signals
CustomData string // arbitrary string echoed back on the transaction
}
ScanRequest holds the inputs and options for a standard scan (POST /scan). DocumentFront and Profile are required; all other fields are optional.
type ScannerService ¶
type ScannerService struct {
// contains filtered or unexported fields
}
ScannerService provides identity document scanning operations. Access it via Client.Scanner.
func (*ScannerService) QuickScan ¶
func (s *ScannerService) QuickScan(documentFront, documentBack string, cacheImage bool) (map[string]any, error)
QuickScan initiates a quick OCR-only scan. documentFront (required) and documentBack accept a file path, base64 string or URL. When cacheImage is true the uploaded image is retained server-side so it can be reused via a "ref:" reference. It returns the decoded JSON response, or an error.
func (*ScannerService) Scan ¶
func (s *ScannerService) Scan(req ScanRequest) (map[string]any, error)
Scan initiates a full identity document scan and optional biometric verification. The request's DocumentFront and Profile fields are required; it returns the decoded JSON response as a map, or an error (including *InvalidArgumentError for missing inputs and *APIError for an API-reported failure).
func (*ScannerService) VeryQuickScan ¶
func (s *ScannerService) VeryQuickScan(documentFront, documentBack string, cacheImage bool) (map[string]any, error)
VeryQuickScan initiates a very fast OCR-only scan. Its parameters and return value match QuickScan; it trades accuracy for lower latency.
type TransactionListOptions ¶
type TransactionListOptions struct {
Order int // sort direction: 1 ascending, -1 descending (default -1)
Limit int // maximum records to return (default 10)
Offset int // records to skip, for pagination
CreatedAtMin int // earliest creation time, Unix seconds (0 = no bound)
CreatedAtMax int // latest creation time, Unix seconds (0 = no bound)
FilterCustomData string // match the transaction's customData field
FilterDecision string // match the decision: "accept", "review" or "reject"
FilterDocupass string // match the originating Docupass reference
FilterProfileID string // match the KYC profile ID used
}
TransactionListOptions holds filters for listing/exporting transactions. The zero value is valid: Order defaults to -1 (descending) and Limit to 10.
type TransactionService ¶
type TransactionService struct {
// contains filtered or unexported fields
}
TransactionService provides access to stored transaction records and the image/file vault. Access it via Client.Transaction.
func (*TransactionService) Delete ¶
func (t *TransactionService) Delete(transactionID string) (map[string]any, error)
Delete deletes the transaction identified by transactionID (required) (DELETE /transaction/{id}). It returns the decoded JSON response, or an error.
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 the local path dest (required) (POST /export/transaction). exportType is "csv" (default when empty) or "json". transactionIDs, when non-empty, exports only those records; otherwise the date and filter fields of opts (CreatedAtMin/Max, FilterCustomData/Decision/Docupass/ProfileID) select the set. ignoreUnrecognized and ignoreDuplicate skip those records. It returns an error on bad arguments, an API error, or a download failure.
func (*TransactionService) Get ¶
func (t *TransactionService) Get(transactionID string) (map[string]any, error)
Get retrieves the single transaction identified by transactionID (required) (GET /transaction/{id}). It returns the decoded JSON response, or an error.
func (*TransactionService) List ¶
func (t *TransactionService) List(opts TransactionListOptions) (map[string]any, error)
List retrieves transaction history filtered and paginated by opts (GET /transaction). It returns the decoded JSON response, or an error.
func (*TransactionService) SaveFile ¶
func (t *TransactionService) SaveFile(fileName, dest string) error
SaveFile downloads the vault file named fileName (required) and writes it to the local path dest (required) (GET /filevault/{name}). It returns an error if the arguments are missing or the download fails.
func (*TransactionService) SaveImage ¶
func (t *TransactionService) SaveImage(imageToken, dest string) error
SaveImage downloads the vault image identified by imageToken (required) and writes it to the local path dest (required) (GET /imagevault/{token}). It returns an error if the arguments are missing or the download fails.
func (*TransactionService) Update ¶
func (t *TransactionService) Update(transactionID, decision string) (map[string]any, error)
Update overrides the decision on the transaction identified by transactionID (required) (PATCH /transaction/{id}). decision must be one of "accept", "review" or "reject". It returns the decoded JSON response, or an error.
type WebhookService ¶
type WebhookService struct {
// contains filtered or unexported fields
}
WebhookService provides access to webhook delivery logs. Access it via Client.Webhook.
func (*WebhookService) Delete ¶
func (w *WebhookService) Delete(webhookID string) (map[string]any, error)
Delete deletes the webhook delivery log identified by webhookID (required) (DELETE /webhook/{id}). It returns the decoded JSON response, or an error.
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). order sets the sort direction (1 ascending, -1 descending); limit and offset paginate; event (when non-empty) filters by event name; success filters by delivery outcome (0 failed, 1 succeeded — any other value applies no filter); createdAtMin and createdAtMax (when non-empty) bound the creation time. It returns the decoded JSON response, or an error.