Skip to content

TenancyEngine SDKs

Every SDK talks to the same org-API-key-authenticated runtime surface (/api/v1/runtime/* on SaaSRuntime.Api) or, for the browser SDK, the anonymous public-app surface (/api/v1/public/apps/*). Pick the SDK for your backend language, or the client SDK for the platform your app runs on -- see Server-side vs. client-side: which SDK do I want? if you are not sure which bucket your app is in.

All source lives in tenancy-platform/packages/ (server SDKs, mobile auth SDKs) and tenancy-platform/src/BrowserSdk (browser SDK). Every install command and code sample below is copied from that SDK's own README/source, not written from assumption -- publish status is called out explicitly where an SDK is not yet on a public registry.

Server-side SDKs (secret organization API key)

Your backend holds a secret organization API key (X-TenancyEngine-Api-Key) and calls the runtime surface directly -- create tenants, gate features, record usage, run AI extraction, send SMS, issue storage grants. Never ship this key to a browser or mobile app.

LanguagePackageInstallStatus
.NETTenancyEngine.Sdkdotnet add package TenancyEngine.SdkPublished -- GitHub Packages feed (nuget.pkg.github.com/sathish4000), versions 1.0.0/1.0.1
TypeScript / Node.js@tenancy-engine/sdknpm install @tenancy-engine/sdkNot yet published (verified 404 on the public npm registry and no npm package under the sathish4000 GitHub account, 2026-08-26) -- build from source: cd packages/tenancy-engine-sdk && npm ci && npm run build, then use a local/file: dependency until it ships
Gogithub.com/sathish4000/tenancyengine-gogo get github.com/sathish4000/tenancyengine-goSource-available; installable directly via go get against the GitHub repo (Go modules do not need a separate registry)
Pythontenancyenginepip install tenancyengineNot yet published to PyPI -- pip install -e packages/tenancyengine-python from a tenancy-platform checkout
Javacom.tenancyengine:tenancyengine-sdkMaven/Gradle coordinate aboveNot yet published to Maven Central -- cd packages/tenancyengine-java && mvn install to your local repository first
PHPtenancyengine/sdkcomposer require tenancyengine/sdkNot yet published to Packagist
Rubytenancyenginegem install tenancyengineNot yet published to RubyGems -- cd packages/tenancyengine-ruby && gem build tenancyengine.gemspec && gem install ./tenancyengine-0.1.0.gem

Only the .NET SDK is confirmed live on a public feed today. Every other server SDK is feature-complete and tested against the real API but requires a local build/path dependency until published -- say so to anyone you hand a language other than .NET, or ask a platform maintainer to publish it first.

Quickstart: .NET

csharp
using TenancyEngine.Sdk;

var client = new TenancyEngineClient(httpClient, apiKey: Environment.GetEnvironmentVariable("TE_API_KEY")!);

var app = await client.GetApplicationAsync("your-app-slug");
var tenant = await client.CreateTenantAsync(app.Id, new CreateTenantRequest("Acme Corp", "acme"));
await client.ConsumeUsageAsync("your-app-slug", "acme", "Production", "api_calls", amount: 1,
    idempotencyKey: "req-" + Guid.NewGuid());

Quickstart: TypeScript / Node.js

ts
import { TenancyEngineClient } from '@tenancy-engine/sdk';

const te = new TenancyEngineClient({
  baseUrl: process.env.TENANCYENGINE_BASE_URL ?? 'https://auth.lab.saasruntime.com',
  apiKey: process.env.TENANCYENGINE_API_KEY!,
  appId: process.env.TENANCYENGINE_APP_ID!,
});

const app = await te.getApplication('your-app-slug');
const ctx = await te.getRuntimeContext('your-app-slug', 'Production', tenantId);

Quickstart: Go

go
import tenancyengine "github.com/sathish4000/tenancyengine-go"

client, err := tenancyengine.New("https://auth.lab.saasruntime.com", "te_your_organization_api_key")
if err != nil {
    log.Fatal(err)
}

app, err := client.GetApplication(ctx, "your-app-slug")

Quickstart: Python

python
from tenancyengine import TenancyEngineClient

client = TenancyEngineClient(
    api_key="te_...",
    base_url="https://api.lab.saasruntime.com",
)

app = client.get_application("your-app-slug")
ctx = client.get_runtime_context("your-app-slug", environment="Production")

Quickstart: Java

java
TenancyEngineClient client = TenancyEngineClient.builder(
        "https://api.lab.saasruntime.com",
        System.getenv("TENANCYENGINE_API_KEY"))
    .build();

Application app = client.getApplication("acme-app");
Tenant tenant = client.createTenant(app.id(),
    CreateTenantRequest.builder("Acme Corp", "acme-corp").build());

Quickstart: PHP

php
$client = new TenancyEngineClient(new ClientConfig(
    baseUri: 'https://auth.lab.saasruntime.com',
    apiKey: getenv('TENANCYENGINE_API_KEY'),
));

$app = $client->applications()->get('my-app-slug');
$scoped = $client->forApplication($app->slug, $app->id);
$tenant = $scoped->createTenant('Acme Inc', 'acme', ReleaseChannel::Stable, ApplicationEnvironmentKind::Production);

Quickstart: Ruby

ruby
require "tenancyengine"

client = TenancyEngine::Client.new(api_key: "te_...", base_url: "https://api.lab.saasruntime.com")

app = client.get_application("your-app-slug")
ctx = client.get_runtime_context("your-app-slug", environment: "Production")

Client-side SDKs (no secret -- publishable credential or PKCE)

Anything that ships to an end user's browser or device must never hold your secret organization API key. Two different credential models apply depending on where your app runs -- see Mobile and browser apps: which credential model do I use?.

PlatformPackageInstallStatus
Browser (script tag)--CDN script tagNot yet deployed -- the CDN host is not wired up yet; build dist/cdn/tenancyengine.js locally with npm run build:cdn in src/BrowserSdk in the meantime
Browser (npm)@tenancyengine/browser-sdknpm install @tenancyengine/browser-sdkNot yet published (404 on the public npm registry) -- build from source in src/BrowserSdk
.NET MAUITenancyEngine.Sdk.Mauidotnet add package TenancyEngine.Sdk.Maui --version 0.3.0Version 0.3.0 targets stable .NET 10 MAUI and adds secure OIDC storage and signed environment enrollment. GitHub Packages is the authoritative private feed; publication and clean-consumer evidence are required before an app release may depend on it.
iOS / SwiftTenancyEngineAuth (Swift Package)Swift Package Manager, local pathSource-complete with a full README; not yet published as a remote git dependency
Android / Kotlincom.tenancyengine:tenancyengine-authGradle composite build (includeBuild(...))Source-complete; explicitly not on any Maven feed -- its own README calls out this exact "do not assume a package id is live" trap
Fluttertenancyengine_authflutter pub add tenancyengine_authNot yet published to pub.dev -- use a git/path dependency
React Native@tenancyengine/react-native-authnpm install @tenancyengine/react-native-auth react-native-app-auth react-native-keychainNot published (404 on the public npm registry) -- use a file:/git dependency

Quickstart: Browser SDK

ts
import { createClient } from '@tenancyengine/browser-sdk';

const te = createClient({ appSlug: 'my-app' });
const app = await te.apps.getApp();
const offerings = await te.apps.getOfferings();

This SDK cannot call anything under /api/v1/runtime/* -- no tenant creation, no AI extraction, no usage metering. Those need your secret key on your own backend; the browser SDK's BackendProxyClient is a thin fetch wrapper for calling your own API, which then calls TenancyEngine server-side.

MCP (AI assistant connector)

Your customers (or your own team) can connect Claude Desktop, Claude Code, ChatGPT, or any other Model Context Protocol client directly to one application's own data via POST /api/v1/runtime/mcp (Streamable HTTP, JSON-RPC 2.0), authenticated with an application-scoped API key carrying mcp.connect. Full setup and per-client config snippets: Connect an AI assistant (MCP).

TenancyEngine platform documentation