Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/sdk-node. SDK for openstatus www.openstatus.dev
Something went wrong. Try again.
Markdown
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.
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.