---
title: "Moments - Tech Integration Guide"
canonical_url: "https://docs.sportradar.com/resources/ads/docs/moments-tech-integration-guide"
markdown_url: "https://docs.sportradar.com/resources/ads/docs/moments-tech-integration-guide.md"
last_updated: "2026-11-24T09:54:43Z"
---

# Moments - Tech Integration Guide

### 1. Overview {#id-1.-overview}

This guide explains the steps to onboard and start receiving Moments notifications on your systems. To integrate, you need an HTTPS endpoint that can receive and verify our requests.

Moments notifies you in real time when something happens in a live match that matches a predefined condition, for example "a goal is scored and the home team has at least 2 goals".

Each time one of those conditions (a trigger) fires, Moments sends a signed HTTPS `POST` with a JSON event to your endpoint (a webhook).

### 2. Onboarding a webhook {#id-2.-onboarding-a-webhook}

Follow these two steps for each endpoint you want to receive Moments events on.

#### 2.1 Provide your endpoint URL {#id-2.1-provide-your-endpoint-url}

Send your endpoint URL to your Sportradar contact. The endpoint must:

- Use HTTPS.
- Have a valid certificate from a trusted certificate authority.
- Be the final URL. Redirects are not supported.
- Accept `POST` requests with a JSON body.

#### 2.2 Allow-list the Sportradar IP addresses {#id-2.2-allow-list-the-sportradar-ip-addresses}

All deliveries come from these fixed IP addresses, make sure inbound requests from all of them are allowed:

- `34.246.3.26`
- `52.30.67.157`
- `52.209.251.74`

### 3. Receiving events {#id-3.-receiving-events}

#### 3.1 The request {#id-3.1-the-request}

```
POST <your endpoint URL>
Content-Type: application/json
x-webhook-signature: t=1794401271,v1=5d2c0e...
x-webhook-timestamp: 1794401271

<Moments event JSON>
```

#### 3.2 The event {#id-3.2-the-event}

Main fields:

| Field            | Type   | Description                                                            |
| ---------------- | ------ | ---------------------------------------------------------------------- |
| `advertiserId`   | string | Your advertiser ID at Sportradar.                                      |
| `triggerId`      | string | ID of the trigger that fired.                                          |
| `name`           | string | Human-readable trigger name, for example “Home team goal”.             |
| `fireId`         | string | Unique ID of this moment. You can use it to deduplicate.               |
| `notificationId` | string | ID of this notification. Useful when reporting an issue to Sportradar. |
| `eventId`        | string | Sportradar match ID.                                                   |
| `sportId`        | string | Sportradar sport ID, for example `"1"` for soccer.                     |
| `fact`           | object | What happened in the match (see below).                                |
| `timestamps`     | object | When it happened and when it was processed (see below).                |

`fact` contains:

| Field        | Description                                                                                                                                                     |
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `fact.raw`   | The match event itself: `type` (for example `goal`), `team` (`home` or `away`), `time` (match minute) and `uts` (Unix timestamp).                               |
| `fact.state` | The state of the match at that moment, such as the score.                                                                                                       |
| `fact.info`  | Match details: competition (`competition_id`, `competition_name`) and teams (`home_team`, `away_team`, each with `id`, `name`, `country_code`, `country_name`). |

`timestamps` contains (ISO 8601, UTC):

| Field          | Description                            |
| -------------- | -------------------------------------- |
| `occurredAt`   | When the moment happened in the match. |
| `receivedAt`   | When Moments received the match data.  |
| `firedAt`      | When the trigger fired.                |
| `dispatchedAt` | When the notification was dispatched.  |

Example:

```json
{
  "advertiserId": "123",
  "triggerId": "35g7af90-4929-72ea-a95g-c63d041f9d6b",
  "name": "Home team goal",
  "fireId": "3369224334g870773cae8bc8ej7h43u3",
  "notificationId": "37hsme68-3f62-4eb6-821f-3adb808j1267",
  "eventId": "26842301",
  "sportId": "1",
  "fact": {
    "id": "5-53149308-1794401260-250427f2-f59a-4c52-a755-ce86446a8282",
    "raw": {
      "_id": "170327f1-f57g-2c17-a765-ce86566a8282",
      "type": "goal",
      "team": "home",
      "time": 89,
      "uts": 1794401260
    },
    "state": {},
    "info": {
      "event_id": "26842301",
      "sport_id": "1",
      "competition_id": "11718",
      "competition_name": "U19 National",
      "home_team": {
        "id": "5293133",
        "name": "MTK Budapest",
        "unique_id": "345384",
        "country_code": "hu",
        "country_name": "Hungary"
      },
      "away_team": {
        "id": "5541356",
        "name": "Illes Akademia",
        "unique_id": "345382",
        "country_code": "hu",
        "country_name": "Hungary"
      }
    }
  },
  "timestamps": {
    "firedAt": "2026-11-11T12:47:51.381811Z",
    "occurredAt": "2026-11-11T12:47:40.000000Z",
    "receivedAt": "2026-11-11T12:47:51.304183Z",
    "dispatchedAt": "2026-11-11T12:47:51.000000Z"
  }
}
```

