MageCorp.ClashRoyaleApi.Client 1.4.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package MageCorp.ClashRoyaleApi.Client --version 1.4.3
NuGet\Install-Package MageCorp.ClashRoyaleApi.Client -Version 1.4.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MageCorp.ClashRoyaleApi.Client" Version="1.4.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MageCorp.ClashRoyaleApi.Client --version 1.4.3
#r "nuget: MageCorp.ClashRoyaleApi.Client, 1.4.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MageCorp.ClashRoyaleApi.Client as a Cake Addin
#addin nuget:?package=MageCorp.ClashRoyaleApi.Client&version=1.4.3

// Install MageCorp.ClashRoyaleApi.Client as a Cake Tool
#tool nuget:?package=MageCorp.ClashRoyaleApi.Client&version=1.4.3


Client library (C# wrapper) written in .NET 8.0 that provides an easy way to interact with the official Clash Royale API directly or through proxy

Clash Royale API Client NuGet

Supported Platforms

  • .Net 8.0


  • Dependency injection ready (can also be used standalone, see below)
  • Supports async calls.

Table of Contents

  1. Installation
  2. Usage
  3. License

<a name="installation"></a> Installation

Logo Stable
Clash Royale API Client <img src="" width="150" height="150" title="Github Logo"> NuGet

Following commands can be used to install MageCorp.ClashRoyaleApi.Client, run the following command in the Package Manager Console

NuGet\Install-Package MageCorp.ClashRoyaleApi.Client

Or use dotnet cli

dotnet add package MageCorp.ClashRoyaleApi.Client

<a name="usage"></a> Usage

<a name="standalone-initialization"></a> Standalone Initialization

If you do not want to use any DI framework, you have to instantiate ClashRoyaleApiClient as follows.

<a name="clashroyaleapistandalone"></a> ClashRoyaleApiClient Standalone Usage
ApiOptions apiOptions = new("<your token>");
var clashRoyaleApiClient = ClashRoyaleApiClient.Create(apiOptions);
var playersService = clashRoyaleApiClient.PlayersService;
var clansService = clashRoyaleApiClient.ClansService;

clashRoyaleApiClient contains all necessary clients.

<a name="di-initialization"></a> Microsoft.Extensions.DependencyInjection Initialization

First, you need to install Microsoft.Extensions.DependencyInjection NuGet package as follows

dotnet add package Microsoft.Extensions.DependencyInjection
<a name="clash-royale-api"></a> Clash Royale Api

Register necessary dependencies to ServiceCollection as follows

var serviceProvider = new ServiceCollection()
    .AddClashRoyaleApiClient("<yor token>")


var serviceProvider = new ServiceCollection()
    .AddClashRoyaleApiClient(new ApiOptions("<your token>"))

Getting services:

var cardsService = serviceProvider.GetRequiredService<ICardsService>();
var challengesService = serviceProvider.GetRequiredService<IChallengesService>();
var clansService = serviceProvider.GetRequiredService<IClansService>();
var globalTournamentsService = serviceProvider.GetRequiredService<IGlobalTournamentsService>();
var locationsService = serviceProvider.GetRequiredService<ILocationsService>();
var playersService = serviceProvider.GetRequiredService<IPlayersService>();
var tournamentsService = serviceProvider.GetRequiredService<ITournamentsService>();
<a name="using-configuration"></a> Using Configuration

There is an extension that supports Microsoft.Extensions.Configuration to store the ApiOptions configuration as follows

  "ApiOptions": {
    "BearerToken": "<your token>",
    "ApiAddress": "",
    "ApiVerstion": "v1",
    "UseProxy": false,
    "ProxyAddress": ""
string basePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty;
var configuration = new ConfigurationBuilder()
    .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
var serviceProvider = new ServiceCollection()
    .AddClashRoyaleApiClient(provider => {
        //you can use provider to get any required service needed to initialize your ApiOptions
        return configuration.GetApiOptionsSection("<sectionName>"); //if you don't specify the sectionName it will be "ApiOptions" by default

<a name="license"></a> License

Licensed under MIT, see LICENSE for the full text.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.4.5 82 5/31/2024
1.4.4 110 3/2/2024
1.4.3 188 12/15/2023
1.3.1 154 7/7/2023