TypeScript
The official TypeScript SDK, solidping on npm
(source), manages checks, incidents, status
pages, maintenance windows and notification channels from Node, Deno and Bun without writing HTTP
calls. Anything else in the REST API is one sp.request(...) away.
Install
npm install solidping
Node 24 or later, Deno or Bun. It runs on the server side only: a token does not belong in a
browser. There is no runtime dependency (the built-in fetch is used).
Quickstart
Create a personal access token in SolidPing and export it:
export SOLIDPING_TOKEN=pat_...
export SOLIDPING_ORG=acme
import SolidPing from 'solidping';
const sp = new SolidPing(); // reads SOLIDPING_URL, SOLIDPING_ORG, SOLIDPING_TOKEN
// Create a check
const check = await sp.checks.create({ name: 'Website', config: { url: 'https://acme.com' } });
console.log(check.slug, check.status);
// List the checks that are down
for await (const check of sp.checks.list({ status: 'down' })) {
console.log(check.name);
}
// Acknowledge every open incident
for await (const incident of sp.incidents.list({ state: 'active' })) {
await sp.incidents.acknowledge(incident.uid);
}
Configuration
The client is for one organization and authenticates with a personal access token. Each option falls back to an environment variable:
| Option | Environment variable | Default |
|---|---|---|
url | SOLIDPING_URL | https://solidping.io |
org | SOLIDPING_ORG | required |
token | SOLIDPING_TOKEN | required |
timeout | 30000 (milliseconds) | |
maxRetries | 2 |
Resources
sp.checks, sp.incidents, sp.statusPages, sp.maintenanceWindows and sp.channels, with
list, get, create, update and delete where the API has them, plus checks.upsert,
checks.runNow and the incident actions acknowledge, unacknowledge, snooze, unsnooze and
resolve. Arguments use the API field names; results are plain objects typed by interfaces, and an
unknown field or enum value (a plugin check type such as x-gopher) is kept, not rejected.
list returns an async iterable that follows the pagination cursor for you.
Errors
Every error extends SolidPingError. An error answered by the API is an APIError carrying
status, code, title, detail and fields, with one subclass per case: NotFoundError (404),
AuthenticationError (401), PermissionDeniedError (403), ValidationError (400, 422),
ConflictError (409) and RateLimitError (429). APIConnectionError and APITimeoutError cover
the network.
import SolidPing, { APIError, NotFoundError } from 'solidping';
const sp = new SolidPing({
url: 'https://solidping.acme.com',
org: 'acme',
token: '...',
timeout: 10_000, // milliseconds
maxRetries: 0,
});
try {
await sp.checks.get('missing');
} catch (e) {
if (e instanceof NotFoundError) {
console.log('no such check');
} else if (e instanceof APIError) {
console.log(e.status, e.code, e.title, e.detail);
} else {
throw e;
}
}
Retries and timeouts
Connection errors, timeouts, 429 and 5xx are retried twice with exponential backoff and jitter. A
429 waits for Retry-After. A POST is retried only on 429, since the API has no idempotency key.
maxRetries: 0 turns retries off. Each attempt times out after timeout milliseconds.
Endpoints the SDK does not cover
request() calls any endpoint with the same authentication, retries and errors:
const regions = await sp.request('GET', '/api/v1/orgs/acme/regions');
Debugging
SOLIDPING_LOG=debug writes each request, its response status and each retry to stderr. The token
is never logged. Requests carry User-Agent: solidping-typescript/<version>.