Stats Service
Stats Service
Section titled “Stats Service”The Stats service provides comprehensive access to member statistics, season standings, time trial results, qualifying results, and world records.
const statsService = iracing.stats;Member Statistics
Section titled “Member Statistics”memberBests(params?)
Section titled “memberBests(params?)”Get a member’s personal best lap times.
Returns: Promise<StatsMemberBestsResponse>
Parameters:
custId?: number- Customer ID (defaults to authenticated user)carId?: number- Filter to a specific car
Description: Returns the member’s personal best lap times across all tracks.
// Get your own bestsconst myBests = await iracing.stats.memberBests();
// Get bests for a specific carconst carBests = await iracing.stats.memberBests({ carId: 123});
// Get another member's bestsconst otherBests = await iracing.stats.memberBests({ custId: 123456});memberCareer(params?)
Section titled “memberCareer(params?)”Get a member’s career statistics.
Returns: Promise<StatsMemberCareerResponse>
Parameters:
custId?: number- Customer ID (defaults to authenticated user)
Description: Returns career-wide statistics including starts, wins, top fives, and more.
const career = await iracing.stats.memberCareer({ custId: 123456});
career.forEach(category => { console.log(`${category.categoryName}:`); console.log(` Starts: ${category.starts}`); console.log(` Wins: ${category.wins}`); console.log(` Top 5s: ${category.top5}`);});memberDivision(params)
Section titled “memberDivision(params)”Get division statistics for a member.
Returns: Promise<StatsMemberDivisionResponse>
Parameters:
seasonId: number(required) - The season IDeventType: number(required) - The event type
Description: Returns the member’s division-level statistics for a specific season and event type.
const division = await iracing.stats.memberDivision({ seasonId: 3456, eventType: 5 // Race});
console.log('Division stats:', division);memberRecap(params?)
Section titled “memberRecap(params?)”Get a member’s season recap.
Returns: Promise<StatsMemberRecapResponse>
Parameters:
custId?: number- Customer ID (defaults to authenticated user)year?: number- Filter by yearseason?: number- Filter by season quarter (1-4)
Description: Returns a recap of the member’s performance for a season or year.
const recap = await iracing.stats.memberRecap({ custId: 123456, year: 2024, season: 3});
console.log('Season recap:', recap);memberRecentRaces(params?)
Section titled “memberRecentRaces(params?)”Get a member’s recent race results.
Returns: Promise<StatsMemberRecentRacesResponse>
Parameters:
custId?: number- Customer ID (defaults to authenticated user)
Description: Returns the member’s most recent race results.
const recentRaces = await iracing.stats.memberRecentRaces({ custId: 123456});
recentRaces.races.forEach(race => { console.log(`${race.seriesName} at ${race.trackName}`); console.log(` Finished: P${race.finishPosition}`); console.log(` iRating change: ${race.newIrating - race.oldIrating}`);});memberSummary(params?)
Section titled “memberSummary(params?)”Get a quick summary of a member’s statistics.
Returns: Promise<StatsMemberSummaryResponse>
Parameters:
custId?: number- Customer ID (defaults to authenticated user)
Description: Returns a concise summary of the member’s racing statistics.
const summary = await iracing.stats.memberSummary({ custId: 123456});
console.log('Member summary:', summary);memberYearly(params?)
Section titled “memberYearly(params?)”Get a member’s yearly statistics.
Returns: Promise<StatsMemberYearlyResponse>
Parameters:
custId?: number- Customer ID (defaults to authenticated user)
Description: Returns yearly aggregated statistics for the member.
const yearly = await iracing.stats.memberYearly({ custId: 123456});
yearly.forEach(year => { console.log(`${year.year}: ${year.starts} starts, ${year.wins} wins`);});Season Standings
Section titled “Season Standings”seasonDriverStandings(params)
Section titled “seasonDriverStandings(params)”Get driver standings for a season.
Returns: Promise<StatsSeasonDriverStandingsResponse>
Parameters:
seasonId: number(required) - The season IDcarClassId: number(required) - The car class IDdivision?: number- Filter by divisionraceWeekNum?: number- Standings up to a specific week
Description: Returns driver championship standings for a specific season and car class.
The SDK validates seasonId + carClassId as a known pair before calling the API when validateSemanticParams is enabled.
const standings = await iracing.stats.seasonDriverStandings({ seasonId: 3456, carClassId: 789});
// Filter by divisionconst divStandings = await iracing.stats.seasonDriverStandings({ seasonId: 3456, carClassId: 789, division: 1});seasonSupersessionStandings(params)
Section titled “seasonSupersessionStandings(params)”Get supersession standings for a season.
Returns: Promise<StatsSeasonSupersessionStandingsResponse>
Parameters:
seasonId: number(required) - The season IDcarClassId: number(required) - The car class IDdivision?: number- Filter by divisionraceWeekNum?: number- Standings up to a specific week
Description: Returns supersession standings for a specific season and car class.
The SDK validates seasonId + carClassId as a known pair before calling the API when validateSemanticParams is enabled.
const standings = await iracing.stats.seasonSupersessionStandings({ seasonId: 3456, carClassId: 789});seasonTeamStandings(params)
Section titled “seasonTeamStandings(params)”Get team standings for a season.
Returns: Promise<StatsSeasonTeamStandingsResponse>
Parameters:
seasonId: number(required) - The season IDcarClassId: number(required) - The car class IDraceWeekNum?: number- Standings up to a specific week
Description: Returns team championship standings for a specific season and car class.
The SDK performs an additional semantic preflight check for this endpoint when validateSemanticParams is enabled (default). It verifies that seasonId and carClassId form a known valid pair from series metadata and throws an IRacingError with status 400 before making the request when the pair is invalid.
const teamStandings = await iracing.stats.seasonTeamStandings({ seasonId: 3456, carClassId: 789});Time Trial & Qualifying
Section titled “Time Trial & Qualifying”seasonTtStandings(params)
Section titled “seasonTtStandings(params)”Get time trial standings for a season.
Returns: Promise<StatsSeasonTtStandingsResponse>
Parameters:
seasonId: number(required) - The season IDcarClassId: number(required) - The car class IDdivision?: number- Filter by divisionraceWeekNum?: number- Standings up to a specific week
Description: Returns time trial standings for a specific season and car class.
The SDK validates seasonId + carClassId as a known pair before calling the API when validateSemanticParams is enabled.
const ttStandings = await iracing.stats.seasonTtStandings({ seasonId: 3456, carClassId: 789});seasonTtResults(params)
Section titled “seasonTtResults(params)”Get time trial results for a specific week.
Returns: Promise<StatsSeasonTtResultsResponse>
Parameters:
seasonId: number(required) - The season IDcarClassId: number(required) - The car class IDraceWeekNum: number(required) - The race week numberdivision?: number- Filter by division
Description: Returns time trial results for a specific week in a season.
The SDK validates seasonId + carClassId as a known pair before calling the API when validateSemanticParams is enabled.
const ttResults = await iracing.stats.seasonTtResults({ seasonId: 3456, carClassId: 789, raceWeekNum: 5});seasonQualifyResults(params)
Section titled “seasonQualifyResults(params)”Get qualifying results for a specific week.
Returns: Promise<StatsSeasonQualifyResultsResponse>
Parameters:
seasonId: number(required) - The season IDcarClassId: number(required) - The car class IDraceWeekNum: number(required) - The race week numberdivision?: number- Filter by division
Description: Returns qualifying results for a specific week in a season.
The SDK validates seasonId + carClassId as a known pair before calling the API when validateSemanticParams is enabled.
const qualResults = await iracing.stats.seasonQualifyResults({ seasonId: 3456, carClassId: 789, raceWeekNum: 5});World Records
Section titled “World Records”worldRecords(params)
Section titled “worldRecords(params)”Get world records for a car/track combination.
Returns: Promise<StatsWorldRecordsResponse>
Parameters:
carId: number(required) - The car IDtrackId: number(required) - The track IDseasonYear?: number- Filter by yearseasonQuarter?: number- Filter by quarter (1-4)
Description: Returns the world record lap times for a specific car and track combination.
const records = await iracing.stats.worldRecords({ carId: 123, trackId: 456});
// Filter by seasonconst seasonRecords = await iracing.stats.worldRecords({ carId: 123, trackId: 456, seasonYear: 2024, seasonQuarter: 3});Common Use Cases
Section titled “Common Use Cases”Build a Driver Profile
Section titled “Build a Driver Profile”async function getDriverProfile(custId: number) { const [career, bests, recentRaces, summary] = await Promise.all([ iracing.stats.memberCareer({ custId }), iracing.stats.memberBests({ custId }), iracing.stats.memberRecentRaces({ custId }), iracing.stats.memberSummary({ custId }), ]);
return { career, bests, recentRaces, summary };}Track Season Progress
Section titled “Track Season Progress”async function getSeasonProgress(seasonId: number, carClassId: number) { const [driverStandings, teamStandings, ttStandings] = await Promise.all([ iracing.stats.seasonDriverStandings({ seasonId, carClassId }), iracing.stats.seasonTeamStandings({ seasonId, carClassId }), iracing.stats.seasonTtStandings({ seasonId, carClassId }), ]);
return { driverStandings, teamStandings, ttStandings };}See Also
Section titled “See Also”- Member Service - Member profiles and chart data
- Results Service - Detailed race results
- Driver Stats Service - Category-specific statistics
- Services Overview - All available services