PersonaClient is the single entry point. One instance gives you access to every resource client
and the chat clients:
Constructor
PersonaClientOptions is exactly HttpClientOptions — see
Configuration for every field. baseUrl and credential are
required and validated synchronously.
Client surface
Every resource class is also exported directly from the package root, so you could construct them
manually against your own
HttpClient — but that’s never necessary; the client wires them up for
you.
whoami()
externalUserId) maps to —
a side-effect-free way to sanity-check auth wiring before making real calls.
The returned shape depends on whether the client was constructed with externalUserId:
ProjectAdmin variant reachable from the SDK — that context only comes from a
Clerk-authenticated human admin session (Developer Studio), a completely different auth model the
SDK deliberately doesn’t implement.
Behavior notes
whoami()performs no side effects beyond external-user resolution; it’s safe to call at startup or per request.- Errors: a 401/403 throws
PersonaAuthError(bad credential, or the Project isn’tACTIVE); a 400 throwsPersonaValidationError(e.g. anexternalUserIdthat fails validation).
Sharing vs. constructing fresh
- One control-plane client per process is fine to share anywhere server-side.
- Runtime-plane clients are per-user: construct one per request scoped to the authenticated
user (after your own auth), because
externalUserIdis baked into the client and sent on every call. See Configuration scenarios.