Skip to main content

Reference

SDK Reference

Record outbound request failures and duration, then compare them with vendor incidents. The SDK is optional; repository scans and vendor alerts work without it.

Quickstart

Use a project SDK key from Settings → Credentials. Select the runtime where your requests run.

Review the data sent by the SDK before adding it. Request paths can contain personal data; request-ID samples and configured vendor account IDs have separate collection settings.

Package installation after release

Bash
npm install @checkupstream/sdk

Initialization

The @checkupstream/sdk package patches globalThis.fetch so existing calls are instrumented with no per-request changes.

TypeScript
import { checkupstream } from "@checkupstream/sdk";

checkupstream.init({
  sdkKey: "cup_sdk_your_key",
});

// Your existing fetch calls are now instrumented
const response = await fetch("https://api.stripe.com/v1/charges");
// Records this request's hostname, path, response status and duration.

Graceful shutdown

TypeScript
process.on("SIGTERM", async () => {
  await checkupstream.shutdown();
  process.exit(0);
});

This example instruments globalThis.fetch. Check the integration recipe before using a different HTTP client or runtime.

Other languages (private beta)

Other language SDKs are in private beta. Contact us with your runtime and HTTP client to confirm access and supported instrumentation.

Available beta runtimes7

Configuration

The fields below apply to the Node.js and browser SDKs. Check the relevant package instructions for other languages.

CheckUpstreamConfig

sdkKeystringRequired

Project key beginning with cup_sdk_. Publishable in browser bundles. Secret API tokens (cup_api_) are rejected.

endpointstringOptional

Telemetry ingestion endpoint.

Default: "https://ingest.checkupstream.com/v1/events"
servicesstring[]Optional

Exact request hostnames, e.g. ["api.stripe.com"]. A slug such as "stripe" matches nothing. Omit to track all eligible hosts; browser first-party exclusions still apply.

Default: undefined
flushIntervalMsnumberOptional

Default flush interval in milliseconds. Explicit configuration and server directives can change it.

Default: Node.js: 30000; browser: 10000
maxBatchSizenumberOptional

Maximum events per batch before auto-flush.

Default: 100
enabledbooleanOptional

Set to false to disable the SDK entirely (useful for test environments).

Default: true

Telemetry events

Events contain the request hostname, path, method, status, duration and time. The SDK batches them for delivery.

Event and batch fields

TelemetryEvent

servicestringRequired

Request hostname, e.g. "api.stripe.com". The field is named service on the wire; the server maps the hostname to a service.

endpointstringRequired

Request path, e.g. "/v1/charges".

methodstringRequired

HTTP method, e.g. "GET".

statusnumberRequired

HTTP status code.

latency_msnumberRequired

Request duration in milliseconds.

tsnumberRequired

Unix timestamp (seconds).

TelemetryBatch

sdk_keystringRequired

The SDK Key (cup_sdk_*) used to authenticate the batch.

batchTelemetryEvent[]Required

Events with the TelemetryEvent fields above.

Auto-detected services

The server maps request hostnames to vendors. The SDK’s services option filters exact hostnames before delivery; use api.stripe.com, not stripe.

Example hostname mappings15
Use the Left and Right Arrow keys to scroll the table.
DomainService
api.stripe.comStripe
api.openai.comOpenAI
api.anthropic.comAnthropic
s3.amazonaws.comAWS S3
dynamodb.amazonaws.comAWS DynamoDB
api.twilio.comTwilio
api.sendgrid.comSendGrid
api.resend.comResend
api.clerk.comClerk
api.supabase.coSupabase
api.posthog.comPostHog
api.segment.ioSegment
api.mixpanel.comMixpanel
api.algolia.comAlgolia
api.cloudinary.comCloudinary

Troubleshooting

Find the matching message below for recovery steps. These codes identify the guides; some SDK messages do not print a code.

These errors concern SDK setup or telemetry delivery. They do not establish that a vendor or your application is down.

Common patterns

Restrict to specific services

Use exact request hostnames. Other hosts pass through without recording. A vendor slug such as stripe matches no requests.

TypeScript
checkupstream.init({
  sdkKey: "cup_sdk_your_key",
  services: ["api.stripe.com", "api.openai.com"],
});

Disable in tests

Tie the SDK to your environment so unit tests don't ping the ingest endpoint.

TypeScript
checkupstream.init({
  sdkKey: "cup_sdk_test_key",
  enabled: process.env.NODE_ENV === "production",
});

Plan your telemetry setup

Confirm runtime availability, then create a key for the project you want to measure.