CircleCI
Run the deployment API check from a CircleCI context containing your token and service slugs. Make deployment require this job to prevent a failed check from being ignored.
1. Save the deployment check
Save this as scripts/check-upstream.mjs. It runs on Node.js 24 without additional packages.
CHECKUPSTREAM_API_TOKEN: a read-scopedcup_api_token stored in CI secrets.CHECKUPSTREAM_SERVICES: comma-separated slugs your organization tracks, such asstripe,openai.
const token = process.env.CHECKUPSTREAM_API_TOKEN;
const services = process.env.CHECKUPSTREAM_SERVICES;
if (!token || !services?.trim()) {
throw new Error("Set CHECKUPSTREAM_API_TOKEN and CHECKUPSTREAM_SERVICES in CI");
}
const url = new URL(
"/api/v1/deploy-gate",
process.env.CHECKUPSTREAM_BASE_URL || "https://checkupstream.com",
);
url.searchParams.set("services", services);
const response = await fetch(url, {
headers: { Authorization: `Bearer ${token}` },
signal: AbortSignal.timeout(20_000),
});
if (!response.ok) throw new Error(`Deployment check failed: HTTP ${response.status}`);
const gate = await response.json();
console.log(JSON.stringify(gate, null, 2));
if (
gate?.safe !== true ||
!Number.isInteger(gate.totalServicesChecked) ||
gate.totalServicesChecked <= 0
) {
process.exitCode = 1;
}2. Add the CircleCI job
Create a checkupstream context with both variables and restrict its use to the appropriate project and branch. Add requires: [check-upstream] to your deployment job.
version: 2.1
jobs:
check-upstream:
docker:
- image: cimg/node:24.0
steps:
- checkout
- run:
name: Check selected vendors
command: node scripts/check-upstream.mjs
workflows:
deployment-check:
jobs:
- check-upstream:
context: checkupstream
filters:
branches:
only: mainThis script blocks deployment for: a recorded major outage, unmatched services, empty results, invalid responses, failed requests or missing configuration.
It does not block for: degraded, partial-outage, maintenance or unknown status. It does not check how old a status is. The API response omits observation dates; check the vendor's status page for that context.
This checks stored vendor status, so a passing result cannot guarantee a safe deployment or confirm application health. Your deployment job must require this check.
Continue your setup
Review the endpoints and credentials used by your integration.