KickLib 1.4.2

dotnet add package KickLib --version 1.4.2
                    
NuGet\Install-Package KickLib -Version 1.4.2
                    
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="KickLib" Version="1.4.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="KickLib" Version="1.4.2" />
                    
Directory.Packages.props
<PackageReference Include="KickLib" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add KickLib --version 1.4.2
                    
#r "nuget: KickLib, 1.4.2"
                    
#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.
#addin nuget:?package=KickLib&version=1.4.2
                    
Install KickLib as a Cake Addin
#tool nuget:?package=KickLib&version=1.4.2
                    
Install KickLib as a Cake Tool

<p align="center"> <img src="KickLibLogo.png" style="max-height: 300px;"> </p>

<p align="center"> <a href="https://www.microsoft.com/net"><img src="https://img.shields.io/badge/-.NET%209.0-blueviolet" style="max-height: 300px;"></a> <img src="https://img.shields.io/badge/Platform-.NET-lightgrey.svg" style="max-height: 300px;"> <a href="https://discord.gg/fPRXy57WrS"><img src="https://img.shields.io/badge/Discord-KickLib-green.svg" style="max-height: 300px;"></a> <a href="https://github.com/Bukk94/KickLib/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" style="max-height: 300px;"></a> <a href="https://www.nuget.org/packages/KickLib"><img src="https://img.shields.io/nuget/dt/KickLib?label=NuGet&color=orange" style="max-height: 300px;"></a> </p>

<p align="center"> <a href='https://ko-fi.com/bukk94' target='_blank'> <img height='30' style='border:0;height:38px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /> </a>

About

KickLib is a C# library that allows for interaction with both official and unofficial (undocumented) Kick API (https://kick.com) and WebSocket (pusher). KickLib eases implementation for various chatbots by providing simple to use methods.

KickLib Highlights ✨

  • OAuth 2.1 flow
  • Real-time chat reading
  • Stream state detection
  • Authentication flow
  • Webhook payload parsing
  • Message sending
  • Official and unofficial API endpoints

<details> <summary>Click here to see Complete Features List</summary>

Client

  • Reading Chatroom events
    • New message received
    • Message deleted
    • User banned / unbanned
    • New subscriptions
    • Subscriptions gifts
    • Stream host changes
    • New pinned message
    • Pinned message deleted
  • Reading Channel events
    • Followers status updated
    • Stream state detection
    • Gifts leaderboards updated

API

  • Categories
    • Get all main (root) categories
    • Get specific main category
    • Get top categories
    • Get sub-categories (paged)
    • Get all sub-categories (list all)
    • Get specific sub-category
    • Get subcategory clips (paged)
  • Clips
    • Get all Kick clips
    • Get clip information
    • Download clip
  • Channels
    • Get messages
    • Get channel information
    • Get channel chatroom information
    • Get channel chatroom rules
    • Get channel polls
    • Get channel clips
    • Get channel links
    • Get channel videos
    • Get channel latest video
    • Get channel leaderboards
    • Get latest subscriber (Requires Authentication)
    • Get followers count
  • Emotes
    • Get channel emotes
  • Livestreams
    • Is streamer live?
    • Get livestream information
  • Message
    • Send message to chatroom (Requires Authentication)
  • Users
    • Get user information
  • Videos
    • Get video </details>

Unofficial API support

KickLib provides support for unofficial API calls via IKickUnofficialApi and IKickClient interfaces. Documentation for unofficial API can be found here.

Installing ⏫

First, install NuGet. Then, install KickLib from the package manager console:

PM> Install-Package KickLib

Or from the .NET CLI as:

dotnet add package KickLib

Using KickLib via Dependency Injection

If you are using Dependency Injection, you can easily add KickLib via extension method .AddKickLib(), that will register all related services with Scoped lifetime.

Examples 💡

OAuth flow / Authenticated API calls

