Node SDK: install, types, programmatic monitor management
Owner Priya Iyer · Last updated 2026-04-08 · v4.3
nodejssdktypescriptnpmclient
Node SDK
The Node SDK is a typed wrapper over the rest-api-overview. It targets Node 18+ and bundlers (works in Vite, esbuild, Next.js).
install
bash
npm install @devflow/sdkcreating a client
ts
import { DevFlow } from '@devflow/sdk';
const df = new DevFlow({
apiKey: process.env.DEVFLOW_API_KEY!,
workspace: 'acme-prod'
});The constructor accepts baseUrl (default https://api.devflow.io), timeoutMs (default 10s), retry (default { max: 3, jitter: 'full' }).
listing monitors
ts
const page = await df.monitors.list({ limit: 100 });
for (const m of page.data) {
console.log(m.id, m.name, m.lastCheck.status);
}The SDK auto-paginates if you pass { all: true }.
creating a monitor
ts
const monitor = await df.monitors.create({
name: 'payments-api-charge',
url: 'https://api.example.com/v1/charges',
method: 'POST',
frequency: '30s',
regions: ['us-east-1', 'eu-west-1'],
assertions: [
{ type: 'status_eq', value: 200 },
{ type: 'latency_lt_ms', value: 800 }
],
alertChannels: ['slack:#payments-oncall']
});acknowledging an incident
ts
await df.incidents.ack('inc_01HK...', { who: 'priya@example.com' });errors
The SDK throws DevFlowApiError with code, message, requestId, status. 429s are auto-retried; you only see the throw if retries exhausted.
TypeScript
Every API resource is typed. Monitor, SLO, Channel, Incident are exported types you can use in your own code. The SDK bundles zod schemas for runtime validation if you need them.
related
- terraform-provider — for declarative monitor management.
- rest-api-rate-limits — for the limits the SDK respects.
- cli-install — the CLI uses this SDK under the hood.