Documentation menu

Reference

TypeScript SDK

Typed clients for Node.js, Electron, and the browser.

Other languages

Official runtime SDKs with the same API (license, validate, activate, lease, verify_lease). Each one checks every response's signature and derives the same device ID.

LanguageInstallNotes
C++CMakeC++17; nothing to install on Windows, libcurl on macOS/Linux
C# / VB.NET / Unitydotnet add package Atlas.LicensingNo dependencies; .NET Framework 4.6.1+
Pythonpip install atlas-licensingPython 3.8+
Rustcargo add atlas-licensingBlocking client
Gogo get github.com/atlasinfra/atlas-goStandard library only
Java / Kotlincloud.atlasinfra:atlas-licensingJava 17+, no dependencies
PHPcomposer require atlasinfra/atlas-licensingext-curl, ext-sodium

Install

bash
npm install @atlas/sdk

Works in Node.js 18+, Electron, and modern browsers, with full TypeScript types and no dependencies.

In your app: AtlasRuntime

Uses your publishable key.

ts
import { AtlasRuntime } from "@atlas/sdk";

const atlas = new AtlasRuntime({ publishableKey: "pk_live_..." });

await atlas.activate({ license_key, product_id, device: { id: machineId } });
await atlas.validate({ license_key, product_id, device: { id: machineId } });
await atlas.deactivate({ license_key, product_id, device_id: machineId });
await atlas.lease({ license_key, product_id, device: { id: machineId } });
await atlas.signingKey();

On your server: AtlasClient

Uses a secret key.

ts
import { AtlasClient } from "@atlas/sdk";

const atlas = new AtlasClient({ apiKey: process.env.ATLAS_SECRET_KEY! });

const { product } = await atlas.products.create({ name: "Fieldwork Desktop" });

const { policy } = await atlas.policies.create({
  product_id: product.id,
  name: "Annual, 3 devices",
  license_type: "timed",
  duration_days: 365,
  activation_limit: 3,
  grace_days: 14,
  default_entitlements: { plan: "pro" },
});

const issued = await atlas.licenses.create({
  product_id: product.id,
  policy_id: policy.id,
  customer: { external_id: "cus_123", email: "jo@example.com" },
});
console.log(issued.key);

const id = issued.license.id;
await atlas.licenses.suspend(id);
await atlas.licenses.reinstate(id);
await atlas.licenses.renew(id, "2027-10-24T00:00:00Z");
await atlas.licenses.revoke(id, { reason: "chargeback" });

Create and update calls send an idempotency key automatically. Pass your own, such as an order ID, to stay safe across restarts: atlas.licenses.create(input, { idempotencyKey: `order-${id}` }).

Helpers

FunctionUse
verifyOfflineLease(lease, options)Check a saved offline lease. See Offline mode.
verifyWebhook(rawBody, headers, secret)Check a webhook request. See Webhooks.

Options and errors

ts
import { AtlasClient, AtlasError } from "@atlas/sdk";

const atlas = new AtlasClient({
  apiKey,
  timeoutMs: 30_000, // default
  maxRetries: 2,     // default; retries 429 and 5xx
});

try {
  await atlas.licenses.create({ product_id: "prod_..." });
} catch (error) {
  if (error instanceof AtlasError) {
    console.error(error.code, error.detail, error.requestId);
  }
}