ApiFootball 3.0.0

dotnet add package ApiFootball --version 3.0.0
                    
NuGet\Install-Package ApiFootball -Version 3.0.0
                    
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="ApiFootball" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ApiFootball" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="ApiFootball" />
                    
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 ApiFootball --version 3.0.0
                    
#r "nuget: ApiFootball, 3.0.0"
                    
#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.
#:package ApiFootball@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ApiFootball&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=ApiFootball&version=3.0.0
                    
Install as a Cake Tool

CSharpApiFootball

Test NuGet

DI compatible C# API client for api-football.com supporting all documented v3 endpoints except widgets. If you find any issues or missing endpoints, please open an issue or submit a pull request.

This project is not affiliated with api-football or api-sports.

Example

var key = "your api key";
var host = Host
    .CreateDefaultBuilder(args)
    .ConfigureServices(services => services.AddApiFootball(key))
    .Build();

var serviceScope = host.Services.CreateScope();
var provider = serviceScope.ServiceProvider;

// Print Dutch Eredivisie games and final scores for the 2022 season
var fixturesClient = provider.GetRequiredService<IFixturesClient>();
var fixtures = await fixturesClient.GetFixtures(league: 88, season: 2022);

// To throw an exception in case of errors
fixtures.EnsureSuccess();

foreach (var fixture in fixtures.Response)
{
    Console.WriteLine($"{fixture.Teams.Home.Name,20}  -  {fixture.Teams.Away.Name,-20} {" ",10} {fixture.Goals.Home} - {fixture.Goals.Away}");
}

Configuration

Configure the library with the AddApiFootball options overload. The simpler AddApiFootball(apiKey, apiUrl) overload sets just the API key and base URL.

// Example, default options shown in table below
services.AddApiFootball(options =>
{
    options.ApiKey = key;
    options.ApiUrl = "https://v3.football.api-sports.io/";
    options.ThrowOnError = true; 
    options.RateLimiterOptions = ApiFootballRateLimiterOptions.ProPlan;
    options.ConfigureHttpClient = http => http.ConfigureHttpClient(client =>
        client.Timeout = TimeSpan.FromSeconds(30));
});
Option Default Description
ApiKey Empty Your API-Football key. Set this to authenticate requests.
ApiUrl https://v3.football.api-sports.io/ Base URL, including a trailing slash. For RapidAPI, provide your RapidAPI base URL; the library selects the authentication headers based on the host.
ThrowOnError false Automatically throw ApiFootballException when the API response contains errors. When disabled, inspect Errors or call EnsureSuccess() on each response.
RateLimiterOptions null Client-side request rate and concurrency limits. Set to null to disable rate limiting.
ConfigureHttpClient null Optional IHttpClientBuilder configuration for the library's named HttpClient, such as setting its timeout or configuring Polly.

Rate limiter presets

RateLimiterOptions accepts one of four built-in presets. They control requests per second and minute, concurrent requests, and the maximum number of requests waiting for a permit. These rate limiters do not enforce daily quotas.

Preset Requests per second Requests per minute Max concurrent requests Max queued requests
FreePlan No limit 10 10 100
ProPlan 5 300 5 300
UltraPlan 7 450 7 450
MegaPlan 15 900 15 900

You can also create your own instance of ApiFootballRateLimiterOptions to set custom limits, this table shows the available options and their defaults.

Rate limiter option Default Description
RequestsPerSecond null Maximum requests in a one-second sliding window. Set to null for no per-second limit.
RequestsPerMinute 10 Maximum requests in a one-minute sliding window. Set to null for no per-minute limit.
MaxConcurrentRequests null Maximum number of simultaneous requests. Set to null for no concurrency limit.
MaxQueuedRequests 100 Maximum number of waiting requests when a limit is reached. Set to 0 to allow no waiting requests, or null for an unbounded queue.

The client-side limiter applies across the registered API-Football clients. API quota headers, when returned, are also available on each response through Quota.

Supported endpoints

Here you can find a list of all the endpoints that are currently supported and which interface to use to call them.

Endpoint C# method
/coachs ICoachesClient.GetCoaches
/countries ICountriesClient.GetCountries
/fixtures IFixturesClient.GetFixtures
/fixtures/events IFixturesClient.GetFixtureEvents
/fixtures/headtohead IFixturesClient.GetHeadToHead
/fixtures/lineups IFixturesClient.GetFixtureLineups
/fixtures/players IFixturesClient.GetFixturePlayers
/fixtures/rounds IFixturesClient.GetRounds, GetRoundsWithDates, GetRoundsInTimezone
/fixtures/statistics IFixturesClient.GetFixtureStatistics
/injuries IInjuriesClient.GetInjuries
/leagues ILeaguesClient.GetLeagues
/leagues/seasons ILeaguesClient.GetSeasons
/odds IOddsClient.GetOdds
/odds/bets IOddsClient.GetBets
/odds/bookmakers IOddsClient.GetBookmakers
/odds/live IOddsClient.GetLiveOdds
/odds/live/bets IOddsClient.GetLiveBets
/odds/mapping IOddsClient.GetOddsMapping
/players IPlayersClient.GetPlayerStatistics
/players/profiles IPlayersClient.GetProfiles
/players/seasons IPlayersClient.GetSeasons
/players/squads IPlayersClient.GetSquads
/players/teams IPlayersClient.GetTeams
/players/topassists IPlayersClient.GetTopAssists
/players/topredcards IPlayersClient.GetTopRedCards
/players/topscorers IPlayersClient.GetTopScorers
/players/topyellowcards IPlayersClient.GetTopYellowCards
/predictions IPredictionsClient.GetPredictions
/sidelined ISidelinedClient.GetSidelined
/standings IStandingsClient.GetStandings
/status IStatusClient.GetStatus
/teams ITeamsClient.GetTeamsInformation
/teams/countries ITeamsClient.GetTeamsCountries
/teams/seasons ITeamsClient.GetTeamsSeasons
/teams/statistics ITeamsClient.GetTeamStatistics
/timezone ITimezoneClient.GetTimezones
/transfers ITransfersClient.GetTransfers
/trophies ITrophiesClient.GetTrophies
/venues IVenuesClient.GetVenues
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 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. 
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
3.0.0 101 10/17/2026
2.1.0 369 5/21/2025
2.0.0 296 5/21/2025
1.0.8 335 8/30/2023
1.0.7 478 12/21/2022