SDK Guide

Monitor Express APIs with a small SDK setup.

Install Watchlayer, connect your API key, register the endpoints that matter, and keep a clean view of uptime, latency, incidents, and alerts.

Quick path
Install package
Initialize SDK
Create API group
Add endpoints
Step 01

Installation

Add the SDK to your application with your preferred package manager.

npm install @watchlayer/sdk
yarn add @watchlayer/sdk
Step 02

Basic setup

Initialize Watchlayer once near your Express app startup code, before your routes are registered.

import express from "express";
import { watchlayer } from "@watchlayer/sdk";

const app = express();

watchlayer({
  apiKey: process.env.WATCHLAYER_API_KEY,
  appName: "my-api",
  environment: "production",
});

app.get("/api/users", (req, res) => {
  res.json({ users: [] });
});

app.listen(3000, () => {
  console.log("Server running on port 3000");
});

Replace WATCHLAYER_API_KEY with an API key from your dashboard.

Step 03

Create API groups

Groups keep related services organized, so production, staging, and internal APIs can have separate checks and alerts.

  1. 1Go to your dashboard and click Add API Group
  2. 2Give your API group a name, like Production APIs
  3. 3Verify your domain ownership
  4. 4Add the API endpoints you want to monitor
  5. 5Generate an API key for monitoring
Step 04

Add endpoints

Register each route you want Watchlayer to check, including method, expected response time, and optional headers.

  1. 1Select your API Group from the dashboard
  2. 2Click Add Endpoint
  3. 3Enter the endpoint path, like /api/users
  4. 4Select the HTTP method
  5. 5Set expected response time in milliseconds
  6. 6Add any required headers or authentication details

Auto-monitoring: the SDK checks configured endpoints and alerts you when availability or latency drifts.

Step 05

Manage API keys

Generate scoped keys from the dashboard, store them in your runtime environment, and rotate them when needed.

  1. 1Navigate to your API Group settings
  2. 2Click Generate New Key
  3. 3Give your key a meaningful name
  4. 4Copy the generated key and store it securely
  5. 5Add it to your environment variables
WATCHLAYER_API_KEY=wl_xxxxxxxxxxxxxxxxxxxxxx

Never commit API keys to version control. Use environment variables or a secret manager.

Ongoing

Real-time monitoring

Once configured, Watchlayer gives you a clear operational view of your endpoints and the incidents around them.

Status Tracking

Real-time status and response times for every registered endpoint.

Instant Alerts

Get notified when endpoints go down or performance degrades.

Advanced Analytics

Track uptime, latency, incident history, and performance trends.

Secure by Default

Keep monitoring data protected with encrypted transport and storage.

Ready to connect your first API?

Open the dashboard, create a group, and add the key to your Express app.

Start monitoring