iRacing is the leading online racing simulation for PC. During events hosted via the iRacing service there is a large amount of data created related to race results and member participation in events.
This library allows access via .NET to the iRacing "Data API". These APIs allow a properly authenticated user a supported method of accessing data from the service.
This authentication is no longer supported. Legacy authentication was removed 9 Dec 2025. See: https://forums.iracing.com/discussion/84226/legacy-authentication-removal-dec-9-2025
One of the OAuth-based authentication methods is now required.
To use this authentication method you need to contact iRacing who will allocate a "Client ID" and "Client Secret".
- "Authorization Code Flow" is intended for interactive applications, either client apps or web-based apps. It allows users to authenticate with iRacing.
- "Password Limited Flow" is authentication intended for scripts or back-end processes that do not need to access the details of specific users.
Full information is available from the iRacing.com Auth Service Documentation.
1. Install the Aydsko iRacing Data API library.
The library is distributed as the Aydsko.iRacingData NuGet package. Install using your package manager of choice.
dotnet add package Aydsko.iRacingData2. Register the client.
Register the iRacing Data API client classes with the service provider.
Using iRacing OAuth "Authentication Code Grant" authentication:
public class MyTokenSource : IOAuthTokenSource
{
public async Task<OAuthTokenValue> GetTokenAsync(CancellationToken cancellationToken = default)
{
// TODO - Implement retrieval of the iRacing authentication token
// via the "/authorize" and "/token" endpoints or retrieve
// a previous token from secure storage.
}
}
services.AddIRacingDataApi(options =>
{
options.UseProductUserAgent("MyApplicationName", new Version(1, 0));
// Supply the "IOAuthTokenSource" implementation.
options.UseOAuthTokenSource(sp => sp.GetRequiredService<MyTokenSource>());
});OR
Using iRacing OAuth "Password Limited Grant" authentication:
services.AddIRacingDataApi(options =>
{
options.UseProductUserAgent("MyApplicationName", new Version(1, 0));
// Supply your iRacing username, password, client id, and client secret.
options.UsePasswordLimitedOAuth(iRacingUsername, iRacingPassword, iRacingClientId, iRacingClientSecret);
});3. Use the client.
Use the IDataClient from the service provider to authenticate and request data.
// Retrieve an instance from the service provider.
var dataClient = serviceProvider.GetRequiredService<IDataClient>();
// Retrieve information about our own account.
var infoResponse = await dataClient.GetMyInfoAsync(cancellationToken);
// Write that information to the console.
Console.WriteLine($"Driver name: {infoResponse.Data.DisplayName}");
Console.WriteLine($"Customer ID: {infoResponse.Data.CustomerId}");
Console.WriteLine($"Club: {infoResponse.Data.ClubName}");1. Add the Microsoft memory caching package.
dotnet add package Microsoft.Extensions.Caching.Memory2. Register the memory caching library with the service provider.
services.AddMemoryCache();3. Register the caching client.
Register the iRacing Data API caching client classes with the service provider.
services.AddIRacingDataApiWithCaching(options =>
{
// [... normal configuration for your chosen authentication type here]
});Then simply use the IDataClient as before.
Ideally you should always use the latest version of the library that is available. This is because iRacing will sometimes introduce API changes during a release which make the old code incompatible.
This library will use version numbers will be in the format:
[YY][SS].[R]
Where:
- YY = two digit year
- SS = the iRacing season the library release was made in as a zero-padded number (i.e. 01, 02, 03, 04)
- R = release number, which increments when changes are made although it may not be sequential
Example:
- 2303.1 = changes compatible with iRacing 2023 Season 3 or later, and is release 1 during this season
Before you begin a contribution, please read and ensure you are comfortable with this project's Code of Conduct.
To build & develop on the codebase you'll need:
- An active iRacing membership
- .NET 8 (or later)
To get started open and build src\iRacing Data API.sln.
