Sportradar.LiveData.Sdk
1.1.27
dotnet add package Sportradar.LiveData.Sdk --version 1.1.27
NuGet\Install-Package Sportradar.LiveData.Sdk -Version 1.1.27
<PackageReference Include="Sportradar.LiveData.Sdk" Version="1.1.27" />
<PackageVersion Include="Sportradar.LiveData.Sdk" Version="1.1.27" />
<PackageReference Include="Sportradar.LiveData.Sdk" />
paket add Sportradar.LiveData.Sdk --version 1.1.27
#r "nuget: Sportradar.LiveData.Sdk, 1.1.27"
#:package Sportradar.LiveData.Sdk@1.1.27
#addin nuget:?package=Sportradar.LiveData.Sdk&version=1.1.27
#tool nuget:?package=Sportradar.LiveData.Sdk&version=1.1.27
Sportradar.LiveData.Sdk
Livedata SDK is a client library that enables easier integration with the Livedata (LiveScout) XML feed. The SDK exposes the XML feed service interface in a more user-friendly way and isolates the client from having to do XML feed parsing, proper connection handling, error recovery, event queuing and dispatching. It also makes a client solution more stable and robust when it comes to feed handling, especially with the release of new and updated XML feed versions.
Contents
- Installation
- Quick start
- Login with Common IAM (CIAM)
- Usage
- Configuration reference
- Logs
- Gotchas
- Data we collect
Installation
The package targets .NET 6 (net6.0, also usable from newer .NET versions) and .NET Framework 4.8 (net48).
dotnet add package Sportradar.LiveData.Sdk
or in your project file:
<PackageReference Include="Sportradar.LiveData.Sdk" Version="x.y.z" />
The SDK reads its settings from a dedicated section in your application's configuration file (App.config, or Web.config for web projects). In .NET 6+ projects, add an App.config file to the project root; the build copies it next to your executable as <YourApp>.dll.config.
Quick start
- Get your Common IAM credentials from your Sportradar contact (see Obtaining credentials).
- Add the SDK section to
App.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="Sdk" type="Sportradar.LiveData.Sdk.Services.SdkConfiguration.Sections.SdkConfigurationSection, Sportradar.LiveData.Sdk" />
</configSections>
<Sdk>
<LiveScout Hostname="livedata.betradar.com" />
<JwtAuth ClientId="xxx"
Tenant="https://auth.sportradar.com/"
Kid="xxx"
PemPath="${LIVEDATA_PRIVATE_KEY_PATH}" />
</Sdk>
</configuration>
configSections must be the first element inside configuration. Replace xxx with your values and point PemPath at your private key file (here via an environment variable).
- Initialize the SDK, start the LiveScout provider and subscribe to matches:
using System;
using System.Linq;
using System.Threading;
using Sportradar.LiveData.Sdk.Services;
internal static class Program
{
private static void Main()
{
var sdk = Sdk.Instance;
sdk.Initialize(); // reads the "Sdk" section from App.config
sdk.Start();
var liveScout = sdk.LiveScout;
var opened = new ManualResetEventSlim();
liveScout.OnOpened += (_, e) => { Console.WriteLine($"Connected {e.LocalTimestamp:O}"); opened.Set(); };
liveScout.OnClosed += (_, e) => Console.WriteLine($"Disconnected {e.LocalTimestamp:O}");
liveScout.OnLoginFailed += (_, e) => Console.WriteLine($"Login failed: {e.ErrorCode}");
liveScout.OnFeedError += (_, e) => Console.WriteLine($"Feed error: {e.Cause} {e.ErrorMessage}");
liveScout.OnMatchList += (_, e) =>
{
Console.WriteLine($"Match list with {e.MatchList.Length} matches");
liveScout.Subscribe(e.MatchList.Select(m => m.MatchHeader.MatchId).Take(10));
};
liveScout.OnMatchUpdate += (_, e) =>
Console.WriteLine($"Update for match {e.MatchUpdate.MatchHeader.MatchId}");
liveScout.Start();
if (opened.Wait(TimeSpan.FromSeconds(30)))
{
liveScout.GetMatchList(hours_back: 4, hours_fwd: 4);
}
Console.ReadLine();
sdk.Stop();
}
}
Login with Common IAM (CIAM)
The SDK authenticates against Sportradar Common IAM and logs in to the feed with the issued access token. Two Common IAM flows are supported:
| Flow | Config element | When to use |
|---|---|---|
| Private Key JWT (recommended) | <JwtAuth> |
Default for Service Accounts. You keep an RSA private key; no shared secret is sent over the wire. |
| Client secret | <StandardOAuth> |
Only if your Sportradar contact issued a client ID and client secret instead of a key pair. |
As soon as one of these elements is present in the Sdk section, the SDK uses Common IAM; ScoutUsername/ScoutPassword are then ignored. If both are configured, StandardOAuth wins.
Obtaining credentials
Service Accounts are not self-managed today; coordinate with your Sportradar contact:
Generate an RSA key pair locally (PEM, 2048-bit recommended):
openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out livedata-private.pem openssl rsa -in livedata-private.pem -pubout -out livedata-public.pemShare only the public key (
livedata-public.pem) with Sportradar.Sportradar registers it and returns the Client ID and KID (key ID) via an approved secure channel (e.g. Keeper).
Keep the private key secret: never commit it and restrict file permissions to the account that runs your service. See the Common IAM Guide for the full Private Key JWT flow.
Private Key JWT (JwtAuth)
<Sdk>
<LiveScout Hostname="livedata.betradar.com" />
<JwtAuth ClientId="xxx"
Tenant="https://auth.sportradar.com/"
Kid="xxx"
PemPath="/etc/livedata/livedata-private.pem" />
</Sdk>
JwtAuth is a child of Sdk, next to LiveScout (not inside it). All four attributes are required:
| Attribute | Value |
|---|---|
ClientId |
Service Account ID (Common IAM client ID) provided by your Sportradar contact. |
Tenant |
Common IAM domain, with a trailing slash. Production: https://auth.sportradar.com/; staging: https://stg-auth.sportradar.com/. The SDK appends oauth/token. |
Kid |
Key ID assigned when your public key was registered in Common IAM. |
PemPath |
Path to the unencrypted RSA private key in PEM format (PKCS#1 BEGIN RSA PRIVATE KEY or PKCS#8 BEGIN PRIVATE KEY). Supports ${ENV_VAR} placeholders. |
Keeping the key path out of the config file
PemPath expands ${NAME} placeholders from the process environment when the SDK loads its settings. This lets you ship the same App.config to every environment and inject the key location at deploy time (Kubernetes secret mount, CI file variable, etc.):
<JwtAuth ClientId="xxx" Tenant="https://auth.sportradar.com/" Kid="xxx"
PemPath="${LIVEDATA_PRIVATE_KEY_PATH}" />
export LIVEDATA_PRIVATE_KEY_PATH=/run/secrets/livedata-private.pem
If the variable is not set, the placeholder is left unchanged and the key file will not be found.
Client secret (StandardOAuth)
<Sdk>
<LiveScout Hostname="livedata.betradar.com" />
<StandardOAuth ClientId="xxx"
ClientSecret="xxx"
TokenEndpoint="https://auth.sportradar.com/" />
</Sdk>
| Attribute | Value |
|---|---|
ClientId |
OAuth client ID provided by your Sportradar contact. |
ClientSecret |
OAuth client secret provided by your Sportradar contact. Treat it like a password. |
TokenEndpoint |
Common IAM domain, with a trailing slash (same values as Tenant above). The SDK appends oauth/token. |
ClientSecret does not support ${ENV_VAR} expansion; protect the config file accordingly (e.g. generate it at deploy time).
Environments
Set Hostname on LiveScout explicitly when using Common IAM, and pair it with the matching IAM domain:
| Environment | IAM domain (Tenant / TokenEndpoint) |
LiveScout Hostname |
|---|---|---|
| Production | https://auth.sportradar.com/ |
livedata.betradar.com |
| Staging (recommended for integration testing) | https://stg-auth.sportradar.com/ |
livedata.betradar.dev |
Staging example:
<Sdk>
<LiveScout Hostname="livedata.betradar.dev" />
<JwtAuth ClientId="xxx"
Tenant="https://stg-auth.sportradar.com/"
Kid="xxx"
PemPath="${LIVEDATA_PRIVATE_KEY_PATH}" />
</Sdk>
Replay server: with Test="true" on LiveScout the SDK connects to the replay server (port 2047) and requests a token for the replay audience instead of the live feed. Use ILiveScout.SubscribeTest(...) to replay recorded matches there.
How the login works
On every (re)connect to the feed the SDK:
- Creates a short-lived client assertion (JWT signed with your private key, RS256, valid for one minute), or uses the client secret for
StandardOAuth. - Requests an access token from
<IAM domain>oauth/tokenusing the OAuth 2.0 client-credentials grant, for thelivedata-feedaudience (livedata-replaywhenTest="true"). - Sends the access token in the feed
loginmessage.
The access token is cached and reused on reconnects until shortly before it expires, so a flapping connection does not hammer Common IAM.
Requirements on your side:
- Outbound HTTPS to the IAM domain, in addition to the feed host and port.
- Accurate system clock (NTP). The client assertion is only valid for one minute, so a skewed clock makes Common IAM reject it.
Troubleshooting login
Subscribe to ILiveScout.OnLoginFailed; LoginFailedEventArgs.ErrorCode tells you what went wrong:
ErrorCode |
Meaning |
|---|---|
no_access_token_Unauthorized |
Common IAM rejected the credentials: wrong ClientId/Kid, key not registered, wrong IAM domain for the environment, or clock skew. |
no_access_token_<HttpStatus> (e.g. no_access_token_BadRequest) |
Common IAM returned another HTTP error. |
no_access_token or no_access_token_ |
No token could be obtained at all: PEM file missing or unreadable, ${ENV_VAR} not set, IAM domain unreachable (network, proxy, firewall). |
flooding |
Too many logins in a short time; the server blocks you temporarily. |
| Other values | Rejected by the feed server's login reply (e.g. the Service Account has no access to the feed). |
After an authentication failure the LiveScout provider stops and does not reconnect automatically. Check the SDK logs for the cause, fix the configuration, then call LiveScout.Stop() and LiveScout.Start() again (or restart your process).
If the JwtAuth or StandardOAuth element is present but an attribute is missing, Sdk.Instance.Initialize() throws SdkConfigException.
Legacy login (deprecated)
Username/password login is still available but deprecated and will be removed in the future. It is used only when neither JwtAuth nor StandardOAuth is configured:
<Sdk>
<LiveScout ScoutUsername="xxx" ScoutPassword="xxx" />
</Sdk>
To migrate, request a Service Account from your Sportradar contact, add a JwtAuth element and remove ScoutUsername/ScoutPassword.
Usage
Initialize the SDK
Sdk.Instance.Initialize();
Overloads let you pass a different configuration section name and your own IDeadLetterQueue implementation to log or report messages and events the SDK could not deliver:
Sdk.Instance.Initialize("MySdkSection", new MyDeadLetterQueue());
Initialize throws SdkConfigException if the configuration is invalid. Accessing Sdk.Instance.LiveScout before Initialize throws InitException.
Start the SDK and register for global events
Sdk.Instance.OnQueueLimits += OnQueueLimits;
Sdk.Instance.Start();
Queue limit notifications alert you when the dispatcher queues start to congest (or have recovered), so you can react before messages pile up. Sdk.Instance.GetQueueStats() returns statistics for the underlying dispatcher queues.
Start the LiveScout provider and register for feed events
var liveScout = Sdk.Instance.LiveScout;
liveScout.OnOpened += OnOpened;
liveScout.OnClosed += OnClosed;
liveScout.OnLoginFailed += OnLoginFailed;
liveScout.OnFeedError += OnFeedError;
liveScout.OnMatchList += OnMatchList;
liveScout.OnMatchUpdate += OnMatchUpdate;
liveScout.OnMatchStop += OnMatchStop;
liveScout.OnScoutInfo += OnScoutInfo;
liveScout.OnMatchBookingReply += OnMatchBookingReply;
liveScout.OnMatchData += OnMatchData;
liveScout.OnLineups += OnLineups;
liveScout.Start();
The provider connects to the feed server, logs in and keeps the connection alive. If the connection drops, it reconnects automatically, re-subscribes your matches and informs you through OnClosed, OnFeedError and OnOpened. Event handlers run on SDK dispatcher threads, so keep them fast and thread-safe.
OnMatchUpdate delivers all match updates. Use OnMatchUpdateFull, OnMatchUpdateDelta and OnMatchUpdateDeltaUpdate if you want to handle the feed types separately.
Send requests
// Matches 4 hours back and 4 hours ahead; include_avail also returns matches open for booking.
liveScout.GetMatchList(hours_back: 4, hours_fwd: 4, include_avail: false);
// LiveScout sends no match data until you subscribe.
liveScout.Subscribe(new long[] { 12345678 });
liveScout.Unsubscribe(new long[] { 12345678 });
// Booking may incur costs depending on your agreement with Sportradar.
liveScout.BookEvents(new long[] { 12345678 });
Requests are rate-limited by the SDK according to the server limits; a call can block until it is allowed. Requests sent before OnOpened are not queued.
Stop
liveScout.Stop();
// unregister your handlers ...
Sdk.Instance.OnQueueLimits -= OnQueueLimits;
Sdk.Instance.Stop();
Sdk.Instance.Stop() also stops the LiveScout provider and logs out from the feed.
Note: The SDK is a singleton. Run only one active SDK instance per process. When using multiple processes (e.g. a failover setup), avoid running SDK instances in parallel with the same credentials; you may end up with inconsistent error-recovery state and run into server-side limits.
Configuration reference
All settings live in the Sdk section. Only authentication is required; everything else has defaults.
| Element | Purpose | Common attributes |
|---|---|---|
LiveScout |
Feed connection and protocol | Hostname, Port, Test (replay server), UseSSL (default true), SSLThumbprint (optional leaf certificate pinning), MinReconnectWait, MaxReconnectWait, log levels |
JwtAuth |
Common IAM, Private Key JWT | ClientId, Tenant, Kid, PemPath |
StandardOAuth |
Common IAM, client secret | ClientId, ClientSecret, TokenEndpoint |
Common |
Logging and queues | LogPath (default logs), ExecutionLogLevel, QueueLowWatermark, QueueHighWatermark, QueueMaxCapacity |
MessageDispatcher |
Event dispatching | NumDispatchers (default 3), MaxDispatchEventsPerSecond |
The feed and Common IAM connections use standard platform CA certificate validation; you do not need SSLThumbprint unless you want pinning. The full list of attributes and defaults is documented in the XML docs of the Sportradar.LiveData.Sdk.Services.SdkConfiguration.Sections namespace (visible via IntelliSense).
A complete example:
<Sdk>
<Common LogPath="logs/sdk" ExecutionLogLevel="Info" />
<LiveScout Hostname="livedata.betradar.com"
TrafficLogLevel="Info"
AlertLogLevel="Warn"
ClientInteractionLogLevel="Warn" />
<JwtAuth ClientId="xxx"
Tenant="https://auth.sportradar.com/"
Kid="xxx"
PemPath="${LIVEDATA_PRIVATE_KEY_PATH}" />
</Sdk>
Logs
The SDK writes log files (log4net) under Common.LogPath. Logs are organized into categories: critical alerts, invalid messages, client interaction, configuration, statistics, message traffic and execution. Log levels are configured per category on Common and LiveScout (e.g. ExecutionLogLevel, AlertLogLevel, TrafficLogLevel). Token request and login failures are logged with their cause, which is the first place to look when OnLoginFailed fires.
Gotchas
The SDK generates an implicit "bet stop" after a disconnect and performs automatic error recovery. It does not keep track of bet clearings! If you are disconnected for a long time, the match may already be over when you come back. Bets were not accepted in that time frame (so you are safe), but you may still need to settle bets placed at the beginning of the match. In that (rare) case, re-subscribe to the match to receive a full match update and check MatchUpdate.MatchStatus to do correct pay-outs.
The SDK never generates an implicit "bet start". Do not rely on a bet start to resume accepting bets; check MatchHeader.BetStatus instead.
Data we collect
The SDK sends its version with the login so Sportradar can provide support and compatibility notices.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- BouncyCastle.Cryptography (>= 2.7.0)
- Castle.Windsor (>= 6.0.0)
- log4net (>= 3.6.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.IdentityModel.Tokens (>= 8.22.0)
- Newtonsoft.Json (>= 13.0.1)
- NodaTime (>= 3.0.5)
- Sportradar.LiveData.DataModel (>= 1.0.364)
- System.Drawing.Common (>= 10.0.11)
- System.IdentityModel.Tokens.Jwt (>= 8.22.0)
- System.Net.Http (>= 4.3.4)
- System.Security.Cryptography.Xml (>= 11.0.0)
- System.ServiceModel.Duplex (>= 4.8.1)
- System.ServiceModel.Http (>= 4.8.1)
- System.Text.Json (>= 10.0.11)
-
net6.0
- Castle.Windsor (>= 6.0.0)
- log4net (>= 3.6.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.IdentityModel.Tokens (>= 8.22.0)
- Newtonsoft.Json (>= 13.0.1)
- NodaTime (>= 3.0.5)
- Sportradar.LiveData.DataModel (>= 1.0.364)
- System.Drawing.Common (>= 10.0.11)
- System.IdentityModel.Tokens.Jwt (>= 8.22.0)
- System.Net.Http (>= 4.3.4)
- System.Security.Cryptography.Xml (>= 11.0.0)
- System.ServiceModel.Duplex (>= 4.8.1)
- System.ServiceModel.Http (>= 4.8.1)
- System.Text.Json (>= 10.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.1.27 | 54 | 11/27/2026 |
| 1.1.26 | 82 | 11/25/2026 |
| 1.1.25 | 75 | 11/24/2026 |
| 1.1.24 | 83 | 11/24/2026 |
| 1.1.23 | 136 | 11/19/2026 |
| 1.1.22 | 460 | 9/24/2026 |
| 1.1.21 | 386 | 8/18/2026 |
| 1.1.20 | 1,750 | 4/29/2026 |
| 1.1.19 | 3,513 | 12/10/2025 |
| 1.1.18 | 1,244 | 11/26/2025 |
| 1.1.17 | 2,247 | 10/8/2025 |
| 1.1.16-beta | 301 | 6/2/2025 |
| 1.1.15 | 9,108 | 4/8/2025 |
| 1.1.14 | 1,310 | 3/27/2025 |
| 1.1.13 | 820 | 3/25/2025 |
| 1.1.12 | 33,498 | 10/18/2024 |
| 1.1.11 | 1,368 | 8/23/2024 |
| 1.1.10 | 13,934 | 6/3/2024 |
| 1.1.10-beta | 271 | 6/11/2024 |
| 1.1.9 | 2,427 | 3/11/2024 |
- Bug Fix: Corrected Common IAM TLS certificate validation by centralizing thumbprint and trust-store checks for TCP and dynamic-config HTTP connections (LDS-5970).
- Technical Improvement: Added sliding-window queue metrics with .NET Metrics export and expanded Sdk.GetQueueStats() for SDK tools query (LDS-5147).
- Technical Improvement: Refactored and extended the standalone QA TestApp for manual SDK validation (LDS-5736).
- Vulnerability: Updated log4net, System.Security.Cryptography.Xml, BouncyCastle.Cryptography (net48), and related Microsoft.Extensions dependencies.
- Technical Improvement: Upgraded LiveData DataModel to 1.0.364 (livedata-core 1.0.364).