# Get webhooks when a Computer changes

> Receive a signed HTTPS request when a Team Computer is created, starts, stops, fails to start or is deleted. Verify it with a Standard Webhooks library.

A Team **webhook** sends your server a signed HTTPS `POST` when one of the
Team's Computers is created, starts, stops, fails to start or is deleted. Team
owners and admins manage them under **Webhooks** in the Team's Developer menu,
or through the Team API with a key that holds `webhooks.manage`.

## Add an endpoint

1. Open **Webhooks** and choose **Add endpoint**.
2. Enter an `https://` URL, with no username or password, and pick the events
   you want. A Team holds up to 10 endpoints.
3. Copy the signing secret. It starts with `whsec_`, is shown once and cannot be
   read again. Choose **Rotate** for a new one.

Choose **Test** on an endpoint to send one `webhook.test` event now and see the
result in words.

## The event

```json
{
  "id": "evt_…",
  "type": "computer.started",
  "timestamp": "2026-11-22T12:00:00.000Z",
  "teamId": "team_…",
  "schemaVersion": 1,
  "data": {
    "computerId": "…",
    "name": "build-box",
    "previousState": "sleeping",
    "state": "running",
    "reason": null
  }
}
```

The types are `computer.created`, `computer.started`, `computer.stopped`,
`computer.start_failed` and `computer.deleted`. `reason` says why a start
failed. An event never carries command output, environment variables or secrets.

## Verify it

Every request follows the [Standard Webhooks](https://www.standardwebhooks.com/)
specification: `webhook-id`, `webhook-timestamp` and `webhook-signature`. Use
the library for your language rather than writing the check yourself.

```ts
import { Webhook } from "standardwebhooks";

const webhook = new Webhook(process.env.BOTANICAL_WEBHOOK_SECRET);
// Throws if the signature is wrong or the timestamp is more than 5 minutes old.
const event = webhook.verify(rawBody, {
  "webhook-id": request.headers["webhook-id"],
  "webhook-timestamp": request.headers["webhook-timestamp"],
  "webhook-signature": request.headers["webhook-signature"],
});
```

Delivery is **at least once** with no ordering promise. The same event keeps the
same `webhook-id` on every attempt, so ignore an id you have already handled.

## Delivery and retries

Any `2xx` answer means delivered. Anything else, or no answer within 10 seconds,
is retried up to 8 more times, starting at 30 seconds and doubling, for at most
24 hours. Botanical never follows a redirect and only connects to public
addresses. The delivery log keeps each attempt for 7 days and says why a
delivery did not arrive, for example that the address is private, the host name
could not be looked up, or the receiver answered with an error. Choose **Send
again** to retry a failed delivery.

## Rotate a secret

**Rotate** signs with both the new and the previous secret for 24 hours, so you
can switch over without dropping events. If a secret may have leaked, rotate
with the previous one retired at once through the API (`"retireOld": true`).
