Skip to main content
The SDK supports two environments for development and production use.

Available Environments

EnvironmentDescriptionUse Case
testSandbox environmentDevelopment, testing, demos
liveProduction environmentReal data, production use

Configuration

import { ComplianceSDK } from "@artu-ai/compliance-sdk";

// Test environment
const testSDK = new ComplianceSDK({
  apiKey: process.env.ARTU_API_KEY!,
  environment: "test",
});

// Live environment
const liveSDK = new ComplianceSDK({
  apiKey: process.env.ARTU_API_KEY!,
  environment: "live",
});

API Key Permissions

API keys have scoped permissions that control which environments they can access. A single key can have permissions for test, live, or both environments.
See API Keys for details on the {env}:{resource}: {operation} permission pattern.

Environment Properties

Check the current environment at runtime:
// Environment name
sdk.environment; // "test" | "live"

// Boolean checks
sdk.isTest; // true if test environment
sdk.isLive; // true if live environment

Test Environment Features

The test environment:
  • Uses separate, isolated data from production
  • May have relaxed rate limits for testing
  • Supports test data patterns for validation
Test data created in the test environment is completely isolated from production.

Live Environment Features

The live environment:
  • Contains real production data
  • Has production rate limits
  • Requires validated and verified API keys
Be careful when working in the live environment. Operations affect real data and may have regulatory implications.

Environment-Specific Logic

You can implement environment-specific logic:
const sdk = new ComplianceSDK({
  apiKey: process.env.ARTU_API_KEY!,
  environment: process.env.NODE_ENV === "production" ? "live" : "test",
});

// Guard against accidental live operations
async function deleteClient(clientId: string) {
  if (sdk.isLive) {
    const confirmed = await confirmDeletion();
    if (!confirmed) return;
  }

  await sdk.clients.delete(clientId);
}

Best Practices

Use Environment Variables

const sdk = new ComplianceSDK({
  apiKey: process.env.ARTU_API_KEY!,
  environment: process.env.ARTU_ENVIRONMENT as "test" | "live",
});

Match Environment to Deployment

const sdk = new ComplianceSDK({
  apiKey: process.env.ARTU_API_KEY!,
  environment: process.env.NODE_ENV === "production" ? "live" : "test",
});

Add Safety Checks

// Prevent accidental production operations in development
if (process.env.NODE_ENV !== "production" && sdk.isLive) {
  throw new Error("Cannot use live environment in development mode");
}

Log Environment

console.log(`SDK initialized in ${sdk.environment} environment`);

if (sdk.isLive) {
  console.warn("⚠️  Running in LIVE environment - real data will be affected");
}