#### 3.3 Delivery behaviour {#id-3.3-delivery-behaviour}

- **Respond quickly.** Return a `2xx` within 5 seconds. Acknowledge first, then process asynchronously.
- **Retries**. Currently each delivery is attempted once. Exponential backoff retries will be introduced in next versions.
- **Idempotency.** Use notificationId and/or fireId in the event body to deduplicate deliveries if your endpoint receives the same event more than once.
- **Ordering of events.** Moments sends the events for your endpoint one at a time, in order. You can use `timestamps.occurredAt` field for custom ordering.
- **One endpoint, all triggers.** Your endpoint receives the events of all your triggers.

### 4. Optional steps {#id-4.-optional-steps}

#### 4.1 Staging webhook {#id-4.1-staging-webhook}

If you have a staging environment and want to register a staging webhook as well, we can set it up for you.

#### 4.2 Verification of signatures {#id-4.2-verification-of-signatures}

Webhooks include a signature that you can use to verify them. After registering the webhook Sportradar can send you its signing secret through a secure channel.

**4.2.1 Headers**

| Header                | Example                     | Description                                             |
| --------------------- | --------------------------- | ------------------------------------------------------- |
| `x-webhook-signature` | `t=1794401271,v1=5d2c0e...` | `t` = Unix timestamp (seconds), `v1` = hex HMAC-SHA256. |
| `x-webhook-timestamp` | `1794401271`                | Same value as `t`.                                      |

**4.2.2 Verification algorithm**

1. Read the raw request body bytes. Do not parse and re-serialize the JSON before verifying.
2. Split `x-webhook-signature` on `,`, then each part on the first `=`, to get `t` and `v1`.
3. Build the signed message: `t` + `.` + raw body.
4. Compute `HMAC-SHA256(key = signing secret as UTF-8, message)` and hex-encode it (lowercase). Use the signing secret exactly as received, as a text string. Do not hex-decode it.
5. Compare with `v1` using a constant-time comparison.
6. Reject the request if `t` is more than 5 minutes from your current time.
7. If verification fails, respond `401` and do not process the event.

**4.2.3 Examples**

The examples below implement the algorithm from section 4.1.2 as a single function you can copy into your endpoint. Call it with the raw request body, the value of the `x-webhook-signature` header and your signing secret. It returns `true` if the request is authentic and recent, and `false` otherwise. If it returns `false`, respond `401` and do not process the event.

`secrets` is a list so that you can accept both the current and the previous secret while rotating. Normally it contains just one secret.

Python:

```python
import hashlib
import hmac
import time

def verify_moments_webhook(body: bytes, signature_header: str, secrets: list[str], tolerance_seconds: int = 300) -> bool:
    if not signature_header:
      return False
    fields = dict(part.strip().split("=", 1) for part in signature_header.split(",") if "=" in part)
    timestamp = fields.get("t", "")
    signature = fields.get("v1", "")
    if not timestamp.isdigit() or not signature:
        return False
    if abs(time.time() - int(timestamp)) > tolerance_seconds:
        return False
    message = timestamp.encode("utf-8") + b"." + body
    for secret in secrets:
        expected = hmac.new(secret.encode("utf-8"), message, hashlib.sha256).hexdigest()
        if hmac.compare_digest(expected, signature):
            return True
    return False
```

Node.js:

```javascript
const crypto = require('node:crypto');
function verifyMomentsWebhook(rawBody, signatureHeader, secrets, toleranceSeconds = 300) {
  if (typeof signatureHeader !== 'string') {
    return false;
  }
  const fields = {};
  for (const part of signatureHeader.split(',')) {
    const index = part.indexOf('=');
    if (index > 0) {
      fields[part.slice(0, index).trim()] = part.slice(index + 1).trim();
    }
  }
  const timestamp = Number(fields.t);
  if (!Number.isInteger(timestamp) || !fields.v1) {
    return false;
  }
  if (Math.abs(Date.now() / 1000 - timestamp) > toleranceSeconds) {
    return false;
  }
  const received = Buffer.from(fields.v1, 'hex');
  return secrets.some((secret) => {
    const expected = crypto.createHmac('sha256', secret).update(`${fields.t}.`).update(rawBody).digest();
    return expected.length === received.length && crypto.timingSafeEqual(expected, received);
  });
}
```

#### 4.3 Run a test {#id-4.3-run-a-test}

Check on a live match that events arrive.

#### 4.4 After onboarding {#id-4.4-after-onboarding}

To rotate the signing secret, or to change, pause or remove the webhook, contact your Sportradar contact. (in the future there will be a UI interface for this)
