Create a client
Create a production Core SDK client from a publishable key.
createCapxulClient
Create a production Core SDK client from a publishable key.
Available in the Core SDK
The typed Core SDK operation is implemented. Live service behavior still depends on the configured environment.
Import
import { createCapxulClient } from "@capxul/sdk";Usage
const created = await createCapxulClient({
publishableKey: "cap_pk_…",
});
if (!created.ok) {
console.error(created.error.code);
return;
}
const client = created.value;Signature
createCapxulClient(input: CapxulClientInput): Promise<CapxulResult<CapxulClient>>;Source: packages/sdk/src/surface/create-capxul-client-from-production.ts:9.
Parameters
input
Required.
CapxulClientInput;Prop
Type
The optional observability field accepts one host-owned product/failure module:
observability: postHogObservability(posthog, {
capxulEnv: "production",
context: () => ({ correlationId, journeyId, organizationId }),
});The host initializes PostHog and owns consent. The SDK shares one enable, sanitization, context, and best-effort delivery policy across product events and failures. Engineering logs and traces are activated only by the optional, validated policy in the versioned bootstrap response; application code cannot override its endpoints, service, producer, or SDK version.
Returns
Promise<CapxulResult<CapxulClient>>;Read the ok discriminant before accessing value or error.
Errors
Expected failures resolve as { ok: false, error: CapxulError }; they are not thrown as the normal domain contract. Branch on result.ok and use the stable error.code. Provider messages and internal causes are not public contracts.
Availability and evidence
Available in the Core SDK. Evidence classification: shipped-proven.
shipped-proven at the typed or hermetic Core SDK contract boundary. The callable surface and result mapping are covered by release-trunk type or hermetic tests. That does not by itself prove a live backend, provider, email, browser, or chain journey. Check the capability-status reference before presenting this operation as live.
Related
- No dedicated React SDK hook currently projects this method.
- Platform capability matrix
- Core SDK scaffold inventory
- Result and proof boundaries