> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ancha.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs describe the Ancha CLI, npm package @ancha-labs/cli version 0.1.4, and the hosted workspace at app.ancha.io. Coding agents should start at https://docs.ancha.io/coding-agents. Run the CLI as `ancha` after `npm install -g @ancha-labs/cli`, or as `npx -y @ancha-labs/cli@0.1.4` without installing. Pass --json for machine-readable output, or set ANCHA_JSON=1. Every command ends with a `next:` line naming the next command. Exit codes: 0 pass, 1 a check failed or a comparison regressed, 2 usage, config or authentication error, 3 infrastructure error, 4 unimplemented endpoint with --strict.

# Better Stack

> A stateful replica of Better Stack's Uptime API: monitors, heartbeats, incidents, on-call and status pages, where nothing is probed.

The Better Stack replica implements 29 endpoints of the Uptime API, versions v2 and v3. Nothing is probed: a monitor is down while it has an open incident, and a heartbeat recovers when it is pinged. Its key is `better-stack`. Better Stack publishes no official SDK, so the replica was tested over HTTP against the documented shapes.

## Connect

| Variable | Value |
| - | - |
| `BETTER_STACK_API_URL` | Base URL, standing in for `https://uptime.betterstack.com`. Paths start with `/api/v2/`, `/api/v3/` and `/api/v1/heartbeat/`. |
| `BETTER_STACK_API_TOKEN` | Fake team API token. Send `Authorization: Bearer <token>`. |

```js Node theme={null}
const response = await fetch(process.env.BETTER_STACK_API_URL + '/api/v2/monitors', { headers: { Authorization: 'Bearer ' + process.env.BETTER_STACK_API_TOKEN } });
const monitors = await response.json();
```

This is what `ancha connect better-stack --lang ts` prints.

## Endpoints

All 29 endpoints are partial. Anything else returns HTTP 501 with `x-ancha-gap: 1`.

| Method | Path | Notes |
| - | - | - |
| `GET`, `POST` | `/api/v2/monitors` | `url` and `pronounceable_name` filters; `page` and `per_page`. Creates `status`, `keyword`, `ping`, `tcp` and other HTTP-level types; nothing is probed. |
| `GET`, `PATCH`, `DELETE` | `/api/v2/monitors/{id}` | Rename, retarget, change frequency or keyword, pause and resume. |
| `GET` | `/api/v2/monitors/{id}/response-times` | Hourly per region for the last day, slow while an incident was open. |
| `GET` | `/api/v2/monitors/{id}/sla` | Availability from the monitor's incidents. |
| `GET`, `POST` | `/api/v2/heartbeats` | |
| `GET`, `PATCH`, `DELETE` | `/api/v2/heartbeats/{id}` | |
| `GET`, `POST` | `/api/v1/heartbeat/{token}` | The public ping URL. A ping resolves the heartbeat's open incident. |
| `GET`, `POST` | `/api/v3/incidents` | `from`, `to`, `monitor_id`, `heartbeat_id`, `resolved` and `acknowledged` filters. Manual incidents; nobody is paged. |
| `GET`, `DELETE` | `/api/v3/incidents/{id}` | |
| `POST` | `/api/v3/incidents/{id}/acknowledge`, `/api/v3/incidents/{id}/resolve` | |
| `GET` | `/api/v2/on-calls` | Who is on call now, with users included. |
| `GET` | `/api/v2/on-calls/{id}` | An ID, or `default`. |
| `GET` | `/api/v2/status-pages`, `/api/v2/status-pages/{id}`, `/api/v2/status-pages/{id}/resources` | |
| `GET`, `POST` | `/api/v2/status-pages/{id}/status-reports` | Manual and maintenance reports with their first update. Subscribers are not notified. |
| `GET` | `/api/v2/status-pages/{id}/status-reports/{report_id}` | |
| `POST` | `/api/v2/status-pages/{id}/status-reports/{report_id}/status-updates` | A report ends when an update resolves every affected resource. |

## Starter data

The `better-stack-starter` dataset is the team **Acme**, 20 minutes after an Orders API incident was resolved and with a warehouse sync heartbeat that missed its check-in.

| Record | Detail |
| - | - |
| Monitors | "Orders API" (every 30 s), "Acme dashboard", "Checkout", "Payment webhooks" (a keyword monitor), "Status page" and a paused "Staging dashboard", in the groups Production, Public and Staging. |
| Heartbeats | "Warehouse sync: Ridgeway Robotics" (every 15 minutes, 5 minutes grace; last ping 38 minutes ago) and "Nightly database backup" (daily). |
| Incidents | Resolved: Checkout 502s two days ago (Greg Wilson), an Orders API timeout 3 hours ago and Orders API 504s 35 minutes ago (both Rachel Moore). Open: the missed warehouse sync heartbeat, 20 minutes ago. |
| On-call | "Orders on-call" (default): Rachel Moore. "Platform on-call": Greg Wilson and Victor Lane. |
| Status page | "Acme" at `status.acme.example`, with the resources Dashboard, Orders API, Checkout and Warehouse sync, and one resolved report, "Slow order processing". |

Users: Rachel Moore, Greg Wilson, Victor Lane and Ben Carter.

## Checks

Better Stack has no state checks. Use trace checks, for example `{ called: "POST /api/v3/incidents/*/acknowledge" }`.

## Limits

* Nothing is probed: a monitor is down while it has an open incident, and heartbeats recover when pinged.
* No escalation policies, paging, telemetry or status page subscribers.
* No official SDK exists; tested against the documented REST shapes.


## Related topics

- [Tools](https://docs.ancha.io/tools/overview.md)
- [Test file (scene.yaml)](https://docs.ancha.io/reference/test-file.md)
- [Introduction](https://docs.ancha.io/index.md)
- [Environment variables](https://docs.ancha.io/reference/environment-variables.md)
- [ancha connect](https://docs.ancha.io/cli/connect.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.