Documentation
¶
Overview ¶
Package sanctionskit provides a server-side client for the SanctionsKit API. It screens subjects against selected coverage and retrieves retained results, evidence, and source availability. A screening result supports human review; it does not approve onboarding or provide legal clearance.
The free sandbox uses synthetic records. Production screening requires paid access. See https://www.sanctionskit.com/docs/quickstart for account and key setup.
Index ¶
- type APIError
- type Client
- func (c *Client) CreateScreening(ctx context.Context, input ScreeningRequest, idempotencyKey string) (*Response[ScreeningResult], error)
- func (c *Client) GetEvidence(ctx context.Context, id string) (*EvidenceResponse, error)
- func (c *Client) GetResult(ctx context.Context, id string) (*Response[RetainedResult], error)
- func (c *Client) ListSources(ctx context.Context) (*Response[[]Source], error)
- type ClientError
- type Coverage
- type Evidence
- type EvidenceResponse
- type Identifier
- type Match
- type Options
- type PolicyReference
- type Response
- type RetainedResult
- type ScreeningRequest
- type ScreeningResult
- type Source
- type Subject
- type Versions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
APIError describes a non-success HTTP response. It intentionally excludes arbitrary server messages and bodies, which can contain submitted information.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is safe for concurrent use after construction. It does not log requests or responses and adds no application-level automatic retries.
func New ¶
New constructs a client. A zero timeout uses 30 seconds; a zero response limit uses 16 MiB. Limits above 120 seconds or 64 MiB are rejected.
func (*Client) CreateScreening ¶
func (c *Client) CreateScreening(ctx context.Context, input ScreeningRequest, idempotencyKey string) (*Response[ScreeningResult], error)
CreateScreening screens one subject. Persist idempotencyKey before sending; retries of the same business operation must keep its key and body unchanged. Requires screenings:write. The server remains authoritative on policy/access.
func (*Client) GetEvidence ¶
GetEvidence retrieves the direct JSON evidence document and its exact bytes. Requires results:read. It checks the format and result ID before returning it.
type ClientError ¶
ClientError reports validation, transport, or response-format failures without embedding the key, request URL, submitted subject, or response body.
func (*ClientError) Error ¶
func (e *ClientError) Error() string
func (*ClientError) Unwrap ¶
func (e *ClientError) Unwrap() error
Unwrap exposes only context cancellation or deadline errors, never a raw transport error containing a URL or user data.
type Coverage ¶
type Coverage struct {
SourceID string `json:"sourceId"`
Version string `json:"version"`
RetrievedAt string `json:"retrievedAt"`
Fresh bool `json:"fresh"`
// PublishedAt can be a date or a timestamp. Preserve its original precision.
PublishedAt *string `json:"publishedAt,omitempty"`
SourceNotice json.RawMessage `json:"sourceNotice,omitempty"`
}
Coverage preserves exact source versions and freshness. The complete original object, including additional publisher notices, remains in Response.RawJSON.
type Evidence ¶
type Evidence struct {
Format string `json:"format"`
Result ScreeningResult `json:"result"`
Retention string `json:"retention"`
ExpiresAt *string `json:"expires_at"`
Subject *Subject `json:"subject"`
Reference *string `json:"reference"`
Request *ScreeningRequest `json:"request"`
RetainedInputs bool `json:"retainedInputs"`
ReplayLimit *string `json:"replayLimit"`
}
Evidence is the raw evidence document's typed view. Nullable fields remain nil. The document is not a signed attestation or compliance certification.
type EvidenceResponse ¶
type EvidenceResponse struct {
Evidence Evidence
RequestID string
RawJSON json.RawMessage
}
EvidenceResponse keeps the direct evidence document separate from ordinary API data envelopes. RawJSON contains the unchanged downloaded document.
type Identifier ¶
type Identifier struct {
Type string `json:"type"`
Value string `json:"value"`
Issuer string `json:"issuer,omitempty"`
}
Identifier is an original identifier and its scheme, with an optional issuer.
type Match ¶
type Match struct {
Score float64 `json:"score"`
Record json.RawMessage `json:"record"`
Evidence json.RawMessage `json:"evidence"`
Conflicts []string `json:"conflicts"`
Assessment json.RawMessage `json:"assessment,omitempty"`
}
Match contains a candidate and its supporting evidence. Raw nested objects preserve varying publisher fields without inventing a common record schema.
type Options ¶
type Options struct {
BaseURL string
HTTPClient *http.Client
Timeout time.Duration
MaxResponseBytes int64
}
Options customizes transport limits. BaseURL defaults to the canonical hosted API. Plain HTTP is allowed only for literal loopback hosts or localhost. HTTPClient is copied; its redirect policy is always replaced with refusal.
type PolicyReference ¶
PolicyReference identifies one exact approved organization policy version.
type Response ¶
type Response[T any] struct { Data T RequestID string RawJSON json.RawMessage }
Response contains parsed data, a correlation ID when supplied, and the exact original JSON response bytes. Keep RawJSON in access-controlled storage.
type RetainedResult ¶
type RetainedResult struct {
ScreeningResult
Subject *Subject `json:"subject"`
Reference *string `json:"reference"`
}
RetainedResult adds retained inputs. Subject and Reference are nil when absent under the retention policy. They are not reconstructed by the client.
type ScreeningRequest ¶
type ScreeningRequest struct {
Subject Subject `json:"subject"`
CounterpartyID string `json:"counterpartyId,omitempty"`
Policy *PolicyReference `json:"policy,omitempty"`
Reference string `json:"reference,omitempty"`
Sources []string `json:"sources,omitempty"`
Package string `json:"package,omitempty"`
Retention string `json:"retention,omitempty"`
}
ScreeningRequest selects exactly one of Package or Sources. Policies and organization controls may require standard retention or restrict coverage.
type ScreeningResult ¶
type ScreeningResult struct {
ID string `json:"id"`
Environment string `json:"environment"`
Status string `json:"status"`
CreatedAt string `json:"createdAt"`
Matches []Match `json:"matches"`
Coverage []Coverage `json:"coverage"`
Versions Versions `json:"versions"`
Disclaimer string `json:"disclaimer"`
PolicySnapshot json.RawMessage `json:"policySnapshot,omitempty"`
Matching json.RawMessage `json:"matching,omitempty"`
}
ScreeningResult is the original screening outcome. Status is potential_match or no_match. Neither status is an approval decision.
type Source ¶
type Source struct {
ID string `json:"id"`
Name string `json:"name"`
Authority string `json:"authority"`
Availability string `json:"availability"`
Capabilities []string `json:"capabilities"`
RightsStatus string `json:"rightsStatus"`
Category string `json:"category"`
Jurisdiction string `json:"jurisdiction,omitempty"`
Homepage string `json:"homepage,omitempty"`
DisabledReason string `json:"disabledReason,omitempty"`
Fresh *bool `json:"fresh,omitempty"`
Qualification json.RawMessage `json:"qualification,omitempty"`
CurrentVersion json.RawMessage `json:"currentVersion,omitempty"`
LastImport json.RawMessage `json:"lastImport,omitempty"`
}
Source describes current availability and supported entity types. Presence in the catalog alone does not mean a source can be used for a screening.
type Subject ¶
type Subject struct {
Name string `json:"name"`
EntityType string `json:"entityType,omitempty"`
Identifiers []Identifier `json:"identifiers,omitempty"`
BirthDate string `json:"birthDate,omitempty"`
Country string `json:"country,omitempty"`
}
Subject contains known identity information. BirthDate preserves the supplied precision: YYYY, YYYY-MM, or YYYY-MM-DD. Omit unknown optional fields.