Skip to main content
Node SDK & Developer Toolingv1.0.0 Stable
TypeScript & Node.js Tooling

VRIL Node SDK & Developer Guide

Type-safe wrapper for @vril-labs/esimaccess-api with automated token rotation, cellular telemetry streaming, and multi-carrier failover health monitoring.

Quick Install
bun add @vril-labs/esimaccess-api
npm install @vril-labs/esimaccess-api

Core SDK Operations

1. Client Initialization & Authentication

The SDK automatically reads ESIMACCESS_ACCESS_CODE and ESIMACCESS_SECRET_KEY from environment variables, rotating tokens transparently.

import { EsimAccessService } from '@/lib/esimaccess';

// Client consumes environment credentials by default
const client = EsimAccessService;

// Verify connection and credit balance
const balance = await client.queryBalance();
console.log('Balance USD:', balance.data?.balance);

2. Destination Plan Discovery

Query cached and real-time packages with ISO-3166-1 alpha-2 country codes.

// Fetch available cellular packages for Japan (JP)
const response = await client.getPackages({
  locationCode: 'JP',
  type: 'local',
});

const packages = response.data.packageList;
for (const plan of packages) {
  console.log(`${plan.packageCode}: ${plan.dataMb / 1024}GB for ${plan.durationDays}d - $${plan.price}`);
}

3. Asynchronous eSIM Order Creation

Triggers carrier provisioning pipeline and returns LPA string and QR code asset.

// Provision an eSIM order
const order = await client.createOrder({
  packageCode: 'JP_10GB_30D',
  price: 12.00,
  transactionId: `ORD-${Date.now()}`,
});

console.log('Order status:', order.orderNo, order.status);
// orderNo: "ORD-2026-84920"
// status: "processing" | "completed"

4. Real-time Telemetry & Data Quota Queries

Inspect cellular consumption, active session timestamps, and remaining bytes directly from Tier-1 carrier networks.

// Query telemetry for active ICCID
const usage = await client.getSimUsage('89814400000072184931');

console.log('Total MB:', usage.totalDataMb);
console.log('Used MB:', usage.usedDataMb);
console.log('Remaining MB:', usage.remainingDataMb);
console.log('Expires:', usage.expiresAt);

Cellular Telemetry & Failover Architecture

The VRIL SDK actively reports carrier health, tower handover status, and regional latency metrics. When regional network degradation exceeds 180ms, automated multi-carrier failover switches the subscriber to the secondary Tier-1 partner.

Sub-30s LPA Issuance

Instant GSMA SGP.22 compliant profile activation strings delivered directly in response.

Dual-Upstream Failover

Redundant carrier routing across KDDI, SoftBank, Vodafone, AT&T, and Orange.

Zero-Egress Emergency Link

Permanent 128kbps text and navigation lifeline even after 100% data exhaustion.

SDK Error Handling Reference

All SDK runtime exceptions extend from VrilApiError with typed failure codes.

Error CodeHTTP StatusResolution Behavior
ERR_CARRIER_TIMEOUT504Upstream Tier-1 carrier provisioning delayed beyond 15s. Handled asynchronously by Inngest polling job.
ERR_QUOTA_EXHAUSTED402Developer account prepaid credit balance exhausted. Automatic replenishment can be armed in dashboard.
ERR_INVALID_ICCID400SIM profile identifier checksum or format validation failed.
ERR_RATE_LIMIT_EXCEEDED429Per-minute API quota exceeded. SDK automatically retries with jittered exponential backoff.