Almost all calls requires authentication. Kick officially supports OAuth 2.1 flow. KickLib provides tools for generating OAuth URLs, exchanging code for tokens, and refreshing tokens.

NOTE: If no state is provided, it will automatically generate state for you as base64 encoded verifier code!

var callbackUrl = "https://localhost:5001/auth/kick/callback"; 
var clientId = "01AAAAA0EXAMPLE66YG2HD9R";
var clientSecret = "aaac0000EXAMPLE8ebe4dc223d0c45187";
var authGenerator = new KickOAuthGenerator();

var url = authGenerator.GetAuthorizationUri(
  callbackUrl, 
  clientId, 
  new List<string>
  {
      KickScopes.UserRead,
      KickScopes.ChannelWrite
  }, out var verifier);

// TODO: Perform URL redirect for the user and pass OAuth process
// By using callback URL, you will receive code and state, which can be used for Token exchange.
 
var code = "NAAAAAAY5YZQ00STATE000ZZTFHM2I1NJLK";
var state = "ZXhhbXBsZSB2YWx1ZQ=="; 
var exchangeResults = await authGenerator.ExchangeCodeForTokenAsync(
    state,
    clientId,
    clientSecret,
    callbackUrl,
    state);
    
if (exchangeResults.IsSuccess)
{
    Console.WriteLine($"Access Token: {exchangeResults.Value.AccessToken}");
    Console.WriteLine($"Refresh Token: {exchangeResults.Value.RefreshToken}");
    // TODO: Store access and refresh token for further use
    // Keep in mind: Access token is short lived, while refresh token is long lived (and should be stored)
}

Refreshing Access Token

var clientId = "01AAAAA0EXAMPLE66YG2HD9R";
var clientSecret = "aaac0000EXAMPLE8ebe4dc223d0c45187";
var refreshToken = "NAAAAAAY5YZQ00REFRESHTOKEN000ZZTFHM2I1NJLK";
var authGenerator = new KickOAuthGenerator();

var exchangeResults = await authGenerator.RefreshAccessTokenAsync(
    refreshToken,
    clientId,
    clientSecret);

// After every successful refresh, you will receive new access and refresh tokens
if (exchangeResults.IsSuccess)
{
    Console.WriteLine($"Access Token: {exchangeResults.Value.AccessToken}");
    Console.WriteLine($"Refresh Token: {exchangeResults.Value.RefreshToken}");
}

Using API to get category details

var api = KickApi.Create();
var accessToken = "XXXXXXXXXX";

// Get specific category by ID
var category = await api.Categories.GetCategoryAsync(28, accessToken);

Subscribing to webhook events

To subscribe to events (reading chat messages or channel follow events), you must first have public webhook URL set up in your Kick settings, have webhooks enabled in your developer account, and lastly, your access token must contain webhook scope (KickScopes.EventsSubscribe).

var api = KickApi.Create(new ApiSettings
{
    AccessToken = "XXXXXXXXXX"
});

// Subscript to events (webhooks) for chat messages and channel follow events
var result = await api.EventSubscriptions.SubscribeToEventsAsync(
  new List<EventType> 
  { 
    EventType.ChatMessageSent,
    EventType.ChannelFollowed
  });
  
// Each event will be assigned own SubscriptionId
// Events will be delivered to your **public** webhook URL (set up in [Kick settings](https://kick.com/settings/developer)).

This will subscribe to selected events. Once those events are triggered, Kick will send them to your webhook URL. You can then use KickWebhookParser to validate and parse the payload.

You should always validate the payload signature to ensure the webhook payload is really coming from Kick.

Kick will retry sending the webhook 3 times, until 200 response is made by your server. If your server is unreachable or non-OK response is returned, Kick automatically unsubscribe the event!

Automatically refreshing access token

KickLib allows automatic access token refresh. When RefreshToken, ClientId, and ClientSecret are provided, KickLib will automatically try to refresh access token when needed.

