# Keybeat documentation > Keybeat is a Playwright based key transaction and availability monitoring service for indie developers and small SaaS teams. You upload Playwright Test specs, Keybeat runs them on a schedule from several regions, and alerts you when they fail or slow down. It is API first and built to be driven by AI coding agents through a CLI, a REST API and a remote MCP server. This file contains every page of https://keybeat.dev/docs as markdown. --- Source: https://keybeat.dev/docs # Keybeat documentation Keybeat runs your Playwright tests against your live site on a schedule, from several regions, and tells you when a key flow such as login, signup or checkout fails or gets slow. It is API first and designed to be driven by AI coding agents. You can ask Claude Code (or another agent) to "monitor my checkout flow with Keybeat", and it can write the Playwright spec, test it locally, deploy it, and later read failures, logs and traces to tell you what broke. ## Start here - [Quickstart](https://keybeat.dev/docs/quickstart): sign up, write your first monitor and deploy it with the CLI. - [Quickstart for agents](https://keybeat.dev/docs/agents): how Claude Code and other agents should set up and operate Keybeat. - [Writing monitors](https://keybeat.dev/docs/writing-monitors): the rules a monitor spec must follow, secrets, TOTP logins and allowlisting. - [Pricing](https://keybeat.dev/pricing): one free monitor, then $5 per month for the base plan. ## Core concepts | Concept | What it is | |---|---| | Monitor | One Playwright Test spec file plus an interval, a name and a slug. Keybeat runs it on schedule. | | Run | One execution of a monitor in one region. Has a status, step timings, logs and, on failure, a trace and screenshot. | | Region | Where a run executes: `iad` (US East), `fra` (EU West) or `sin` (Asia). Each scheduled run picks one at random. | | Incident | A period when a monitor is down (failing) or slow. Opens and resolves automatically. | | Alert channel | Where notifications go: email, a signed webhook, or SMS. | | Status page | One public page per organization at `status.keybeat.dev/`. | | Organization | Monitors, channels, keys and billing belong to an organization. Members are `owner` or `member`. | ### Run statuses | Status | Meaning | |---|---| | `queued`, `starting`, `running` | The run is in progress. | | `passed` | Every test in the spec passed. | | `failed` | A test failed or the run hit the 60 second limit. Scheduled failures are retried at once from another region before anyone is alerted. | | `error` | Infrastructure trouble on Keybeat's side. Never counts as a monitor failure and never alerts you. | ### Monitor states A monitor's `state` is `unknown` (no result yet), `up` or `down`. Its `perf_state` is `normal` or `slow`, based on an automatic per region baseline. See [Alerts](https://keybeat.dev/docs/alerts) for exactly when these change. ## Ways to use Keybeat | Interface | Best for | Docs | |---|---|---| | CLI (`npx keybeat`) | Local testing, deploying monitors from a repo, CI | [CLI reference](https://keybeat.dev/docs/cli) | | REST API | Scripts and integrations | [REST API](https://keybeat.dev/docs/api) | | Remote MCP server | Agents that should inspect runs and manage monitors | [MCP server](https://keybeat.dev/docs/mcp) | | Dashboard | Humans: approvals, billing, channels, browsing runs | [app.keybeat.dev](https://app.keybeat.dev) | ## For agents reading this Every docs page is available as plain markdown by adding `.md` to its URL, for example [/docs/quickstart.md](https://keybeat.dev/docs/quickstart.md). The whole documentation is also available as one file at [/llms-full.txt](https://keybeat.dev/llms-full.txt), with an index at [/llms.txt](https://keybeat.dev/llms.txt). ## What Keybeat does not do (in v1) - No plain HTTP or ping checks. Every check is a Playwright browser check. - Chromium only. No Firefox or WebKit. - No npm packages beyond `@playwright/test` and `otpauth`, and no multi file test suites. - No static IP addresses. Use the `X-Keybeat-Token` header to allowlist Keybeat traffic. - No monitoring of private networks, `localhost` or internal hosts. - No cloud runs of unsaved drafts. Test locally with `npx keybeat test`. --- Source: https://keybeat.dev/docs/quickstart # Quickstart This guide takes you from nothing to a deployed monitor in about ten minutes. You need Node.js 20 or later and a site with a public URL. If you would rather have your coding agent do this for you, see [Quickstart for agents](https://keybeat.dev/docs/agents). ## 1. Create an account Sign up at [app.keybeat.dev/signup](https://app.keybeat.dev/signup) with GitHub, Google or an email magic link. Signing up creates a personal organization on the free plan, with an email alert channel for your address. ## 2. Log in from the CLI The CLI is published on npm as `keybeat` and runs with `npx`, so there is nothing to install globally. ```bash npx keybeat login ``` The CLI prints a short code and opens `https://app.keybeat.dev/authorize/cli` in your browser. Check that the code matches, pick an organization and approve. The CLI receives an API key and stores it in `~/.config/keybeat/credentials.json`. Check that it worked: ```bash npx keybeat whoami ``` ## 3. Create the keybeat folder From the root of your project: ```bash npx keybeat init ``` This creates a `keybeat/` folder with a `keybeat.json` file and an example spec. Monitors live in your repository next to your code, so they are reviewed and versioned like everything else. See [Monitors as code](https://keybeat.dev/docs/monitors-as-code). ## 4. Write a monitor A monitor is a single Playwright Test spec. Replace the example with a check of something that matters, such as your login page: ```ts title="keybeat/login.spec.ts" import { test, expect } from '@playwright/test'; test('login works', async ({ page }) => { await test.step('open login page', async () => { await page.goto('https://example.com/login'); await expect(page.getByRole('heading', { name: 'Sign in' })).toBeVisible(); }); await test.step('sign in', async () => { await page.getByLabel('Email').fill(process.env.LOGIN_EMAIL!); await page.getByLabel('Password').fill(process.env.LOGIN_PASSWORD!); await page.getByRole('button', { name: 'Sign in' }).click(); }); await test.step('see the dashboard', async () => { await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible(); }); }); ``` And list it in `keybeat/keybeat.json`: ```json title="keybeat/keybeat.json" { "monitors": [ { "slug": "login", "name": "Login works", "file": "login.spec.ts", "interval": "60m", "enabled": true } ] } ``` The free plan allows one monitor at a 60 minute interval. Paid plans allow `15m`, `5m` and `1m`. See [Writing monitors](https://keybeat.dev/docs/writing-monitors) for the full rules. ## 5. Test it locally ```bash LOGIN_EMAIL=monitor@example.com LOGIN_PASSWORD='...' npx keybeat test login ``` `keybeat test` runs the spec on your machine with the same settings as the cloud runner: Chromium, one worker, no retries and a 60 second limit. It uses your local Playwright install, so if Chromium is missing run `npx playwright install chromium` once. ## 6. Deploy `deploy` creates or updates every monitor listed in `keybeat.json`. A monitor that needs secrets would fail its first scheduled run without them, so deploy it disabled first. Set `"enabled": false` in `keybeat.json`, then: ```bash npx keybeat deploy npx keybeat env set login LOGIN_EMAIL=monitor@example.com npx keybeat env set login LOGIN_PASSWORD # prompts for the value without echoing it ``` Secrets are encrypted, write only, and masked as `***` in logs. In scripts, pipe the value instead (`printf '%s' "$LOGIN_PASSWORD" | npx keybeat env set login LOGIN_PASSWORD`) so it never appears on a command line. Now set `"enabled": true` and deploy again: ```bash npx keybeat deploy ``` Monitors without secrets can be deployed enabled straight away. ## 7. Run it in the cloud ```bash npx keybeat run login ``` This starts an on-demand run, waits for the result and prints each step with its timing. From now on Keybeat runs the monitor on its schedule from a random region and emails you if it fails twice in a row from two different regions. ## Next steps - Add more alert channels, such as a webhook or SMS: [Alerts](https://keybeat.dev/docs/alerts). - Publish a public status page: [Status pages](https://keybeat.dev/docs/status-pages). - Deploy monitors from CI with an API key: [Monitors as code](https://keybeat.dev/docs/monitors-as-code). - Let your agent investigate failures through the [MCP server](https://keybeat.dev/docs/mcp). --- Source: https://keybeat.dev/docs/agents # Quickstart for agents Keybeat is built so that an AI coding agent can do the work: write the Playwright spec, test it, deploy it, and later investigate failures. A human only needs to approve access once in the browser, and to start a paid subscription if one is needed. This page is written for both the human and the agent. If you are an agent, the [checklist](#agent-checklist) is the part to follow. ## What it looks like You tell your agent: > Monitor my checkout flow with Keybeat. A capable agent will then: 1. Read these docs (from [/llms-full.txt](https://keybeat.dev/llms-full.txt) or the `.md` version of any page). 2. Check access with `npx keybeat whoami --json`, and if needed start `npx keybeat login --no-wait --json` and ask you to approve in the browser. 3. Create `keybeat/checkout.spec.ts` and add it to `keybeat/keybeat.json`. 4. Run `npx keybeat test checkout` until it passes locally. 5. Store any secrets with `npx keybeat env set`, then run `npx keybeat deploy`. 6. Run `npx keybeat run checkout --json` once to confirm it passes in the cloud. Later you can ask "why did the checkout monitor fail last night?" and the agent can list failed runs, read the failing step, error message and logs, and download the Playwright trace. ## Two ways for an agent to connect | | CLI | MCP server | |---|---|---| | Setup | None. `npx keybeat` in the project | `claude mcp add --transport http keybeat https://mcp.keybeat.dev/mcp` | | Auth | Device login, approved once by a human, or `KEYBEAT_API_KEY` | OAuth, approved once by a human in the browser | | Can test locally | Yes, `keybeat test` | No, MCP calls the cloud API only | | Deploys from repo files | Yes, `keybeat deploy` | Through `upsert_monitor`, one monitor at a time | | Best for | Writing and deploying monitors from a repo | Inspecting runs and incidents from any project | Most setups use both: the CLI to build and deploy monitors in the repository, and the MCP server to investigate failures. See the [CLI reference](https://keybeat.dev/docs/cli) and [MCP server](https://keybeat.dev/docs/mcp). ## Adding Keybeat to Claude Code ```bash claude mcp add --transport http keybeat https://mcp.keybeat.dev/mcp ``` The first time Claude Code uses the server it opens a browser window. Log in to Keybeat, pick an organization and approve. Other MCP clients that support remote servers over HTTP with OAuth work the same way with the URL `https://mcp.keybeat.dev/mcp`. The Keybeat plugin for Claude Code installs the MCP server together with a skill that teaches Claude how to write, test, deploy and debug monitors. See [Claude Code plugin](https://keybeat.dev/docs/claude-code). ## Agent checklist Follow these steps in order. Use `--json` on every CLI command and parse the output. 1. **Check access.** Run `npx keybeat whoami --json`. If it exits with code 3, log in in two steps, so your shell does not block while the human approves: ```bash npx keybeat login --no-wait --json # prints verification_url and user_code npx keybeat login --resume --json # after the human says they approved ``` Show the URL and the code to the human. The approval screen asks them to check that the code matches. Do not try to sign up or approve on the human's behalf. 2. **Check the plan.** `whoami` returns the organization's plan, limits and usage. The free plan allows one monitor at a 60 minute interval. If the human asks for more, tell them what it will cost (see [Billing](https://keybeat.dev/docs/billing)) before creating paid monitors. 3. **Initialise.** If there is no `keybeat/` folder, run `npx keybeat init`. 4. **Write the spec.** One file per monitor in `keybeat/`, importing only from `@playwright/test`, `otpauth` and Node built-ins. Read [Writing monitors](https://keybeat.dev/docs/writing-monitors) first. Use `test.step()` for each meaningful stage so failures point at a step. 5. **Never hard code secrets.** Read credentials from `process.env`. Ask the human for values, or for permission to use existing ones, and store them by piping the value, for example `printf '%s' "$VALUE" | npx keybeat env set NAME`, so it never appears on a command line. Do not write secret values to files in the repository. 6. **Test locally.** `npx keybeat test ` with the env vars set in your shell. Fix the spec until it passes reliably. Run it at least twice. Keep the run well under 60 seconds. 7. **Deploy.** For monitors that need secrets: deploy with `"enabled": false`, set the secrets, then enable and deploy again. Otherwise `npx keybeat deploy` once. Use `npx keybeat deploy --dry-run --json` first to see the changes and the billing estimate. Do not use `--prune` unless the human asked for it, because it deletes monitors and their history. Destructive commands need `--yes` in a non-interactive shell; without it they exit with code 2 and `confirmation_required`. 8. **Verify in the cloud.** `npx keybeat run --json` and check `status` is `passed`. 9. **Report back.** Tell the human what you deployed, the interval, the monthly cost change if any, and where alerts will go. ### Investigating a failure ```bash npx keybeat monitors get checkout --json # state, perf_state, last run npx keybeat runs list checkout --status failed --json npx keybeat runs get --json # steps, error, logs, artifact URLs ``` The run detail includes each step with its duration and status, the first error message, the logs (with secrets masked) and short-lived URLs for the Playwright trace and final screenshot. Traces exist only for failed runs. To inspect a trace, download it with `npx keybeat runs get --download ./keybeat-artifacts` and open it with `npx playwright show-trace`. Traces can contain values typed into the page, including secrets, so do not paste them anywhere public. Tell the human whether the failure looks like a real problem on their site (a changed page, a 500 error, a slow response) or a fragile spec (a locator that broke after a harmless UI change). Fix the spec only in the second case, test locally and deploy again. Remember the alerting rules: a scheduled failure is retried at once from another region, and the human is only alerted if the retry also fails. Runs with status `error` are Keybeat infrastructure problems, not site problems. ## Billing and agents An API key can change billing without further confirmation once the organization has a subscription. Creating a 5 minute or 1 minute monitor, or more than three 15 minute monitors, adds add-on charges that are prorated in Stripe at once. The API response includes a `billing_change` object listing each changed add-on (`items`, with the new and previous quantity and the amount change) and the net `amount_delta_cents`. If the organization is on the free plan and the agent tries to create a monitor that needs a paid plan, the API returns HTTP 402 with a `checkout_url`. The agent should give that URL to the human, who completes checkout in the browser. Agents cannot start a subscription on their own. ## A snippet for your CLAUDE.md or AGENTS.md Paste this into your repository's agent instructions so every session knows how monitoring works: ```text ## Monitoring (Keybeat) - Synthetic monitors live in keybeat/ (Playwright Test specs) and keybeat/keybeat.json. - Docs: https://keybeat.dev/llms-full.txt - Test locally: npx keybeat test . Deploy: npx keybeat deploy. Use --json. - Only @playwright/test, otpauth and Node built-ins are available. 60 second limit per run. - Secrets come from process.env and are set by piping: printf '%s' "$VALUE" | npx keybeat env set NAME - Ask before adding monitors that change the bill, and never run deploy --prune without asking. ``` --- Source: https://keybeat.dev/docs/writing-monitors # Writing monitors A Keybeat monitor is one Playwright Test spec file. If you have written a Playwright test before, you already know how to write a monitor. This page covers the rules that are specific to Keybeat. ## The rules | Rule | Detail | |---|---| | One file | Each monitor is a single spec file, TypeScript (`.ts`) or JavaScript (`.js`). It cannot import other local files. | | At least one test | The file must contain at least one `test()`. | | Size | At most 100 KB. | | Libraries | `@playwright/test`, `otpauth` and Node.js built-in modules. No npm installs. | | Browser | Chromium only, headless. | | Time limit | 60 seconds per run. | | Config | Keybeat supplies the Playwright config. You do not upload a `playwright.config.ts`. | You can check a script without running it with `POST /v1/monitors/validate` (or the `validate_script` MCP tool). Validation is static: it checks that the script parses, contains a test, is within the size limit and imports nothing but `@playwright/test`, `otpauth` and Node.js built-in modules (any other import is rejected, as is importing a local file). It does not open your site. `keybeat deploy` runs the same validation and deploys nothing if one script is invalid. ## How Keybeat runs your spec Every run uses the same settings, both in the cloud and in `npx keybeat test`: - Chromium, headless - `workers: 1` and `retries: 0` - trace: `retain-on-failure` - screenshot: `only-on-failure` - 60 second run timeout Keybeat does not retry inside the run. Instead, when a scheduled run fails, Keybeat starts a fresh run from a different region at once, and alerts only if that also fails. See [Alerts](https://keybeat.dev/docs/alerts). Each run records the duration and status of every step, plus stdout and stderr. Failed runs also keep the Playwright trace and a final screenshot. A trace records what the browser did, including values typed into the page, so it can contain secrets: artifact links are only given to members of your organization, and they expire after a few minutes. Runs and artifacts are kept for 30 days on paid plans and 7 days on the free plan. ## A good monitor ```ts title="keybeat/checkout.spec.ts" import { test, expect } from '@playwright/test'; test('checkout reaches payment', async ({ page }) => { await test.step('open product page', async () => { await page.goto('https://shop.example.com/products/t-shirt'); await expect(page.getByRole('heading', { name: 'T-shirt' })).toBeVisible(); }); await test.step('add to cart', async () => { await page.getByRole('button', { name: 'Add to cart' }).click(); await expect(page.getByTestId('cart-count')).toHaveText('1'); }); await test.step('start checkout', async () => { await page.getByRole('link', { name: 'Checkout' }).click(); await expect(page).toHaveURL(/\/checkout/); await expect(page.getByRole('heading', { name: 'Payment' })).toBeVisible(); }); }); ``` Tips: - **Use `test.step()`.** Steps appear in run results as `test title > step title` with their own timings, so a failure tells you which stage broke. - **Assert outcomes, not just clicks.** Finish each step with an `expect` that proves the step worked. - **Prefer role and label locators** (`getByRole`, `getByLabel`, `getByTestId`) over CSS selectors. They survive cosmetic changes. - **Stay well under 60 seconds.** Aim for under 20 seconds. Slow pages are reported by the slowness detection anyway. - **Do not create real orders or charges.** Stop before payment, or use a dedicated test account, a test product or a full discount code that your backend recognises. - **Use a dedicated monitoring account** so its activity is easy to filter out of analytics and easy to revoke. - **One flow per monitor.** Several small monitors give clearer alerts than one long one. You can use `test.use()` in the file for per-file options such as viewport, locale or timezone. ## The 60 second limit A run has 60 seconds. Keybeat stops a run that goes past the limit and reports it as `failed` with a timeout message. Timeouts count as failures, so a scheduled run that times out is retried from another region, and if the retry also times out you are alerted. The time that counts towards slowness detection is the Playwright test duration, not the time it takes to start the machine. ## Environment variables and secrets Each monitor can have its own environment variables, available to the spec as `process.env.NAME`. - Names must match `[A-Z_][A-Z0-9_]*`, for example `LOGIN_EMAIL` or `TOTP_SECRET`. - Values are encrypted at rest and are write only. Neither the API, the CLI nor the dashboard ever shows them again. You can list names only. - Every value is replaced with `***` in logs, error messages and step titles. Set them with the CLI: ```bash npx keybeat env set login LOGIN_EMAIL=monitor@example.com LOGIN_PASSWORD='s3cret' npx keybeat env list login npx keybeat env unset login LOGIN_PASSWORD ``` Or with the API: ```bash curl -X PUT https://api.keybeat.dev/v1/monitors/login/env \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "set": { "LOGIN_PASSWORD": "s3cret" }, "unset": ["OLD_TOKEN"] }' ``` When you run `npx keybeat test` locally, the spec reads variables from your own shell environment. Cloud secrets are never downloaded. ## Logging in with two factor authentication Keybeat supports TOTP codes (the six digit codes from authenticator apps) through the preinstalled `otpauth` library. When you enable 2FA for the monitoring account, save the setup secret (the base32 string behind the QR code) as an environment variable. ```ts title="keybeat/login-2fa.spec.ts" import { test, expect } from '@playwright/test'; import * as OTPAuth from 'otpauth'; test('login with 2FA', async ({ page }) => { await test.step('enter password', async () => { await page.goto('https://app.example.com/login'); await page.getByLabel('Email').fill(process.env.LOGIN_EMAIL!); await page.getByLabel('Password').fill(process.env.LOGIN_PASSWORD!); await page.getByRole('button', { name: 'Sign in' }).click(); }); await test.step('enter TOTP code', async () => { const totp = new OTPAuth.TOTP({ secret: OTPAuth.Secret.fromBase32(process.env.TOTP_SECRET!), algorithm: 'SHA1', digits: 6, period: 30, }); await page.getByLabel('Authentication code').fill(totp.generate()); await page.getByRole('button', { name: 'Verify' }).click(); }); await test.step('see the dashboard', async () => { await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible(); }); }); ``` ```bash npx keybeat env set login-2fa LOGIN_EMAIL=monitor@example.com LOGIN_PASSWORD='...' TOTP_SECRET=JBSWY3DPEHPK3PXP ``` Keybeat does not provide test email inboxes or SMS numbers, so flows that need an emailed code or magic link cannot be monitored end to end in v1. ## What the runner blocks Monitors run on isolated, single use machines. To prevent abuse, the runner drops traffic to: - private networks (`10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16` and IPv6 private ranges) - loopback (`127.0.0.0/8`, `::1`) - link-local addresses, including cloud metadata endpoints such as `169.254.169.254` - carrier-grade NAT (`100.64.0.0/10`) - Keybeat's own private network Each run is also capped at 2,000 requests and 300 MB transferred. In practice: monitor public URLs only. You cannot monitor `localhost`, a staging server on a VPN, or hosts that resolve to private addresses. Test those locally with `npx keybeat test`. ## Identifying and allowlisting Keybeat traffic Keybeat's browser identifies itself. The user agent is the normal Chromium user agent followed by: ```text Keybeat/1.0 (+https://keybeat.dev/bot) ``` Keybeat does not use static IP addresses in v1, so do not allowlist by IP. Instead, every request the monitor's browser makes carries a secret header unique to your organization: ```http X-Keybeat-Token: ``` Use it to let monitors through bot protection, rate limits, CAPTCHAs or maintenance pages. Find the token in the dashboard. You can rotate it at any time with `POST /v1/org/allowlist-token/rotate`, after which new runs send the new value. The header is sent on every request the browser makes, including requests to third party hosts your page loads (analytics, fonts, CDNs). Treat it as a way to recognise Keybeat traffic, not as an authentication credential, and rotate it if you think it has leaked. Example: a Cloudflare WAF custom rule that skips bot checks for Keybeat. ```text Expression: (http.request.headers["x-keybeat-token"][0] eq "") Action: Skip (bot fight mode, rate limiting rules) ``` Example: nginx, exempting Keybeat from a rate limit. ```text map $http_x_keybeat_token $limit_key { "" ""; default $binary_remote_addr; } limit_req_zone $limit_key zone=site:10m rate=10r/s; ``` If you run a site that receives Keybeat traffic you did not set up, see [keybeat.dev/bot](https://keybeat.dev/bot). --- Source: https://keybeat.dev/docs/monitors-as-code # Monitors as code Keybeat monitors live in your repository, next to the code they check. A `keybeat/` folder holds a `keybeat.json` file and one spec file per monitor. `npx keybeat deploy` makes your Keybeat organization match the folder. ## Layout ```text your-project/ keybeat/ keybeat.json login.spec.ts checkout.spec.ts signup.spec.js ``` Create it with `npx keybeat init`. ## keybeat.json ```json title="keybeat/keybeat.json" { "monitors": [ { "slug": "login", "name": "Login works", "file": "login.spec.ts", "interval": "15m" }, { "slug": "checkout", "name": "Checkout reaches payment", "file": "checkout.spec.ts", "interval": "5m" }, { "slug": "signup", "name": "Signup form loads", "file": "signup.spec.js", "interval": "60m", "enabled": false } ] } ``` | Field | Required | Description | |---|---|---| | `slug` | Yes | Unique within your organization. Lowercase letters, digits and hyphens (`[a-z0-9-]`). Used in URLs, the CLI and the API. Changing it creates a new monitor. | | `name` | Yes | Human readable name, shown in alerts and on your status page. | | `file` | Yes | Path to the spec, relative to the `keybeat/` folder. | | `interval` | Yes | How often to run: `60m`, `15m`, `5m` or `1m`. | | `enabled` | No | `false` deploys the monitor paused, `true` resumes it. When left out, new monitors start enabled and existing monitors keep their current state, so a monitor paused in the dashboard stays paused. | | `alert_channel_ids` | No | Channel ids to alert, or `null` for every channel in the organization. When left out, the monitor keeps the channels set in the dashboard (all channels for a new monitor). | | `on_status_page` | No | Show the monitor on your status page. When left out, the monitor keeps the setting from the dashboard (off for a new monitor). | ### Intervals and cost | Interval | Seconds | Free plan | Paid plan | |---|---|---|---| | `60m` | 3600 | Yes, one monitor | Yes, billed as a 15 minute monitor | | `15m` | 900 | No | 3 included, then $2 per month each | | `5m` | 300 | No | $5 per month each | | `1m` | 60 | No | $19 per month each | Paused monitors still occupy their slot and are still billed. Delete monitors you no longer need. See [Billing](https://keybeat.dev/docs/billing). ## Deploying ```bash npx keybeat deploy ``` For each entry in `keybeat.json`, `deploy` reads the spec file and upserts the monitor by slug (`PUT /v1/monitors/:slug`). It creates monitors that do not exist and updates the name and script, the interval, and any of `enabled`, `alert_channel_ids` and `on_status_page` that the file sets. Settings the file leaves out keep the values made in the dashboard. Monitors in your organization that are not in the file are left alone. `npx keybeat deploy --dry-run` shows what would change, with the estimated billing change, without changing anything. To make the organization match the file exactly, deleting monitors that are not listed: ```bash npx keybeat deploy --prune ``` Deleting a monitor deletes its run history. Use `--prune` with care, and never in an automated job unless you are sure the file is the complete list. Secrets are not part of `keybeat.json` and should never be committed. Set them once per monitor with `npx keybeat env set` (see [Writing monitors](https://keybeat.dev/docs/writing-monitors#environment-variables-and-secrets)). They persist across deploys. ## Deploying from CI Create an API key in the dashboard and store it as a CI secret named `KEYBEAT_API_KEY`. The CLI reads it from the environment, so no login step is needed. ```yaml title=".github/workflows/keybeat.yml" name: Deploy Keybeat monitors on: push: branches: [main] paths: ['keybeat/**'] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npx keybeat deploy --json env: KEYBEAT_API_KEY: ${{ secrets.KEYBEAT_API_KEY }} ``` You can also run `npx keybeat test` in CI before deploying, to catch broken specs. That needs Chromium on the CI machine (`npx playwright install --with-deps chromium`) and the monitor's env vars as CI secrets. ## Billing changes on deploy On a paid organization, a deploy that adds add-ons (for example a new 5 minute monitor) succeeds and updates your Stripe subscription with proration at once. On the free plan, a deploy that needs a paid plan fails for that monitor with HTTP 402 and a checkout link. See [Billing](https://keybeat.dev/docs/billing). --- Source: https://keybeat.dev/docs/cli # CLI reference The Keybeat CLI is published on npm as `keybeat`. Run it with `npx`: ```bash npx keybeat [arguments] [flags] ``` It requires Node.js 20 or later. ## Authentication The CLI looks for credentials in this order: 1. The `KEYBEAT_API_KEY` environment variable (an API key starting with `kb_`). Use this in CI. 2. `$XDG_CONFIG_HOME/keybeat/credentials.json` (default `~/.config/keybeat/credentials.json`), written by `keybeat login`. ## Environment variables | Variable | Description | |---|---| | `KEYBEAT_API_KEY` | API key (`kb_...`). Takes precedence over saved credentials. | | `KEYBEAT_API_URL` | API base URL. Default `https://api.keybeat.dev`. | | `KEYBEAT_APP_URL` | Dashboard URL used by `keybeat open`. Default `https://app.keybeat.dev`. | | `KEYBEAT_NO_BROWSER` | Set to `1` to never open a browser (`login`, `open` and billing links). | | `XDG_CONFIG_HOME` | Credentials go to `$XDG_CONFIG_HOME/keybeat/credentials.json`. Default `~/.config`. | | `NO_COLOR` | Disables colors. | ## Global flags | Flag | Description | |---|---| | `--json` | Print one JSON document on stdout instead of human readable output. Progress goes to stderr. Supported by every command. Agents should always use it. | | `-y`, `--yes` | Never prompt, and confirm destructive actions. | | `--no-color` | Disable colors (also when `NO_COLOR` is set or stdout is not a TTY). | The CLI never prompts when stdout is not a TTY. Destructive commands (`deploy --prune`, `monitors delete`, `channels delete`) then refuse to run without `--yes`: they exit with code 2 and the error code `confirmation_required`, and change nothing. With `--json`, errors are printed in the API's error format, `{ "error": { "code": "...", "message": "...", "details": { ... } } }`. `details.hint` says how to fix the problem. ## Exit codes | Code | Meaning | |---|---| | 0 | Success. | | 1 | A run or local test failed, or another error. | | 2 | Invalid arguments, `keybeat.json` or script, Playwright missing, or confirmation required. | | 3 | Not logged in, invalid API key or missing permission. | | 4 | Not found. | | 5 | The plan or a monthly cap does not allow it (402 with a checkout URL, or the on-demand cap). | | 6 | Keybeat unreachable, rate limited, or an infrastructure error (run status `error`). | ## Account ### `keybeat login` Logs in with the device flow. The CLI prints a verification URL and a short code and tries to open the browser. A human logs in at `app.keybeat.dev`, checks that the code matches the one in the terminal, picks an organization and approves. The CLI then receives an API key for that organization and saves it to the credentials file (mode 0600). The request expires after 10 minutes. | Flag | Description | |---|---| | `--no-browser` | Do not try to open a browser. | | `--no-wait` | Print the URL and code, save the pending request and exit. | | `--resume` | Continue polling a request started with `--no-wait`. | Agents whose shell blocks until a command ends should use the two step form: ```bash npx keybeat login --no-wait --json # show verification_url and user_code to the human npx keybeat login --resume --json # after the human approved ``` ### `keybeat logout` Removes the saved credentials file. ### `keybeat whoami` Shows the current identity, organization, plan, limits and usage this month (from `GET /v1/me`). Exit code 3 means not logged in or the key is invalid. ```bash npx keybeat whoami --json ``` ### `keybeat open` Opens the Keybeat dashboard in your browser. `--no-browser` only prints the URL. ## Project ### `keybeat init` Creates a `keybeat/` folder in the current directory with a `keybeat.json` file and an example spec. It never overwrites files. `--dir ` picks another folder name. See [Monitors as code](https://keybeat.dev/docs/monitors-as-code). ### `keybeat test [slug]` Runs monitors locally with your installed Playwright, using the same configuration as the cloud runner: Chromium headless, one worker, no retries, trace on failure, the 60 second limit and the Keybeat user agent suffix. When you are logged in, requests also carry your organization's `X-Keybeat-Token` header. With a slug, runs only that monitor. Without one, runs every monitor in `keybeat.json`, one after another. | Flag | Description | |---|---| | `--dir ` | Path to the keybeat folder. Default `./keybeat`. | | `--headed` | Show the browser window. The cloud always runs headless. | | `--no-token` | Do not send the `X-Keybeat-Token` allowlist header. | ```bash LOGIN_EMAIL=me@example.com npx keybeat test login ``` Specs read environment variables from your shell. Cloud secrets are never downloaded. The command needs `@playwright/test` in the repository and Chromium (`npx playwright install chromium`). It exits with code 1 when a monitor fails, and 2 when Playwright or Chromium is missing or `keybeat.json` is invalid. ### `keybeat deploy` Validates `keybeat.json` and every spec (nothing is deployed if one script is invalid), compares with the organization, then upserts each new or changed monitor by slug. Unchanged monitors are not touched. Secrets are not part of `keybeat.json` and persist across deploys. | Flag | Description | |---|---| | `--dir ` | Path to the keybeat folder. Default `./keybeat`. | | `--dry-run` | Show what would change, including the estimated billing change, without changing anything. | | `--prune` | Also delete monitors in the organization that are not listed in `keybeat.json`. Deletes their history. Asks first on a TTY; elsewhere it needs `--yes`. | Settings made in the dashboard are kept when `keybeat.json` leaves them out: alert channels, the status page flag, and a pause (see [Monitors as code](https://keybeat.dev/docs/monitors-as-code)). Exit codes: 0 all done, 1 a monitor failed, 2 invalid file or script or confirmation needed, 5 a monitor needs a paid plan. ```bash npx keybeat deploy --dry-run npx keybeat deploy --prune --dry-run && npx keybeat deploy --prune --yes ``` ## Monitors ### `keybeat monitors list` Lists monitors with their state, interval and last run. ### `keybeat monitors get ` Shows one monitor (slug or id): `state`, `perf_state`, interval, whether it is enabled, env var names and its last run. `--script` also prints the script (always included with `--json`). ### `keybeat monitors pause ` Pauses scheduled runs. A paused monitor still occupies its plan slot. ### `keybeat monitors resume ` Resumes a paused monitor. Plan limits are checked on resume. ### `keybeat monitors delete ` Deletes the monitor and its run history. Needs `--yes` when not on a TTY. ## Runs ### `keybeat run ` Starts an on-demand run of a deployed monitor in the cloud, waits for the result and prints each step with its status and duration. On-demand runs count towards your monthly cap (10 on the free plan, 100 on the base plan). They never change the monitor's state and never send alerts. | Flag | Description | |---|---| | `--region ` | `iad`, `fra` or `sin`. Default: random. | | `--no-wait` | Start the run and return at once. The returned run has status `starting`. | Exit codes: 0 passed, 1 failed, 5 monthly cap reached, 6 infrastructure error (status `error`). ```bash npx keybeat run checkout --region sin --json ``` To try a spec that is not deployed yet, use `keybeat test` instead. Keybeat does not run unsaved drafts in the cloud. ### `keybeat runs list [slug]` Lists recent runs, newest first, for one monitor or all of them. | Flag | Description | |---|---| | `--status ` | Only runs with this status: `queued`, `starting`, `running`, `passed`, `failed` or `error`. | | `--trigger ` | Only `schedule`, `retry` or `manual` runs. | | `--limit ` | How many runs, 1 to 100. Default 20. | | `--cursor ` | The next page (with a slug only). | ### `keybeat runs get ` Shows the full run: trigger, region, status, duration, the error message, every step with timings, the masked logs, and short-lived URLs for the trace and screenshot when the run failed. | Flag | Description | |---|---| | `--download ` | Save the trace (`-trace.zip`) and screenshot (`-screenshot.png`) into this folder. | | `--no-logs` | Do not print the logs (always included with `--json`). | ## Environment variables ### `keybeat env set [assignments...]` Sets one or more encrypted environment variables on a monitor. Values are write only and masked as `***` in logs. Names must match `[A-Z_][A-Z0-9_]*`. Variables persist across deploys. Each assignment is one of: | Form | Value | |---|---| | `NAME=value` | The literal value. It ends up in your shell history and process list. | | `NAME=@file` | The contents of a file. | | `NAME=@-` | Read from stdin. | | `NAME` | Read from stdin, or from a hidden prompt on a TTY. | One trailing newline is removed from file and stdin values. `--stdin` reads several `NAME=value` lines in dotenv format from stdin instead. Piping is the safe way to pass secrets, because the value never appears on the command line: ```bash printf '%s' "$LOGIN_PASSWORD" | npx keybeat env set login LOGIN_PASSWORD npx keybeat env set login LOGIN_EMAIL=@./email.txt npx keybeat env set login --stdin < .env.monitors ``` ### `keybeat env unset NAME [NAME ...]` Removes environment variables. ### `keybeat env list ` Lists the names of a monitor's environment variables. Values are never shown. ## Alert channels ### `keybeat channels list` Lists the organization's alert channels with their id, type, target and whether they are enabled. ### `keybeat channels add ` Adds a channel. The target is an email address, an HTTPS URL or a phone number in international format (for example `+447700900123`). US and Canadian numbers (+1) are not supported. SMS alerts are only sent on the base plan. For webhooks, the output includes the signing secret. `--disabled` creates the channel disabled. ### `keybeat channels test ` Sends a test notification through the channel. ### `keybeat channels delete ` Deletes the channel. Needs `--yes` when not on a TTY. See [Alerts](https://keybeat.dev/docs/alerts) for what each channel sends. ## Billing ### `keybeat billing` Shows the plan, billing interval, subscription items and quantities, the next invoice estimate and the plan limits (from `GET /v1/billing`). Agents cannot pay: give checkout and portal links to a human. | Flag | Description | |---|---| | `--checkout ` | Create a Stripe Checkout link for a human to subscribe. | | `--portal` | Create a Stripe billing portal link for a human. | | `--no-browser` | Do not open the link. | ## Examples for agents ```bash # Who am I, and what can this organization do? npx keybeat whoami --json # Preview, then deploy everything in keybeat/keybeat.json npx keybeat deploy --dry-run --json npx keybeat deploy --json # Confirm a monitor passes in the cloud npx keybeat run checkout --json # Find the latest failure, read it and download its trace npx keybeat runs list checkout --status failed --json npx keybeat runs get 0b6c2d9e-5f1a-4c55-9a77-2f3e1d0c9b8a --download ./keybeat-artifacts --json ``` --- Source: https://keybeat.dev/docs/api # REST API Everything in Keybeat is available through a JSON REST API at `https://api.keybeat.dev`. The CLI, the MCP server and the dashboard all use it. The complete reference, with every endpoint, parameter and schema, is the OpenAPI 3.1 document at [api.keybeat.dev/openapi.json](https://api.keybeat.dev/openapi.json). Load it into your favourite API client, or give it to your agent. This page explains the conventions and walks through the main flows. ## Authentication Send an API key as a bearer token: ```bash curl https://api.keybeat.dev/v1/me \ -H "Authorization: Bearer $KEYBEAT_API_KEY" ``` API keys start with `kb_` and belong to one organization. Create them in the dashboard, or get one through `npx keybeat login`. A key is shown only once, so store it somewhere safe. Keys have full access to their organization except managing members and API keys, which need a logged in user in the dashboard. ## Requests and responses - Request and response bodies are JSON. Send `Content-Type: application/json` with a body. - Timestamps are ISO 8601 strings in UTC. - Ids are UUIDs. Endpoints that take a monitor `:id` also accept the monitor's slug. ## Errors Errors use a consistent shape with an HTTP status code: ```json { "error": { "code": "validation_error", "message": "interval_seconds must be one of 3600, 900, 300, 60", "details": {} } } ``` Use `code` in your logic. It is a stable `snake_case` string. `message` is meant for humans and may change. `details` carries extra structured information when there is any. | Status | When | |---|---| | 400 | The request is invalid. | | 401 | The API key is missing, revoked or invalid. | | 402 | The change needs a paid plan. See [Payment required](#payment-required). | | 403 | The key or user is not allowed to do this. | | 404 | The resource does not exist in your organization. | | 409 | The change conflicts with existing data, for example a duplicate slug. | | 429 | Rate limit or monthly cap reached. | | 5xx | Something went wrong on Keybeat's side. Retry with backoff. | ## Pagination List endpoints return a page of results and a cursor: ```json { "data": [ ... ], "next_cursor": "eyJpZCI6..." } ``` Pass `?limit=` to set the page size and `?cursor=` with the previous `next_cursor` to get the next page. When `next_cursor` is `null` there are no more results. ```bash curl "https://api.keybeat.dev/v1/monitors/checkout/runs?limit=50&cursor=eyJpZCI6..." \ -H "Authorization: Bearer $KEYBEAT_API_KEY" ``` ## Rate limits Each API key can make 120 requests per minute. Over the limit, the API returns HTTP 429. Wait and retry. ## Payment required Creating a monitor that needs a paid plan (any interval faster than 60 minutes, or a second monitor) on a free organization returns HTTP 402 with a Stripe Checkout URL. A human opens it to subscribe. After that, the same request succeeds. On a paid organization, changes that add add-ons succeed at once and update the subscription with proration. The response then includes a `billing_change` object. `items` is a list, because one change (for example moving a monitor from 15 minutes to 5 minutes) can touch two add-ons. `billing_change` is `null` when nothing changed. ```json { "billing_change": { "items": [ { "item": "monitor_5m", "quantity": 2, "previous_quantity": 1, "amount_delta_cents": 500 } ], "amount_delta_cents": 500, "interval": "month" } } ``` ## Main flows The examples use `$KEYBEAT_API_KEY` from your environment and `jq` to build JSON bodies. ### Check your identity, plan and limits ```bash curl https://api.keybeat.dev/v1/me -H "Authorization: Bearer $KEYBEAT_API_KEY" ``` ### Validate a script Static checks only: the script parses, contains a test and is within 100 KB. ```bash jq -n --rawfile script keybeat/login.spec.ts '{ script: $script }' | curl -X POST https://api.keybeat.dev/v1/monitors/validate \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d @- ``` ### Create or update a monitor `PUT /v1/monitors/:slug` is an idempotent upsert by slug. This is what `keybeat deploy` uses. ```bash jq -n --rawfile script keybeat/login.spec.ts \ '{ name: "Login works", script: $script, interval_seconds: 900, enabled: false }' | curl -X PUT https://api.keybeat.dev/v1/monitors/login \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d @- ``` `interval_seconds` is `3600`, `900`, `300` or `60`. `POST /v1/monitors` also creates a monitor and takes the `slug` in the body. You can include `env` with initial secrets, `alert_channel_ids` to send this monitor's alerts to specific channels (omit for all channels), and `on_status_page`. ### Set secrets and enable ```bash curl -X PUT https://api.keybeat.dev/v1/monitors/login/env \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "set": { "LOGIN_EMAIL": "monitor@example.com", "LOGIN_PASSWORD": "s3cret" } }' curl -X PATCH https://api.keybeat.dev/v1/monitors/login \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "enabled": true }' ``` `GET /v1/monitors/login/env` returns names only. ### Run a monitor now and wait for the result ```bash curl -X POST "https://api.keybeat.dev/v1/monitors/login/runs?wait=true" \ -H "Authorization: Bearer $KEYBEAT_API_KEY" ``` With `wait=true` the request blocks for up to 90 seconds and returns the finished run. Without it, it returns the run at once with status `starting`, and you can poll `GET /v1/runs/:id`. On-demand runs count towards your monthly cap and never alert. ### Read failures ```bash # Recent failed runs of a monitor curl "https://api.keybeat.dev/v1/monitors/login/runs?status=failed" \ -H "Authorization: Bearer $KEYBEAT_API_KEY" # Full detail: steps, error message, logs curl https://api.keybeat.dev/v1/runs/$RUN_ID -H "Authorization: Bearer $KEYBEAT_API_KEY" # Short-lived signed URLs for the trace and screenshot (failed runs only) curl https://api.keybeat.dev/v1/runs/$RUN_ID/artifacts -H "Authorization: Bearer $KEYBEAT_API_KEY" ``` A run includes `trigger` (`schedule`, `retry` or `manual`), `region`, `status`, `duration_ms`, `error_message` and a `steps` array: ```json { "steps": [ { "title": "checkout reaches payment > open product page", "duration_ms": 1830, "status": "passed", "error": null }, { "title": "checkout reaches payment > add to cart", "duration_ms": 5012, "status": "failed", "error": "Timed out 5000ms waiting for expect(locator).toHaveText(expected)" } ] } ``` The artifacts response is `{ "trace_url": "...", "screenshot_url": "..." }`. Download the trace promptly, because the URLs expire. ### Uptime and performance ```bash curl "https://api.keybeat.dev/v1/monitors/login/stats?days=30" -H "Authorization: Bearer $KEYBEAT_API_KEY" curl "https://api.keybeat.dev/v1/incidents?open=true" -H "Authorization: Bearer $KEYBEAT_API_KEY" ``` Stats include uptime percentage and p50 and p95 durations per day and per region. ### Pause, resume and delete ```bash curl -X POST https://api.keybeat.dev/v1/monitors/login/pause -H "Authorization: Bearer $KEYBEAT_API_KEY" curl -X POST https://api.keybeat.dev/v1/monitors/login/resume -H "Authorization: Bearer $KEYBEAT_API_KEY" curl -X DELETE https://api.keybeat.dev/v1/monitors/login -H "Authorization: Bearer $KEYBEAT_API_KEY" ``` ### Alert channels ```bash curl -X POST https://api.keybeat.dev/v1/alert-channels \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "webhook", "target": "https://example.com/hooks/keybeat" }' curl -X POST https://api.keybeat.dev/v1/alert-channels/$CHANNEL_ID/test -H "Authorization: Bearer $KEYBEAT_API_KEY" ``` ### Status page ```bash curl -X PUT https://api.keybeat.dev/v1/status-page \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "slug": "acme", "title": "Acme status", "enabled": true, "monitor_ids": ["", ""] }' ``` `monitor_ids` lists the monitors shown on the page, in order. See [Status pages](https://keybeat.dev/docs/status-pages). ### Billing ```bash curl https://api.keybeat.dev/v1/billing -H "Authorization: Bearer $KEYBEAT_API_KEY" # Start a subscription: returns { "url": "https://checkout.stripe.com/..." } for a human to open curl -X POST https://api.keybeat.dev/v1/billing/checkout \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "interval": "month" }' ``` `POST /v1/billing/portal` returns a Stripe Customer Portal URL. `POST /v1/billing/cancel` cancels at the end of the period and `POST /v1/billing/resume` undoes that. ## Endpoint overview | Area | Endpoints | |---|---| | Identity | `GET /v1/me`, `GET /v1/orgs`, `PATCH /v1/org`, `GET /v1/org/members` | | Allowlisting | `POST /v1/org/allowlist-token/rotate` | | Monitors | `GET /v1/monitors`, `POST /v1/monitors`, `GET`, `PATCH`, `DELETE /v1/monitors/:id`, `PUT /v1/monitors/:slug`, `POST /v1/monitors/:id/pause`, `POST /v1/monitors/:id/resume`, `POST /v1/monitors/validate` | | Secrets | `GET /v1/monitors/:id/env`, `PUT /v1/monitors/:id/env` | | Runs | `POST /v1/monitors/:id/runs`, `GET /v1/monitors/:id/runs`, `GET /v1/runs/:id`, `GET /v1/runs/:id/artifacts` | | Stats | `GET /v1/monitors/:id/stats`, `GET /v1/incidents` | | Alerts | `GET`, `POST /v1/alert-channels`, `PATCH`, `DELETE /v1/alert-channels/:id`, `POST /v1/alert-channels/:id/test` | | Status page | `GET`, `PUT /v1/status-page`, `GET /v1/public/status/:slug` (no auth) | | Billing | `GET /v1/billing`, `POST /v1/billing/checkout`, `POST /v1/billing/portal`, `POST /v1/billing/cancel`, `POST /v1/billing/resume` | See [openapi.json](https://api.keybeat.dev/openapi.json) for request and response schemas. --- Source: https://keybeat.dev/docs/mcp # MCP server Keybeat runs a remote [Model Context Protocol](https://modelcontextprotocol.io) server so AI agents can manage monitors and investigate failures directly. - URL: `https://mcp.keybeat.dev/mcp` - Transport: streamable HTTP - Auth: OAuth 2.1, approved once by a human in the browser ## Add it to Claude Code ```bash claude mcp add --transport http keybeat https://mcp.keybeat.dev/mcp ``` The first time Claude Code uses a Keybeat tool, it opens your browser at `app.keybeat.dev`. Log in, check the app name and where the access will be sent, pick the organization the agent should work in and approve. The approval gives full API access to that organization, including billing. Claude Code stores the OAuth token, and from then on the tools work without prompting. You can check the connection with `/mcp` inside Claude Code. The [Claude Code plugin](https://keybeat.dev/docs/claude-code) installs the server together with the Keybeat skill. To make the server available in every project rather than only the current one, add `--scope user`: ```bash claude mcp add --transport http --scope user keybeat https://mcp.keybeat.dev/mcp ``` ## Other MCP clients Any client that supports remote MCP servers over HTTP with OAuth can connect with the URL `https://mcp.keybeat.dev/mcp`. The server supports dynamic client registration and PKCE, so no client id needs to be configured. If your client cannot do OAuth, it can send an API key instead: ```text Authorization: Bearer kb_... ``` For example, in Claude Code: ```bash claude mcp add --transport http keybeat https://mcp.keybeat.dev/mcp \ --header "Authorization: Bearer $KEYBEAT_API_KEY" ``` ## Tools The tools are thin wrappers over the [REST API](https://keybeat.dev/docs/api), so they follow the same rules, limits and billing behavior. | Tool | What it does | |---|---| | `whoami` | The current identity, organization, plan, limits and usage. | | `list_monitors` | All monitors with state and last run summary. | | `get_monitor` | One monitor by id or slug. | | `upsert_monitor` | Create or update a monitor by slug, with name, script and interval. `enabled`, `alert_channel_ids` and `on_status_page` keep their current values when left out (new monitors start enabled). | | `delete_monitor` | Delete a monitor and its history. | | `pause_monitor` | Pause scheduled runs. | | `resume_monitor` | Resume a paused monitor. | | `set_monitor_env` | Set or unset encrypted environment variables on a monitor. | | `validate_script` | Static checks of a spec: parses, has a test, within size limit, imports only `@playwright/test`, `otpauth` and Node built-ins. | | `run_monitor` | Start an on-demand run of a saved monitor and wait for the result. | | `list_runs` | Run history for a monitor, optionally filtered by status. | | `get_run` | Full run detail: steps, error, logs and artifact URLs. | | `get_monitor_stats` | Uptime and p50 and p95 durations per day and per region. | | `list_incidents` | Incidents, optionally only open ones or for one monitor. | | `list_alert_channels` | The organization's alert channels. | | `create_alert_channel` | Add an email, webhook or SMS channel. | | `get_billing` | Plan, subscription items, next invoice estimate and limits. | | `get_status_page` | The organization's status page settings, or `not_found` when there is none yet. | | `update_status_page` | Change the status page slug, title, enabled flag and monitors. | ## Things to ask your agent - "Which Keybeat monitors are down right now?" - "Why did the checkout monitor fail last night? Show me the failing step." - "Is login getting slower in Asia?" - "Add the signup and checkout monitors to our status page." - "Pause the staging monitors until Monday." ## Limits worth knowing - `run_monitor` only runs saved monitors and counts towards the monthly on-demand cap. Test new specs locally with `npx keybeat test`, which the MCP server cannot do. - `upsert_monitor` can add paid add-ons. On a subscribed organization this changes the bill at once. On the free plan it returns a checkout URL for a human. See [Billing](https://keybeat.dev/docs/billing). - Secrets can be written with `set_monitor_env` but never read back. --- Source: https://keybeat.dev/docs/claude-code # Claude Code plugin The Keybeat plugin for Claude Code bundles two things: - **The `keybeat` skill.** Instructions that Claude loads when you ask it to monitor a flow, change a monitor or find out why one failed: how to write a spec that works on Keybeat, test it with `npx keybeat test`, store secrets, deploy, and read failed runs. - **The Keybeat MCP server** at `https://mcp.keybeat.dev/mcp`, so Claude can list monitors, read runs and incidents and start runs from any project. See [MCP server](https://keybeat.dev/docs/mcp). ## Install the plugin Add the Keybeat marketplace once, then install the plugin. Inside Claude Code: ```text /plugin marketplace add releaseworks/keybeat /plugin install keybeat@keybeat ``` Or from a terminal: ```bash claude plugin marketplace add releaseworks/keybeat claude plugin install keybeat@keybeat ``` The first time Claude uses a Keybeat tool it opens your browser at `app.keybeat.dev`. Log in, check which app the access is for, pick an organization and approve. Restart Claude Code after installing so it loads the skill and the server. ## Only the skill If you do not want the MCP server, copy the skill folder into your project (or into `~/.claude/skills/` for every project): ```bash git clone --depth 1 https://github.com/releaseworks/keybeat /tmp/keybeat mkdir -p .claude/skills cp -R /tmp/keybeat/skills/keybeat .claude/skills/keybeat rm -rf .claude/skills/keybeat/.claude-plugin .claude/skills/keybeat/.mcp.json ``` The skill uses the `keybeat` CLI through `npx`, so nothing else needs to be installed. ## Only the MCP server ```bash claude mcp add --transport http keybeat https://mcp.keybeat.dev/mcp ``` Add `--scope user` to make it available in every project. ## What to ask - "Monitor our checkout flow with Keybeat." - "Why did the login monitor fail last night?" - "Move the signup monitor to a 5 minute interval and tell me what it costs." Claude asks before anything that changes your bill or deletes monitors, and never approves access or pays on your behalf. See [Quickstart for agents](https://keybeat.dev/docs/agents) for the workflow it follows. --- Source: https://keybeat.dev/docs/alerts # Alerts Keybeat is built to wake you up only when something is really broken. A single failed run is never enough: the failure must be confirmed from a second region first. ## The alert rule 1. A **scheduled** run fails. 2. Keybeat immediately starts a **retry** run from a different region. Nothing changes yet and nobody is notified. 3. If the retry **passes**, it was a blip. The monitor stays up and you are not alerted. 4. If the retry **fails** too, the monitor becomes `down`, an incident opens and a **down** alert goes to the monitor's channels. 5. The next run that **passes** marks the monitor `up`, resolves the incident and sends a **recovered** alert with the downtime duration. You get exactly one "down" alert and one "recovered" alert per incident. Keybeat does not send reminders while a monitor stays down. Some runs never change state or alert: - **On-demand runs** (`keybeat run`, the dashboard's run button, `run_monitor`) are for checking things yourself. They never alert. - **Runs with status `error`** mean trouble on Keybeat's side, such as a machine that failed to start. They are not your site's fault, so they never count as failures. A scheduled run that ends in `error` is retried once. A run that hits the 60 second limit counts as `failed`. ## Channels Each organization has a list of alert channels. New organizations start with an email channel for the owner. By default a monitor alerts every enabled channel in the organization. You can limit a monitor to specific channels with its `alert_channel_ids`. | Channel | Sends | Notes | |---|---|---| | Email | down, recovered, slow, slow recovered | Plain email with the monitor name, failing step, error, region and a link to the run. | | Webhook | down, recovered, slow, slow recovered | JSON POST signed with HMAC-SHA256. Retried 3 times on failure. | | SMS | down, recovered | Short text message. 20 per month on the base plan. On the free plan you can add an SMS channel, but its messages are skipped until you subscribe. When the cap is reached further messages are skipped. Messages come from the sender name "Keybeat". US and Canadian (+1) numbers are not supported yet. | Add channels in the dashboard, with `keybeat channels add`, with `POST /v1/alert-channels` or with the `create_alert_channel` MCP tool. Send a test notification with `keybeat channels test ` or `POST /v1/alert-channels/:id/test`. ## Webhooks Keybeat sends a `POST` request with a JSON body and these headers: ```http Content-Type: application/json X-Keybeat-Signature: sha256= ``` The body has five top level fields: `event`, `monitor`, `incident`, `run` and `org`. `event` is one of `down`, `recovered`, `slow` or `slow_recovered`. An example: ```json { "event": "down", "monitor": { "id": "7d3f0c2a-...", "slug": "checkout", "name": "Checkout reaches payment" }, "incident": { "id": "c1a9e4b0-...", "kind": "down", "opened_at": "2026-12-05T03:14:07Z", "resolved_at": null }, "run": { "id": "0b6c2d9e-...", "trigger": "retry", "region": "sin", "status": "failed", "error_message": "Timed out 5000ms waiting for expect(locator).toHaveText(expected)" }, "org": { "id": "5e2b7a11-...", "name": "Acme" } } ``` Field names inside the nested objects follow the API's monitor, incident and run resources. Treat unknown fields as optional, because new fields may be added. ### Verifying the signature Each webhook channel has its own secret, shown when you create the channel. Always verify the signature against the **raw** request body before trusting a webhook. ```ts title="Node.js" import { createHmac, timingSafeEqual } from 'node:crypto'; export function verifyKeybeatSignature(rawBody: string, header: string | null, secret: string): boolean { if (!header?.startsWith('sha256=')) return false; const expected = createHmac('sha256', secret).update(rawBody).digest('hex'); const received = header.slice('sha256='.length); if (received.length !== expected.length) return false; return timingSafeEqual(Buffer.from(received), Buffer.from(expected)); } // Example with a Fetch API style handler (Cloudflare Workers, Hono, Next.js route handlers) export async function handle(request: Request): Promise { const raw = await request.text(); if (!verifyKeybeatSignature(raw, request.headers.get('X-Keybeat-Signature'), process.env.KEYBEAT_WEBHOOK_SECRET!)) { return new Response('invalid signature', { status: 401 }); } const payload = JSON.parse(raw); console.log(`Keybeat: ${payload.monitor.name} is ${payload.event}`); return new Response('ok'); } ``` ```bash title="Shell" # Compute the expected signature of a saved body printf '%s' "$(cat body.json)" | openssl dgst -sha256 -hmac "$KEYBEAT_WEBHOOK_SECRET" | sed 's/^.* /sha256=/' ``` Respond with a 2xx status quickly. Keybeat makes up to 3 delivery attempts in total, so make your handler safe to call more than once for the same event. ## Slowness detection Keybeat also tells you when a flow gets slow, without you choosing a threshold. In plain terms: Keybeat learns how long each monitor normally takes in each region, and alerts when it is clearly slower than normal three runs in a row. The details: - **Baseline.** For each monitor and region, Keybeat takes the passed scheduled and retry runs from the last 7 days. It needs at least 20 of them, so new monitors have no slowness alerts for their first few days. - **Threshold.** The median duration, plus the larger of five times the median absolute deviation (a robust measure of normal variation) or half the median. A monitor that normally takes 4 seconds with little variation is considered slow above about 6 seconds. - **Slow.** After **3 consecutive** runs over the threshold, the monitor's `perf_state` becomes `slow`, a slow incident opens and a **slow** alert is sent. - **Recovered.** The first run at or under the threshold sets `perf_state` back to `normal`, resolves the incident and sends **slow recovered**. Only passed runs count. Failed runs are handled by the alert rule above. Each region has its own baseline, because a site hosted in Europe is naturally slower from Asia. The duration measured is the Playwright test duration, not machine start up time. SMS is never used for slowness alerts. --- Source: https://keybeat.dev/docs/status-pages # Status pages Each organization can publish one public status page at: ```text https://status.keybeat.dev/ ``` It shows an overall status banner and, for each monitor you choose, its current state and a 30 day bar of daily uptime with a percentage. The page refreshes itself every 60 seconds. ## What is public The page shows only: - the page title - the name of each monitor you add - each monitor's current state (up, down or unknown) and whether it is currently slow - daily uptime for the last 30 days It never shows scripts, URLs, steps, errors, logs, screenshots, regions or anything else from your runs. Monitor names are public, so name monitors accordingly. ## Setting it up Configure the page in the dashboard, or with the API: ```bash curl -X PUT https://api.keybeat.dev/v1/status-page \ -H "Authorization: Bearer $KEYBEAT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "slug": "acme", "title": "Acme status", "enabled": true, "monitor_ids": ["", ""] }' ``` | Field | Description | |---|---| | `slug` | The page's address, `status.keybeat.dev/`. Globally unique across Keybeat. | | `title` | Shown at the top of the page and in the browser tab. | | `enabled` | When `false`, the page returns "not found". | | `monitor_ids` | The monitors to show. | Agents can do the same with the `get_status_page` and `update_status_page` MCP tools. ## How the overall status is decided | Banner | When | |---|---| | All systems operational | Every monitor with a result is up and none are slow. | | Degraded performance | No monitor is down, but at least one is slow. | | Partial outage | At least one monitor is down. | | Status unknown | No monitor has a result yet. | ## How uptime is calculated Each day's uptime is the share of that day's runs that passed. Days without runs show as "no data" and do not count. The 30 day percentage covers all runs in the period. Runs with status `error` (Keybeat infrastructure problems) are not counted against you. ## Public JSON The data behind the page is available without authentication: ```bash curl https://api.keybeat.dev/v1/public/status/acme ``` Use it to show your status inside your own app or docs. --- Source: https://keybeat.dev/docs/billing # Billing and limits Keybeat has a free plan and one paid plan with per monitor add-ons. All prices are in US dollars. Tax (such as VAT) is added at checkout where it applies. ## Plans | | Free | Base plan | |---|---|---| | Price | $0 | $5 per month, or $50 per year | | Monitors included | 1 | 3 | | Fastest interval included | 60 minutes | 15 minutes | | Run and artifact retention | 7 days | 30 days | | On-demand runs per month | 10 | 100 | | SMS alerts per month | None | 20 | | Email and webhook alerts | Yes | Yes | | Status page | Yes | Yes | | Daily uptime history | 1 year | 1 year | ## Add-ons Add-ons need the base plan. | Add-on | Monthly | Annual | |---|---|---| | Extra monitor at 15 minutes, beyond the 3 included | $2 | $20 | | Monitor at 5 minutes | $5 | $50 | | Monitor at 1 minute | $19 | $190 | Annual prices are ten times the monthly price, so paying yearly gives you two months free. ## How monitors map to charges - The 3 included slots cover monitors at a 15 minute interval or slower. - A 60 minute monitor on a paid plan uses a 15 minute slot and bills as a 15 minute monitor. - 5 minute and 1 minute monitors are always add-ons. They never use an included slot. - Paused monitors still occupy their slot and are still billed. Delete a monitor to stop paying for it. Examples, monthly: | Monitors | Charges | Total | |---|---|---| | 1 at 60 minutes | Free plan | $0 | | 3 at 15 minutes | Base | $5 | | 5 at 15 minutes | Base + 2 extra 15 minute | $9 | | 3 at 15 minutes, 1 at 5 minutes | Base + 1 five minute | $10 | | 2 at 15 minutes, 2 at 1 minute | Base + 2 one minute | $43 | Try your own numbers with the calculator on the [pricing page](https://keybeat.dev/pricing). ## How charges change Your subscription has up to four items: the base plan and one item each for 15 minute, 5 minute and 1 minute add-ons. Add-on quantities are worked out from your monitors and updated in Stripe, with proration, whenever you create or delete a monitor or change its interval. You do not manage quantities yourself. On a paid organization, an API call that adds an add-on succeeds at once and its response includes a `billing_change` with one entry per add-on that changed (the list can have two entries, for example when a monitor moves from one interval to another), the net change and the billing interval: ```json { "billing_change": { "items": [ { "item": "monitor_1m", "quantity": 1, "previous_quantity": 0, "amount_delta_cents": 1900 } ], "amount_delta_cents": 1900, "interval": "month" } } ``` ### A note for agents and API keys Once an organization has a subscription, any API key for it can add paid monitors without further confirmation. This is deliberate: it lets your agent do the work. If you want a human to approve every cost change, tell your agent so in its instructions, and keep an eye on `GET /v1/billing` or the dashboard. ## Upgrading On the free plan, creating a monitor that needs a paid plan returns HTTP 402 with a `checkout_url`. Open it to subscribe with Stripe Checkout, monthly or annual. You can also start from the dashboard, or with `POST /v1/billing/checkout` and `{ "interval": "month" }` or `{ "interval": "year" }`. Checkout and the customer portal (invoices, payment methods, billing details) are hosted by Stripe. Get a portal link from the dashboard or `POST /v1/billing/portal`. ## Payment failures If a payment fails, your organization becomes `past_due` and you have a 48 hour grace period during which monitors keep running. If payment still has not succeeded after that, all monitors are paused with the reason `billing`. Paying the outstanding invoice restores them. ## Cancelling Cancel from the dashboard or with `POST /v1/billing/cancel`. Your plan stays active until the end of the current billing period. Then the organization moves to the free plan: your oldest monitor is kept and moves to a 60 minute interval, and every other monitor is paused with the reason `billing`. You can undo a pending cancellation with `POST /v1/billing/resume`. ## Usage limits | Limit | Free | Base plan | |---|---|---| | On-demand runs | 10 per month | 100 per month | | SMS alerts | None | 20 per month, then skipped | | Run time | 60 seconds per run | 60 seconds per run | | Requests per run | 2,000 | 2,000 | | Data per run | 300 MB | 300 MB | | Script size | 100 KB | 100 KB | | API rate limit | 120 requests per minute per key | 120 requests per minute per key | Check current usage with `npx keybeat whoami`, `GET /v1/me` or `GET /v1/billing`. ## Seller Keybeat is sold by Releaseworks Ltd, company number 11706057, 20-22 Wenlock Road, London N1 7GU, United Kingdom. VAT number GB311241073. Billing questions: [contact@release.works](mailto:contact@release.works). --- Source: https://keybeat.dev/docs/regions # Regions Keybeat runs monitors from three regions: | Code | Location | |---|---| | `iad` | US East (Ashburn, Virginia) | | `fra` | EU West (Frankfurt) | | `sin` | Asia (Singapore) | ## How a region is chosen - Each **scheduled** run picks one of the three regions at random. Over a day, every monitor is checked from all of them. - When a scheduled run fails, the **retry** runs at once in a **different** region. This filters out problems that only affect one network path, and confirms real outages before anyone is alerted. See [Alerts](https://keybeat.dev/docs/alerts). - The region of every run is recorded, and shown in run details, alerts and stats. You cannot pin a monitor to a region in v1. ## Performance per region Page load times differ by region, mostly because of the distance to your servers. Keybeat accounts for this: - Slowness baselines are calculated per monitor **and per region**, so a site hosted in Europe is not flagged as slow just because Singapore is further away. - `GET /v1/monitors/:id/stats` and the `get_monitor_stats` MCP tool return p50 and p95 durations per region as well as per day. ## IP addresses and allowlisting Runs execute on short-lived machines without fixed IP addresses, and Keybeat does not publish an IP range in v1. To recognise or allowlist Keybeat traffic, use the `X-Keybeat-Token` header that every monitor request carries, or the `Keybeat/1.0` user agent suffix. See [Writing monitors](https://keybeat.dev/docs/writing-monitors#identifying-and-allowlisting-keybeat-traffic). ## Data location Run data is stored in the EU (Supabase on AWS eu-west-1, Ireland) regardless of which region a run executes in. Traces and screenshots are stored in Cloudflare R2. See the [privacy notice](https://keybeat.dev/privacy).