PlatformXeDocs
Get API Key

Whoami

SDK methods for verifying the calling API key and detecting environment drift.

The client.whoami namespace verifies the calling API key and returns caller identity, scopes, and key metadata. It also exposes platform-side environment hints so consumers can detect environment drift (dev consumer accidentally pointed at prod, etc).

SDKInstallNamespace
TypeScriptnpm install @caldera/platformxe-sdkclient.whoami
Pythonpip install platformxeclient.whoami
Gogo get github.com/calderax/platformxe-goclient.Whoami

Boot-time self-check

The recommended pattern is to call whoami.get() at consumer boot to verify the API key is valid AND the platform is the expected environment.

import { PlatformXeClient } from '@caldera/platformxe-sdk';

const client = new PlatformXeClient({ apiKey: process.env.PLATFORMXE_API_KEY! });

const me = await client.whoami.get();
console.log(`PlatformXe ready as ${me.callerService} (${me.organizationId})`);
console.log(`Scopes: ${me.scopes.join(', ')}`);

// Surface warnings to your boot log so ops notices BEFORE keys break in production
if (me.gracePeriodWarning) console.warn(me.gracePeriodWarning);
if (me.keyExpiryWarning) console.warn(me.keyExpiryWarning);

// Detect env drift — dev consumer accidentally pointed at prod (or vice-versa)
const expectedEnv = process.env.NODE_ENV === 'production' ? 'prod' : 'dev';
if (me.platformxDbEnv !== 'unknown' && me.platformxDbEnv !== expectedEnv) {
  throw new Error(
    `PlatformXe env mismatch: consumer is ${expectedEnv}, platform is ${me.platformxDbEnv} (host: ${me.platformxDbHost})`
  );
}
me = client.whoami.get()
print(f"PlatformXe ready as {me['callerService']} ({me['organizationId']})")
me, err := client.Whoami.Get()
if err != nil { log.Fatal(err) }
fmt.Printf("PlatformXe ready as %s (%s)\n", me.CallerService, me.OrganizationID)

Response fields

FieldTypeDescription
callerServicestringLogical service name attached to the API key.
organizationIdstringTenant the key belongs to.
apiKeyIdstringStable identifier of the key.
labelstring | nullHuman-friendly label.
scopesstring[]Granted scopes (messaging:send, identity:read, …).
requestCountnumberLifetime request count.
lastUsedAtstring | nullISO 8601 timestamp of the most recent successful auth.
expiresAtstring | nullISO 8601 expiry of the key.
gracePeriodWarningstring | nullSet when the request was authenticated against the previous key hash AND the grace window is < 6h from expiring.
keyExpiryWarningstring | nullSet when the active key is < 7 days from expiring.
platformxDbHoststring | nullFirst segment of the platform's DB host. Never includes credentials.
platformxDbEnv'dev' | 'prod' | 'unknown'Best-effort env label.
platformxNodeEnvstringVERCEL_ENV or NODE_ENV.

Scopes required

whoami.get() requires only a valid API key — no specific scope.