Authentication
Recommended: createOpenStatusClient
Create a client with your API key. The key is automatically included in all requests via an interceptor.
import { createOpenStatusClient } from "@openstatus/sdk-node";
const client = createOpenStatusClient({
apiKey: process.env.OPENSTATUS_API_KEY,
});
// No headers needed on individual calls
const { httpMonitors } = await client.monitor.v1.MonitorService.listMonitors({});
Alternative: Manual Headers
Use the default openstatus client and pass headers on each call.
import { openstatus } from "@openstatus/sdk-node";
const headers = {
"x-openstatus-key": process.env.OPENSTATUS_API_KEY,
};
await openstatus.monitor.v1.MonitorService.listMonitors({}, { headers });
Environment Variables
| Variable | Description | Default |
|---|---|---|
OPENSTATUS_API_KEY | Your openstatus API key | Required for authenticated calls |
OPENSTATUS_API_URL | Custom API endpoint | https://api.openstatus.dev/rpc |
Get your API key from the openstatus dashboard under Developers > API Keys.
Scopes
An API key carries a list of scopes. A scope is a resource group plus :read or :write; <group>:write includes <group>:read. The ConnectRPC API checks the scope per service, the REST API per resource (GET/HEAD need :read, everything else :write). A missing scope returns permission_denied (403 Forbidden on REST).
| Scope | Service |
|---|---|
monitors:read / monitors:write | MonitorService, PrivateLocationService, POST /v1/check/http |
pages:read / pages:write | StatusPageService, except the subscriber methods |
incidents:read / incidents:write | StatusReportService, IncidentService, MaintenanceService |
notifications:read / notifications:write | NotificationService |
subscribers:read / subscribers:write | listSubscribers, subscribeToPage, createPageSubscription, unsubscribeFromPage on StatusPageService |
Two umbrellas cover several groups: write covers every group, read covers every group's read. Workspace, members, billing, SSO, API keys and OAuth clients are not reachable with any key, with one exception: a key may revoke itself.
The dashboard offers Read only (read), Read & write (write), and Custom, a grid with one row per group. Scopes are set when the key is created and are immutable; to change them, revoke the key and issue a new one. Keys created before scopes existed behave as write.
GET /v1/whoami echoes the resolved actor's scopes back so a client can introspect what it's allowed to do without probe-and-fail:
{
"name": "Acme",
"slug": "acme",
"plan": "team",
"actor": {
"type": "apiKey",
"keyId": "42",
"scopes": ["monitors:read", "incidents:write"]
}
}
API keys are managed from the dashboard (Developers > API Keys); there is no public REST or ConnectRPC endpoint for creating or revoking them. Internally, revocation carries one carve-out: a read-only key is allowed to revoke itself, so a leaked key always has a rotation path. Revoking a different key from a read-only actor is forbidden.
Custom Base URL
For self-hosted instances or staging environments:
import { createOpenStatusClient } from "@openstatus/sdk-node";
const client = createOpenStatusClient({
apiKey: process.env.OPENSTATUS_API_KEY,
baseUrl: "https://api.staging.example.com/rpc",
});
The baseUrl option takes precedence over the OPENSTATUS_API_URL environment variable.