Skip to main content
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()

Resolves the principal context the client’s credential (and optional 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:
There is no third 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’t ACTIVE); a 400 throws PersonaValidationError (e.g. an externalUserId that 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 externalUserId is baked into the client and sent on every call. See Configuration scenarios.