Node.js SDK
API Reference
Full documentation for the Vigilry client class, its constructor, and all public methods.
Type Definitions
new Vigilry(options: VigilryOptions)Creates a new Vigilry client. Create one instance and reuse it across your application.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options.apiKey | string | required | Your project API key (vig_live_...). |
options.baseUrl | string | optional | Base URL of the Ingestion Service. Defaults to https://ingest.vigilry.com. Override to https://ingest.vigilry.com for local development. |
Returns
VigilryExample
vigilry.capture(options: CaptureOptions): Promise<IngestResult | null>Send a custom event to the ingestion pipeline. Returns the job ID and status on success, or null if the request failed.
The SDK never throws. If the request fails (network error, invalid key, etc.), null is returned and the error is logged to console.error.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
options.type | string | required | Event type identifier (e.g. checkout_started, feature_flag_evaluated). |
options.severity | "info" | "warn" | "error" | "critical" | required | Event severity level. |
options.message | string | required | Human-readable description of the event. |
options.correlation | CaptureCorrelation | optional | Key-value metadata for grouping related events. Keys: user_id, customer_id, order_id, and any custom string keys. |
Returns
Promise<IngestResult | null>Example
vigilry.captureError(error: Error, context?: CaptureErrorContext): Promise<IngestResult | null>Report a server-side error. Automatically extracts the error message and stack trace. Maps to the POST /ingest/server-error endpoint.
Safe to call without awaiting in fire-and-forget patterns, but awaiting ensures delivery before the process exits.
The stack trace is included when available and helps the risk worker identify error hotspots.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
error | Error | required | The error instance. Name, message, and stack are extracted automatically. |
context.status_code | number | optional | HTTP status code of the failed request (e.g. 500). |
context.path | string | optional | Request path where the error occurred (e.g. /api/checkout). |
context.method | string | optional | HTTP method (GET, POST, etc.). |
context.correlation | CaptureCorrelation | optional | Correlation context for linking this error to a user or transaction. |
Returns
Promise<IngestResult | null>