---
title: "Alert webhooks"
description: "The JSON Betwatch posts to your webhook when an alert fires, and how to verify it."
---

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

# Alert webhooks

When an alert fires, Betwatch can `POST` it to an HTTPS endpoint you own. Set the endpoint under [Account → Alerts](https://beta.betwatch.com/account/alerts) → **Webhook**; saving it generates a signing secret.

## Request

```http
POST /your-endpoint HTTP/1.1
Content-Type: application/json
X-Betwatch-Alert-Type: price-alert
X-Betwatch-Signature: sha256=<64 hex characters>
```

```json
{
  "version": 2,
  "id": "673ad1f9c2a1b2c3d4e5f601",
  "alertId": "6735f0c2a1b2c3d4e5f60799",
  "kind": "price",
  "type": "price-alert",
  "firedAt": "2026-11-18T04:12:33.512Z",
  "title": "Flemington R4 — Fast Horse $4.20",
  "body": "TAB Tote Win VIC $4.20 (≥ $4.00)",
  "url": "https://beta.betwatch.com/odds/racing/6735f0c2a1b2c3d4e5f60718",
  "race": {
    "id": "6735f0c2a1b2c3d4e5f60718",
    "label": "Flemington R4",
    "name": "Lexus Hotham Stakes",
    "class": "Group 3",
    "venue": "Flemington",
    "venueId": "64a1f0c2a1b2c3d4e5f60001",
    "state": "VIC",
    "country": "AUS",
    "number": 4,
    "startTime": "2026-11-18T04:40:00Z",
    "discipline": "thoroughbred",
    "distance": 2500,
    "status": "open",
    "trackCondition": "Good 4",
    "railPosition": "+3m",
    "weather": "Fine",
    "runnerCount": 12
  },
  "runner": {
    "id": "6735f0c2a1b2c3d4e5f60720",
    "name": "Fast Horse",
    "number": 7,
    "barrier": 3,
    "weight": 56.5,
    "form": "x312",
    "gear": "Ear muffs (pre-race only)",
    "blinkers": true,
    "rider": { "id": "64b2f0c2a1b2c3d4e5f60002", "name": "J Rider" },
    "trainer": { "id": "64b3f0c2a1b2c3d4e5f60003", "name": "C Trainer" }
  },
  "price": {
    "bookmaker": "tab",
    "bookmakerName": "TAB",
    "type": "parimutuel-win",
    "jurisdiction": "VIC",
    "direction": "above",
    "threshold": 4,
    "value": 4.2
  }
}
```

Every payload has the top-level fields. Betwatch reads the race, venue, runner, and its connections when it sends the webhook, so they reflect the latest data at that moment, such as the track condition or the result. The groups below them (`race`, `runner`, `entity`, `price`, `change`, `insight`) appear only when the alert has that data, and a field inside a group is omitted when it is unknown. Read the structured fields; `title` and `body` are display text and their wording may change.

### Top level

| Field | Type | Meaning |
| --- | --- | --- |
| `version` | number | Payload schema version. Currently `2`. |
| `id` | string | Unique id of this fire. Use it to ignore a delivery you have already handled. |
| `alertId` | string | The alert that fired. Several fires can share one alert, such as a blackbook alert across races. |
| `kind` | string | `price`, `event` (a race alert), or `entity` (a [blackbook](/docs/product/blackbook) alert). |
| `type` | string | The trigger; see [Alert types](#alert-types). Also sent as `X-Betwatch-Alert-Type`. |
| `firedAt` | string | RFC 3339 UTC time the alert fired. |
| `title` | string | Headline, as other channels show it. |
| `body` | string | Detail line, as other channels show it. |
| `url` | string | The race on Betwatch. Present with `race`. |

### Groups

| Group | Field | Type | Meaning |
| --- | --- | --- | --- |
| `race` | `id` | string | Betwatch race id. |
| | `label` | string | Display name, such as `Flemington R4`. |
| | `name` | string | The race's published title. |
| | `class` | string | Class label, such as `BM78` or `Group 1`. |
| | `venue` | string | Venue name. |
| | `venueId` | string | Betwatch venue id. |
| | `state` | string | Venue state, such as `VIC`. |
| | `country` | string | Venue country. |
| | `number` | number | Race number at the meeting. |
| | `startTime` | string | Advertised start, RFC 3339 UTC. |
| | `discipline` | string | `thoroughbred`, `greyhound`, or `harness`. |
| | `distance` | number | Race distance in metres. |
| | `status` | string | `scheduled`, `open`, `in_progress`, `closed`, `interim`, `final`, `abandoned`, `cancelled`, `postponed`, or `unknown`. |
| | `trackCondition` | string | Track rating, such as `Good 4` or `Soft 6`. |
| | `railPosition` | string | Rail position, such as `+3m`. |
| | `weather` | string | `Fine`, `Overcast`, `Showers`, `Rain`, `Windy`, `Fog`, `Storm`, `Snow`, or `Hot`. |
| | `runnerCount` | number | Runners still in the race. |
| | `results` | number[][] | Once placed: runner numbers by place, first place first. A place holds several numbers on a dead heat, and an empty place follows a multi-runner dead heat. |
| `runner` | `id` | string | Betwatch selection (runner) id. |
| | `name` | string | Runner name. |
| | `number` | number | Saddlecloth or box number. |
| | `barrier` | number | Barrier draw. |
| | `weight` | number | Carried weight in kilograms. |
| | `position` | number | Finishing place once the race has results; omitted when unplaced. |
| | `scratched` | boolean | `true` when scratched. |
| | `emergency` | boolean | `true` when an emergency acceptor. |
| | `form` | string | Recent form, oldest to newest: `1`–`9` placing, `0` unplaced, `x` spell, `f` fell, `l` lost rider, `p` pulled up, `r` retired, `u` unseated, `q` disqualified. |
| | `gear` | string | Gear as published. |
| | `blinkers` | boolean | Whether the runner wears blinkers, when known. |
| | `rider` | object | `{ "id", "name" }` of the jockey or driver. |
| | `trainer` | object | `{ "id", "name" }` of the trainer. |
| `entity` | `kind` | string | What the blackbook alert follows: `selection`, `trainer`, `rider`, `owner`, or `venue`. |
| | `id` | string | Id of that entity. |
| | `name` | string | Its name. |
| `price` | `bookmaker` | string | Source id, such as `sportsbet`, `tab`, or `betfair`. |
| | `bookmakerName` | string | Source display name. |
| | `type` | string | Price alerts: `fixed-win`, `fixed-place`, `parimutuel-win`, `parimutuel-place`, `betfair-back`, `betfair-lay`, or `betfair-ltp`. |
| | `jurisdiction` | string | Tote pool, such as `VIC`, for `parimutuel-*` types. |
| | `direction` | string | Price alerts: `above` or `below`. |
| | `threshold` | number | Price alerts: the price you set. |
| | `value` | number | The price when the alert fired. |
| `change` | `field` | string | Race-day changes: `riderId`, `gear`, `blinkers`, `weight`, `riderClaimKg`, `riderAdjustmentKg`, `ownerIds`, or `scratched`. |
| | `previous` | string | The previous value, formatted for display. |
| | `value` | string | The new value, formatted for display. |
| `insight` | `id` | string | Betwatch analysis insight id. |
| | `rule` | string | The analysis rule that matched. |
| | `state` | string | `discovery` when the insight is published, `activation` when its setup applies in a race. |

Opening-price alerts send `runner` and `price` (`bookmaker`, `bookmakerName`, `value`) for the first favourite. New fields and groups may be added within version 2, so ignore ones you do not recognise. A change that removes or reshapes a field gets a new `version`.

> **Note**
>
> Version 1 sent only `title`, `body`, and flat ids (`eventId`, `selectionId`, `entityKind`, `entityId`). In version 2 those ids are `race.id`, `runner.id`, `entity.kind`, and `entity.id`.

## Alert types

`type` is the alert family, then the specific trigger:

| `type` | Fires when |
| --- | --- |
| `price-alert` | A [price alert](/docs/product/alerts#price-alerts) crosses its threshold |
| `event-alert.ttj` | A race enters your time-to-jump window |
| `event-alert.scratch` | A runner is scratched from a race you follow |
| `event-alert.results` | Results are posted |
| `event-alert.go-behind` | The race is running late |
| `event-alert.closed` | Betting closes on the race |
| `event-alert.opening-prices` | The first fixed-win price is up |
| `entity-alert.runner-entered` | A [blackbook](/docs/product/blackbook) runner, or a trainer's, rider's, or owner's runner, is entered |
| `entity-alert.scratched` | A blackbook runner is scratched |
| `entity-alert.resulted` | A blackbook runner's race is resulted |
| `entity-alert.opening-prices` | The first fixed-win price is up at a blackbook venue |
| `entity-alert.race-day-change` | Rider, gear, weight, claim, or scratch state changes on a blackbook runner |
| `entity-alert.dual-acceptance` | A blackbook runner is accepted into two races on the same day |
| `entity-alert.betwatch-analysis` | Betwatch analysis flags a blackbook runner |

New types may be added; handle unknown values gracefully.

## Verify the signature

`X-Betwatch-Signature` is `sha256=` followed by the hex HMAC-SHA256 of the raw request body, keyed by your signing secret. Compute it over the bytes you received, before parsing the JSON, and compare in constant time.

```ts
import { createHmac, timingSafeEqual } from 'node:crypto';

export function isFromBetwatch(rawBody: Buffer, header: string | undefined, secret: string): boolean {
  const expected = 'sha256=' + createHmac('sha256', secret).update(rawBody).digest('hex');
  return header !== undefined && header.length === expected.length &&
    timingSafeEqual(Buffer.from(header), Buffer.from(expected));
}
```

```python
import hashlib, hmac

def is_from_betwatch(raw_body: bytes, header: str | None, secret: str) -> bool:
    expected = "sha256=" + hmac.new(secret.encode(), raw_body, hashlib.sha256).hexdigest()
    return header is not None and hmac.compare_digest(header, expected)
```

## Delivery

- The endpoint must be `https://` on a public host. URLs with embedded credentials, private or reserved IP addresses, and hosts that resolve to them are refused.
- Redirects are not followed. Respond from the URL you saved.
- Any `2xx` response counts as delivered. Respond within 10 seconds; do slow work after you reply.
- Each fire is sent once. A failed delivery (timeout, network error, or non-`2xx` status) is not retried.
- Muted races are not delivered to any channel, webhooks included.

## Related

- [Alerts](/docs/product/alerts) — what each alert watches
- [Blackbook](/docs/product/blackbook) — entity alerts on runners, people, and venues
- [Manage alerts and delivery](https://beta.betwatch.com/account/alerts)

Source: https://beta.betwatch.com/docs/product/alert-webhooks/index.mdx
