TypeScript SDK
Send data to Signals and manage Signals, Monitors and incidents with typed methods.
Install
Section titled “Install”npm install @signalsitter/sdkThe package ships ESM and TypeScript declarations. It runs on Node.js 22 or
later, Bun, Deno, Cloudflare Workers and browsers with fetch and Web Crypto.
Use npm:@signalsitter/sdk as the import specifier in Deno.
The examples below run on a server. Keep API keys in server secrets, never in browser bundles. Browser runtime support doesn’t change the API’s CORS policy.
Send data to a Signal
Section titled “Send data to a Signal”Create a project credential in the dashboard.
Use write to publish to an existing Signal, or manage to create and
configure one as well. Set its secret as SIGNALSITTER_API_KEY in the server
environment.
import { SignalsitterApiClient } from "@signalsitter/sdk";
const apiCredential = process.env.SIGNALSITTER_API_KEY;if (!apiCredential) throw new Error("Set SIGNALSITTER_API_KEY");
const client = new SignalsitterApiClient({ apiCredential });
const receipt = await client.publishSignal("nightly-backup", { observation: { files: 42 },});console.log(receipt.data);The SDK selects https://ingest.signalsitter.com for unrestricted publishing
and https://eu-ingest.signalsitter.com when you pass jurisdiction: "eu"
alongside observation. A Signal’s jurisdiction never changes. See
Sending data to a Signal for the body and
configuration rules. In a Worker, pass the credential from its secret binding
instead of process.env.
An empty check-in to an active Signal with a heartbeat period credits the period
without storing a reading, unless the Signal has Store every heartbeat on. Check
receipt.data.disposition. reading is stored or unretained, and
heartbeat is credited, redundant or unarmed. An unretained check-in’s
eventId identifies the request, not a stored reading. Retrying it later can
credit a new period.
Manage Signals, Monitors and incidents
Section titled “Manage Signals, Monitors and incidents”The same client sends management calls to https://api.signalsitter.com.
import { SignalsitterApiClient } from "@signalsitter/sdk";
const managementCredential = process.env.SIGNALSITTER_API_KEY;if (!managementCredential) throw new Error("Set SIGNALSITTER_API_KEY");
const api = new SignalsitterApiClient({ apiCredential: managementCredential });
const signals = await api.listSignals({ limit: 20 });console.log(signals.data.items);
const monitors = await api.listMonitors({ limit: 20 });console.log(monitors.data.items);
await api.acknowledgeMonitorIncident( "mon_01234567-89ab-4cde-8fab-0123456789ab", "inc_01234567-89ab-4cde-8fab-0123456789ab", { note: "Investigating the backup job" }, {});For another deployment, set baseUrl to one URL if its API and ingest share an
origin. If they use separate origins, pass
baseUrl: { api, ingest, euIngest } with that deployment’s three URLs. A
single client still routes each operation to the right origin.
Listing works with read, readwrite or manage. Acknowledging needs
manage. The credential scopes every call to its project. Lists return one
page. Pass nextCursor back as cursor for the next page.
Replace the example Monitor and incident IDs with your own. List responses
give a monitor’s ID as monitorKey. A missed check-in opens a Signal’s incident
instead, and that incident carries signal. Work it with the Signal methods,
using signal.signalId: for example
acknowledgeSignalIncident(signalId, incidentId, {}, {}), and likewise
resolveSignalIncident, getSignalIncidentTimeline,
listSignalIncidentDeliveries and redeliverSignalIncidentDelivery. A
successful call returns typed data
and a requestId, plus an etag or location when the operation has one.
Methods that change versioned configuration need the latest etag in their
request options. See the API reference for each operation’s
fields and permissions.
Historical imports belong to a Signal. Call
importSignalHistoricalObservations(signalId, input, { idempotencyKey }) with
the Signal’s expectedConfigurationVersion and 1 to 500 time-ordered
observations. The client keeps one idempotency key through its own retries. If
you’re unsure whether a call landed, call again with the same key and body.
Imported events count toward your organization’s
pooled allowance.
Errors and retries
Section titled “Errors and retries”import { SignalsitterApiProblem } from "@signalsitter/sdk";
try { await client.publishSignal("nightly-backup");} catch (error) { if (error instanceof SignalsitterApiProblem) { console.error(error.problem.code, error.requestId); } else { throw error; }}SignalsitterApiProblem carries the server’s problem, status and request ID.
SignalsitterApiTransportError means the connection failed.
SignalsitterApiResponseError means the response couldn’t be read as the
expected contract. Read the error code before deciding what to do.
The SDK adds an idempotency key to writes that support one, including Signal
publishes. It keeps that key through up to two retries of a failed
connection or a retryable 408, 429, 500, 502, 503 or 504. It doesn’t
retry plan-limit refusals, and it won’t wait more than two seconds for a delay
the server asks for. Reads aren’t retried.
A Signal publish also gives each attempt 10 seconds to answer. An attempt
that runs out of time is retried with the same key and body, within the same
two retries. Change the per-attempt time with attemptTimeoutMs in the call’s
request options, or set it to 0 to wait as long as your own signal allows.
Your signal still bounds the whole publish, and aborting it is never retried.
When every attempt runs out of time, the publish rejects with a DOMException
named TimeoutError, and whether the data was recorded is unknown. Publishing
again with the same idempotencyKey records a stored reading at most once.
Set maxRetries: 0 in the client options or the call’s request options to
handle retries yourself. Pass idempotencyKey in the request options when
separate calls must share one logical write. Otherwise each call gets a new
key, so calling again after an unclear failure can record a second stored
reading. Check the Signal before you repeat a write. Secrets are shown once, so
replaying a credential or signing-secret write can’t recover a lost secret. See
Retrying safely and
Reliability.