# Webhooks · 6 signed event types · MMA Fight Data API

> Get a signed POST when a card changes, a result is posted, an event completes or a line moves. Event types, payloads, signature verification and retries.

Canonical: https://mmadataapi.com/webhooks

Stop polling. Register a URL and we POST when something changes, signed so you know it came from us.

Webhooks are on Pro and Business. You can register up to 3 endpoints, each with its own secret, via `POST /v1/webhook-endpoints`.

## Event types

| Event | Sent when |
| --- | --- |
| `event.announced` | A new event appears for a promotion you follow. |
| `card.changed` | A bout is added, cancelled or reinstated, an opponent changes, or the start time or venue moves. |
| `fight.result` | A result is posted. Sent again, as a new revision, if the official result is later corrected. |
| `event.completed` | Every bout on the card is settled. |
| `odds.moved` | The consensus line on an upcoming bout moves past the threshold. Information only, not betting advice. |
| `roster.changed` | A promotion adds a fighter to its published roster, lists them as off it, or lists them as retired. |

## Verifying a delivery

Every delivery carries a signature header:

```http
X-UFCalendar-Signature: t=1764072000,v1=5f2b...
```

Compute an HMAC-SHA256 of `"<t>.<raw body>"` with your endpoint's `whsec_` secret, compare it to `v1` in constant time, and reject a `t` more than a few minutes from now in either direction (that stops a captured delivery being replayed).

#### Node

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

export function verify(header, rawBody, secret, toleranceSec = 300) {
  const m = /^t=(\d+),v1=([0-9a-f]{64})$/.exec(header ?? '');
  if (!m) return false;
  if (Math.abs(Date.now() / 1000 - Number(m[1])) > toleranceSec) return false;
  const want = createHmac('sha256', secret).update(`${m[1]}.${rawBody}`).digest();
  const got = Buffer.from(m[2], 'hex');
  return got.length === want.length && timingSafeEqual(got, want);
}
```

#### Python

```python
import hmac, hashlib, re, time

def verify(header: str, raw_body: bytes, secret: str, tolerance: int = 300) -> bool:
    m = re.fullmatch(r"t=(\d+),v1=([0-9a-f]{64})", header or "")
    if not m or abs(time.time() - int(m[1])) > tolerance:
        return False
    want = hmac.new(secret.encode(), m[1].encode() + b"." + raw_body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(want, m[2])
```

Verify against the raw request body, before any JSON parsing re-serialises it.

## Managing endpoints

| Call | Does |
| --- | --- |
| `POST /v1/webhook-endpoints` | registers a URL and the event types it wants; returns the secret once |
| `GET /v1/webhook-endpoints` | lists your endpoints |
| `POST /v1/webhook-endpoints/{id}/rotate-secret` | issues a new secret |
| `DELETE /v1/webhook-endpoints/{id}` | removes one |

Answer a delivery with any `2xx` quickly and do the work afterwards; a slow or failing endpoint is retried.
