API reference

@fixback/sdk reference

The complete API of @fixback/sdk. For a narrative walkthrough, see the Web SDK guide.

Exports

ts
import { init, Fixback, LAUNCH_EVENT } from "@fixback/sdk";const fixback = await init({ key: "pk_live_…" });await fixback.signIn();   // open Connectfixback.destroy();
  • init(options) — boots the SDK; returns a Promise resolving to an instance.
  • Fixback — a module-level object with signIn() / signOut() / identity() that delegate to the most recent init instance, so a host app can start a Connect from its own UI.
  • LAUNCH_EVENT — the name of the fixback:launch event the SDK dispatches when the overlay opens.

init(options)

Returns a promise that resolves to an instance. All options other than key are optional.

OptionTypeDefaultDescription
keystringYour Project's publishable key (an identifier, not a secret).
apiUrlstringhttps://api.fixback.devThe Fixback API origin. Override for a self-hosted or local deployment.
hostIdentitystringA Host identity token minted by your server, for trusted reporters that already have a login.
anonymousIdstringa persisted per-browser idA stable first-party id for an anonymous reporter.
targetHTMLElementdocument.bodyWhere to mount the launcher.
reduceMotionbooleanfalseStill the launcher's pulse and motion.
autoCapturebooleantrueAutomatic error capture — file uncaught errors with no prompt. Set false to turn it off.
capture{ console?, network?, replay? }served per-projectConsole / network Trace capture and session replay. On by default and normally governed per-project; set a stream here to override (e.g. { network: false }).
enabledbooleantrueMaster switch. false mounts nothing and captures nothing — keep the call in place and gate it by environment.
releasestringThe build identifier of the running app. Match it to the release you upload sourcemaps under so errors symbolicate.
environmentstringThe deploy environment (production, staging, …) stamped on every capture.
scrubbooleantrueRun the built-in URL / PII scrubbers before beforeSend.
beforeSend(report) => report | nullReshape or drop (null) any report before transport.
beforeBreadcrumb(crumb) => crumb | nullFilter or edit Trace entries at the source.
trace{ budgets?, maxAgeMs?, consoleLevels? }SDK defaultsTune the Trace ring buffer. maxAgeMs takes one number for every stream or a per-stream record (network 3 min, console and breadcrumbs 15). To turn a stream off, use capture.
replay{ windowMs?, … }SDK defaultsTune the buffered session-replay window. To turn replay off, use capture.replay.

The instance & Fixback

init resolves to an instance; the module-level Fixback object exposes the same Connect methods against the most recent instance.

MemberDescription
destroy()Tears the launcher and overlay down and removes the SDK's handlers.
signIn()Open Connect — the platform's connect page in a popup (a full redirect when it is blocked) — and bind the person's Account to this site as a Reporter session. Resolves to the resulting identity.
signOut()Revoke the Reporter session and forget the token — the person becomes anonymous again.
identity()The current identity: { status: "anonymous" } or { status: "connected", name, email, tier }.

Connect

A reporter is an Account. The overlay's identity chip shows "Anonymous · Sign in"; clicking it (or calling Fixback.signIn()) opens the platform's connect page, signs the person in with Google, GitHub, Apple, or an email magic link, and returns them to your page as their Account — the chip then shows their name and tier. On a gated Project nothing is shown to a signed-out visitor; entry is a Fixback-issued link's ?fixback= code or a host call to Fixback.signIn().

ts
await init({ key: "pk_live_…" }); // mounts the launcher + identity chip on an Open Project// From your own UI, e.g. a "Report a bug" menu item on a gated Project:await Fixback.signIn();