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

# Install the SportsX C# SDK via NuGet

> Add STX.Sdk to your .NET 8 project from NuGet, understand its transitive dependencies, and choose between hosted and script setups.

`STX.Sdk` is distributed as a single NuGet package. You add one reference and the SDK handles everything else — GraphQL transport, WebSocket channels, JWT management, and Polly retries are all included transitively.

## Add the package

<Tabs>
  <Tab title=".NET CLI">
    ```bash theme={null}
    dotnet add package STX.Sdk
    ```
  </Tab>

  <Tab title="Package Manager Console">
    ```bash theme={null}
    Install-Package STX.Sdk
    ```
  </Tab>

  <Tab title="PackageReference">
    ```xml theme={null}
    <PackageReference Include="STX.Sdk" Version="*" />
    ```
  </Tab>
</Tabs>

Or search for `STX.Sdk` in Visual Studio's NuGet Package Manager UI.

Package page: [nuget.org/packages/STX.Sdk](https://www.nuget.org/packages/STX.Sdk)

## Runtime requirements

|                      |                                                       |
| -------------------- | ----------------------------------------------------- |
| **Target framework** | `net8.0`                                              |
| **Minimum .NET SDK** | 8.0                                                   |
| **Platforms**        | Windows, macOS, Linux — any platform that runs .NET 8 |

<Note>
  Older versions of the package targeted `net7.0`. New projects should start on .NET 8.
</Note>

## Transitive dependencies

You do not need to reference any of these directly — they come in automatically with `STX.Sdk`:

| Package                                                             | Purpose                                              |
| ------------------------------------------------------------------- | ---------------------------------------------------- |
| `GraphQL.Client` + `GraphQL.Client.Serializer.Newtonsoft`           | Typed GraphQL transport                              |
| `Microsoft.Extensions.Hosting.Abstractions`                         | DI container and `BackgroundService` base classes    |
| `Microsoft.Extensions.Http`                                         | `IHttpClientFactory`                                 |
| `Microsoft.Extensions.Logging.Abstractions`                         | `ILogger<T>`                                         |
| `Microsoft.IdentityModel.Tokens`, `System.IdentityModel.Tokens.Jwt` | JWT parsing                                          |
| `Polly`                                                             | Retry and transient-fault handling for GraphQL calls |

## Using the SDK without a full host

The canonical pattern uses `Host.CreateDefaultBuilder` because it starts the DI container and runs background services (session keep-alive, geolocation). For lightweight scripts you can build your own `ServiceCollection` instead:

```csharp theme={null}
var services = new ServiceCollection();
services.ConfigureSTXServices(
    graphQLUri:  "https://in-api-staging.stxapp.io/graphiql",
    channelsUri: "wss://in-api-staging.stxapp.io/socket/websocket?token={0}&vsn=2.0.0");

var provider = services.BuildServiceProvider();
var login = provider.GetRequiredService<STXLoginService>();
```

<Warning>
  Background services (`STXSessionBackgroundService`, `STXGeoLocationBackgroundService`) won't start automatically without a proper `IHost`. If you need automatic token refresh or geolocation, either run under `Host.CreateDefaultBuilder` or start those services explicitly.
</Warning>

## Versioning

`STX.Sdk` follows semantic versioning:

* **Major** — breaking API changes
* **Minor** — new services or methods (backwards-compatible)
* **Patch** — bug fixes

Releases are tag-driven from the [`cssdk` repo](https://github.com/betstackai/cssdk) and published to NuGet automatically on each release tag.
