Skip to main content
The @artu-ai/compliance-sdk package is the recommended way to interact with the Artu Compliance API from TypeScript or JavaScript. It provides full type safety, async iterators, and convenient helper methods built on top of the HTTP API.

Installation

Instantiation

The API key can also be read automatically from the ARTU_API_KEY environment variable if apiKey is omitted.

Constructor Options

string
Your Artu API key. If omitted, the SDK reads the ARTU_API_KEY environment variable.
'test' | 'live'
default:"test"
Target environment. "test" uses isolated test data; "live" targets production data and regulatory submissions.Can also be set via the ARTU_ENVIRONMENT environment variable.
Scope
Constrains the SDK to a specific compliance scope/activity. Uses colon-separated format, for example "MX", "MX:AV:AVI", or "MX:CNBV:TRANSMISOR".When set, create operations default to that scope and list operations filter by it automatically.
string
Override the API base URL. Defaults to https://api.artu.ai. Useful for local development.Can also be set via the ARTU_BASE_URL environment variable.
number
default:"30000"
Request timeout in milliseconds.
boolean
default:"false"
When true, the SDK validates postal code format client-side before sending address requests. Mirror your tenant’s postal-code setting here for consistent behavior.

Instance Properties

Environment

Scope

Resources

The SDK exposes the following resource managers:

Scoped SDK Instances

Passing a scope option to the constructor returns a strongly-typed SDK instance whose resource methods accept and return scope-specific model types. TypeScript infers the correct return type automatically:
When the SDK is scoped:
  • Create operations automatically apply the scope to new records.
  • List operations automatically filter to records in that scope.
  • Models returned are the narrowed type for that scope (e.g. MexAVIClient instead of Client), giving direct access to scope-specific fields without type guards.

Scoped Sub-Exports

For tree-shaking or when you want to import the fully typed SDK class for a specific scope directly, use the sub-entry points:
Each sub-export exposes a ComplianceSDK class whose constructor does not require a scope option (the scope is baked in), and whose resources are fully typed for that scope. Sub-exports also expose scope-specific Enums and TypeGuards namespaces:

Available Scopes

For the full per-scope field reference, see the Scopes tab. For Mexico-specific validators (RFC, CURP, CLABE), see the Mexico page.

Type Exports

The SDK re-exports all types you need for integration:

Error Handling

All SDK methods throw typed errors on failure. See Errors for the full error reference.