SDK API Reference
Complete reference for all SeeStack SDK methods.
This page documents every public method in the SeeStack SDK.
init
Initialize the SDK. Must be called once at application startup before any other SDK method.
SeeStack.init({
apiKey: 'seestack_live_...',
host: 'https://your-seestack-instance.com',
environment: 'production',
release: 'v1.0.0',
debug: false,
});seestack.init(
api_key="seestack_live_...",
host="https://your-seestack-instance.com",
environment="production",
release="v1.0.0",
debug=False,
)seestack.Init(seestack.Config{
APIKey: "seestack_live_...",
Host: "https://your-seestack-instance.com",
Environment: "production",
Release: "v1.0.0",
Debug: false,
})Prop
Type
Calling init more than once is idempotent — subsequent calls emit a warning and are ignored. If init has not been called, all other SDK methods are silent no-ops.
captureError
Capture an exception and send it to SeeStack immediately.
SeeStack.captureError(error, {
level: 'error',
user: { id: 'usr_1234' },
metadata: { route: '/checkout' },
});seestack.capture_error(error, context={
"level": "error",
"user": {"id": "usr_1234"},
"metadata": {"route": "/checkout"},
})seestack.CaptureError(err, &seestack.ErrorContext{
Level: "error",
User: &seestack.User{ID: "usr_1234"},
Metadata: map[string]any{"route": "/checkout"},
})Prop
Type
Errors are sent immediately (not buffered). See Error Tracking.
captureLog
Capture a structured log entry. Logs are buffered and flushed periodically.
SeeStack.captureLog('info', 'Order processed', { orderId: 'ORD-123' });seestack.capture_log("info", "Order processed", metadata={"order_id": "ORD-123"})seestack.CaptureLog("info", "Order processed", map[string]any{"orderID": "ORD-123"})Prop
Type
See Log Ingestion.
flush
Force-flush all buffered events to the backend. Returns a promise that resolves when all events have been sent (or the 5-second deadline expires).
await SeeStack.flush();seestack.flush()seestack.Flush()See Buffering & Flushing.
setUser
Set the default user context for all subsequent SDK events.
SeeStack.setUser({ id: 'usr_1234', email: '[email protected]' });seestack.set_user(id="usr_1234", email="[email protected]")seestack.SetUser(seestack.User{ID: "usr_1234", Email: "[email protected]"})Prop
Type
See User Context.
clearUser
Clear the previously set user context.
SeeStack.clearUser();seestack.clear_user()seestack.ClearUser()instrumentHttp
Enable automatic HTTP request instrumentation. Patches the runtime's native HTTP client to capture all outbound requests.
SeeStack.instrumentHttp();
// Patches: fetch, XMLHttpRequest, http.request, https.requestseestack.instrument_http()
# Patches: urllib3, httpx, aiohttp// Go: use the transport wrapper instead
client := &http.Client{
Transport: seestack.NewHTTPTransport(http.DefaultTransport),
}See HTTP Monitoring.
captureHttpRequest
Manually capture an HTTP request event. Use this for inbound requests (via middleware) or when auto-instrumentation is not suitable.
SeeStack.captureHttpRequest({
traceId: 'trace-001',
direction: 'inbound',
method: 'POST',
host: 'api.myapp.com',
path: '/v1/orders',
statusCode: 201,
durationMs: 45,
requestSize: 512,
responseSize: 128,
timestamp: new Date().toISOString(),
});seestack.capture_http_request(
trace_id="trace-001",
direction="inbound",
method="POST",
host="api.myapp.com",
path="/v1/orders",
status_code=201,
duration_ms=45,
request_size=512,
response_size=128,
timestamp=datetime.utcnow().isoformat() + "Z",
)seestack.CaptureHTTPRequest(seestack.HTTPRequest{
TraceID: "trace-001",
Direction: "inbound",
Method: "POST",
Host: "api.myapp.com",
Path: "/v1/orders",
StatusCode: 201,
DurationMs: 45,
RequestSize: 512,
ResponseSize: 128,
Timestamp: time.Now().UTC().Format(time.RFC3339),
})Prop
Type
Captured requests are batched (up to 100) and flushed periodically. See HTTP Monitoring.
startReplay
Start recording session replay events. Browser SDK only.
SeeStack.startReplay(sessionId);
SeeStack.startReplay(sessionId, customFingerprint);Prop
Type
See Session Replay.
stopReplay
Stop recording session replay events. Browser SDK only.
SeeStack.stopReplay();startJob
Begin monitoring a cron job execution. Returns a handle for use with finishJob.
const handle = SeeStack.startJob('daily-report-generator');handle = seestack.start_job("daily-report-generator")handle := seestack.StartJob("daily-report-generator")Prop
Type
Returns a JobHandle that tracks the start timestamp.
finishJob
Complete a cron job and send a heartbeat ping to SeeStack. Sent immediately (not buffered).
SeeStack.finishJob(handle, 'success', 'Processed 1,842 records');seestack.finish_job(handle, "success", "Processed 1,842 records")seestack.FinishJob(handle, "success", "Processed 1,842 records")Prop
Type
See Cron Monitoring.
getFlag
Evaluate a single feature flag. Server-side SDK only.
const flag = await SeeStack.getFlag('new-checkout-flow', 'usr_1234', {
plan: 'pro',
});
// flag.enabled: boolean, flag.value: stringflag = seestack.get_flag("new-checkout-flow", user_id="usr_1234", attributes={"plan": "pro"})
# flag.enabled: bool, flag.value: strflag, err := seestack.GetFlag("new-checkout-flow", "usr_1234", map[string]any{"plan": "pro"})
// flag.Enabled: bool, flag.Value: stringProp
Type
Returns a FlagResult with enabled (boolean) and value (string). Results are cached for 60 seconds.
See Feature Flags.
getAllFlags
Evaluate all feature flags for a project in a single call. Server-side SDK only.
const flags = await SeeStack.getAllFlags('usr_1234', { plan: 'pro' });
// flags['new-checkout-flow'].enabledflags = seestack.get_all_flags(user_id="usr_1234", attributes={"plan": "pro"})flags, err := seestack.GetAllFlags("usr_1234", map[string]any{"plan": "pro"})Prop
Type
Returns Record<string, FlagResult> mapping flag keys to evaluation results.