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.
| Language | Package | Install | Status |
|---|---|---|---|
| .NET | TenancyEngine.Sdk | dotnet add package TenancyEngine.Sdk | Published -- GitHub Packages feed (nuget.pkg.github.com/sathish4000), versions 1.0.0/1.0.1 |
| TypeScript / Node.js | @tenancy-engine/sdk | npm install @tenancy-engine/sdk | Not 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 |
| Go | github.com/sathish4000/tenancyengine-go | go get github.com/sathish4000/tenancyengine-go | Source-available; installable directly via go get against the GitHub repo (Go modules do not need a separate registry) |
| Python | tenancyengine | pip install tenancyengine | Not yet published to PyPI -- pip install -e packages/tenancyengine-python from a tenancy-platform checkout |
| Java | com.tenancyengine:tenancyengine-sdk | Maven/Gradle coordinate above | Not yet published to Maven Central -- cd packages/tenancyengine-java && mvn install to your local repository first |
| PHP | tenancyengine/sdk | composer require tenancyengine/sdk | Not yet published to Packagist |
| Ruby | tenancyengine | gem install tenancyengine | Not 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
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
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
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
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
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
$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
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?.
| Platform | Package | Install | Status |
|---|---|---|---|
| Browser (script tag) | -- | CDN script tag | Not 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-sdk | npm install @tenancyengine/browser-sdk | Not yet published (404 on the public npm registry) -- build from source in src/BrowserSdk |
| .NET MAUI | TenancyEngine.Sdk.Maui | dotnet add package TenancyEngine.Sdk.Maui --version 0.3.0 | Version 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 / Swift | TenancyEngineAuth (Swift Package) | Swift Package Manager, local path | Source-complete with a full README; not yet published as a remote git dependency |
| Android / Kotlin | com.tenancyengine:tenancyengine-auth | Gradle 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 |
| Flutter | tenancyengine_auth | flutter pub add tenancyengine_auth | Not yet published to pub.dev -- use a git/path dependency |
| React Native | @tenancyengine/react-native-auth | npm install @tenancyengine/react-native-auth react-native-app-auth react-native-keychain | Not published (404 on the public npm registry) -- use a file:/git dependency |
Quickstart: Browser SDK
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).
Related
- Getting started -- create an app, mint a key, make your first call
- Mobile and browser apps -- credential model and OIDC client registration
- AI credits -- pay-as-you-go AI extraction/chat pricing and balance management
- Platform caching -- opt-in Upstash-backed Redis caching
- API keys -- creating and revoking organization keys in console