⚠️

Internal admin API. Tenants are the underlying platform isolation boundary. SDK consumers should use sdk.organizations instead — it exposes the same concept with a simpler, developer-friendly interface.

Tenants

A Tenant is the top-level isolation boundary in cPod. All data, billing, configuration, and access control are scoped to a tenant. Each API key belongs to exactly one tenant, and data never crosses tenant boundaries.

⚠️

Tenant management is restricted to platform administrators. Most application developers interact with a single tenant and do not need these APIs.


Tenant Schema

FieldTypeRequiredDescription
idstringautoPrefixed ID: tnt-{ulid}
namestringyesHuman-readable tenant name
slugstringyesURL-safe unique identifier (immutable after creation)
planenumyesfree | pro | enterprise
statusenumautoactive | suspended | pending_deletion
settings.maxPodsnumbernoMaximum number of concurrent pods
settings.allowedRegionsstring[]noRegions where data may reside
settings.ssoEnabledbooleannoWhether SSO is enabled for this tenant
settings.auditLogsEnabledbooleannoWhether audit logging is active
createdAtstringautoISO 8601 UTC
updatedAtstringautoISO 8601 UTC

Get the Current Tenant

Retrieve the tenant associated with the current API key.

import { CpodClient } from '@cpod/sdk'
const sdk = CpodClient.fromEnv()
 
const tenant = await sdk.tenants.get('tnt-default')
console.log(tenant.name, tenant.plan, tenant.status)
// → "Acme Corp" "enterprise" "active"

List Tenants

List all tenants accessible to the authenticated service account. Regular API keys only see their own tenant.

const result = await sdk.tenants.list({
  plan: 'enterprise',
  status: 'active',
  limit: 50,
})
 
for (const tenant of result.items) {
  console.log(tenant.id, tenant.name, tenant.plan)
}

Update Tenant Settings

Update the name, plan, or settings of a tenant. The slug field is immutable.

const updated = await sdk.tenants.update('tnt-default', {
  name: 'Acme Corporation',
  settings: {
    maxPods: 20,
    ssoEnabled: true,
    auditLogsEnabled: true,
    allowedRegions: ['us-east-1', 'eu-west-1'],
  },
})
console.log(updated.settings.ssoEnabled) // → true

Create a Tenant

⚠️

Creating tenants requires a super-admin service account. This operation is not available to standard API keys.

const tenant = await sdk.tenants.create({
  name: 'Beta Corp',
  slug: 'beta-corp',
  plan: 'pro',
  settings: {
    maxPods: 5,
    auditLogsEnabled: true,
  },
})
console.log(tenant.id) // → "tnt-01HXYZ..."