var settings = new ApiSettings
{
    RefreshToken = "XXXXXXXXXXXXXXXX",
    ClientId = "YYYYYYYYYYYYYYYY",
    ClientSecret = "ZZZZZZZZZZZZZZZZ"
};

settings.RefreshTokenChanged += (sender, args) =>
{
    Console.WriteLine($"Refresh token changed! New value: {args.NewToken}");
};

settings.AccessTokenChanged += (sender, args) =>
{
    Console.WriteLine($"Access token changed! New value: {args.NewToken}");
};

var api = KickApi.Create(settings);
// TODO: use `api` for calling endpoints

Keep in mind that refreshing access token also changes the refresh token! KickLib is automatically refreshing those and will notify you via RefreshTokenChanged event. But you need to make sure you are storing the new refresh token for further use.

Using Client to read chat messages

This is using Kick's undocumented (unofficial) pusher! IDs and values may differ from official API.

IKickClient client = new KickClient();
var chatroomId = 123456; // This ID can be obtained by using IUnofficialKickApi or by manually extracting from web netwowk tab.

client.OnMessage += delegate(object sender, ChatMessageEventArgs e)
{
    Console.WriteLine($"Received message: {e.Data.Content}");
};

await client.ListenToChatRoomAsync(chatroomId);
await client.ConnectAsync();

// TODO: Make sure this is in endless loop and program won't exit immediately
// otherwise you won't be able to receive messages.

Disclaimer

For a long time, Kick didn't have any official API. Most of the functionality in KickLib was researched and reversed-engineered from their website.

With new released API support, this library will be adjusted accordingly, removing all unofficial endpoints and methods. Those methods will be replaced with proper official API calls (once we have all of them).

KickLib is meant to be used for education purposes. Don't use it for heavy scraping or other harmful actions against Kick streaming platform. I don't take responsibility for any KickLib misuse and I strongly advice against such actions.

Special Thanks

@Robertsmania for helping with OTP generation, library improvements, and extensive testing.

License

See MIT License.

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.  net9.0 is compatible.  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. 
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.2 147 6/11/2025
1.4.1 166 5/25/2025
1.4.0 75 5/23/2025
1.3.0 242 4/24/2025
1.2.2 226 4/17/2025
1.2.1 196 4/9/2025
1.2.0 230 4/7/2025
1.1.1 225 4/1/2025
1.1.0 156 3/27/2025
1.0.3 174 3/22/2025
1.0.2 178 3/11/2025
1.0.1 252 3/11/2025 1.0.1 is deprecated because it has critical bugs.
1.0.0 224 3/6/2025
0.2.1 248 2/26/2025 0.2.1 is deprecated because it is no longer maintained and has critical bugs.
0.2.0 239 2/23/2025 0.2.0 is deprecated because it is no longer maintained and has critical bugs.
0.2.0-preview4 276 12/13/2024
0.2.0-preview3 133 12/1/2024
0.1.14 503 12/13/2024
0.1.13 119 12/1/2024 0.1.13 is deprecated because it has critical bugs.
0.1.12 320 10/6/2024
0.1.11 150 7/19/2024
0.1.10 129 7/4/2024
0.1.9 167 7/1/2024
0.1.8 171 6/9/2024
0.1.7 904 11/14/2023
0.1.6 150 11/9/2023
0.1.5 151 11/8/2023
0.1.4 200 9/25/2023
0.1.3 150 9/21/2023
0.1.2 430 7/21/2023
0.1.1 253 7/13/2023
0.1.0 182 7/13/2023
0.0.6 178 7/13/2023
0.0.5 179 7/12/2023
0.0.4 207 7/12/2023 0.0.4 is deprecated.
0.0.3 203 7/12/2023 0.0.3 is deprecated.
0.0.2 177 7/12/2023
0.0.1 184 7/11/2023

Fixed Puppeteer version reference