Member Service
Member Service
Section titled “Member Service”The Member service provides access to member profiles, statistics, awards, and participation data.
const memberService = iracing.member;Methods
Section titled “Methods”info()
Section titled “info()”Get information about the authenticated member.
Returns: Promise<MemberInfoResponse>
Parameters: None
Description: Returns detailed information about the currently authenticated member including profile data, licenses, and account status.
const info = await iracing.member.info();
console.log(info.displayName); // "John Doe"console.log(info.custId); // 123456console.log(info.memberSince); // "2020-01-15"console.log(info.licenses); // Array of license objectsinterface MemberInfoResponse { custId: number; displayName: string; firstName: string; lastName: string; memberSince: string; clubs: Club[]; licenses: License[]; helmet: HelmetPattern; suit: SuitPattern; // ... more fields}get(params)
Section titled “get(params)”Get information about specific members by customer ID.
Returns: Promise<MemberGetResponse>
Parameters:
custIds: number[]- Array of customer IDs (max 50)includeLicenses?: boolean- Include license information
Description: Fetches profile information for up to 50 members at once.
const members = await iracing.member.get({ custIds: [123456, 789012, 345678], includeLicenses: true});
members.members.forEach(member => { console.log(`${member.displayName}: iR ${member.irating}`);});interface MemberGetResponse { members: Array<{ custId: number; displayName: string; irating: number; licenses: License[]; // ... more fields }>; success: boolean;}profile(params)
Section titled “profile(params)”Get public profile information for a member.
Returns: Promise<MemberProfileResponse>
Parameters:
custId: number- Customer ID
Description: Returns public profile data visible to other members.
const profile = await iracing.member.profile({ custId: 123456});
console.log(profile.stats.careerStats.wins);console.log(profile.stats.careerStats.totalClubPoints);awards(params)
Section titled “awards(params)”Get member’s earned awards and achievements.
Returns: Promise<MemberAwardsResponse>
Parameters:
custId: number- Customer ID
Description: Lists all awards and achievements earned by the member.
const awards = await iracing.member.awards({ custId: 123456});
awards.awards.forEach(award => { console.log(`${award.awardName}: ${award.awardCount}x`);});awardInstances(params)
Section titled “awardInstances(params)”Get specific instances of awards earned.
Returns: Promise<MemberAwardInstancesResponse>
Parameters:
custId: number- Customer IDawardId?: number- Specific award ID to filter
Description: Returns detailed information about when and how awards were earned.
const instances = await iracing.member.awardInstances({ custId: 123456, awardId: 5 // Championship award});
instances.forEach(instance => { console.log(`Earned on: ${instance.awardedDate}`); console.log(`Season: ${instance.seasonName}`);});chartData(params)
Section titled “chartData(params)”Get chart data for member statistics over time.
Returns: Promise<MemberChartDataResponse>
Parameters:
custId: number- Customer IDcategoryId: number- Category ID (1=Oval, 2=Road, 3=Dirt Oval, 4=Dirt Road)chartType: number- Type of chart data
Description: Returns time-series data for graphing member performance.
const chartData = await iracing.member.chartData({ custId: 123456, categoryId: 2, // Road chartType: 1 // iRating over time});
chartData.data.forEach(point => { console.log(`${point.date}: ${point.value}`);});participationCredits()
Section titled “participationCredits()”Get participation credit balance for the authenticated member.
Returns: Promise<MemberParticipationCreditsResponse>
Parameters: None
Description: Returns the current balance of participation credits earned through racing.
const credits = await iracing.member.participationCredits();
console.log(`Available credits: ${credits.participationCredits}`);console.log(`Total earned: ${credits.totalEarned}`);console.log(`Total redeemed: ${credits.totalRedeemed}`);Common Use Cases
Section titled “Common Use Cases”Get Complete Member Profile
Section titled “Get Complete Member Profile”async function getCompleteProfile(custId: number) { const [member, profile, awards, recentRaces] = await Promise.all([ iracing.member.get({ custIds: [custId] }), iracing.member.profile({ custId }), iracing.member.awards({ custId }), iracing.stats.memberRecentRaces({ custId }) ]);
return { basic: member.members[0], profile: profile, awards: awards.awards, recentRaces: recentRaces.races };}Monitor iRating Changes
Section titled “Monitor iRating Changes”async function trackIRatingChange(custId: number, categoryId: number) { const chartData = await iracing.member.chartData({ custId, categoryId, chartType: 1 // iRating chart });
const recent = chartData.data.slice(-10); // Last 10 data points const change = recent[recent.length - 1].value - recent[0].value;
console.log(`iRating change over last 10 races: ${change > 0 ? '+' : ''}${change}`);}Check License Progress
Section titled “Check License Progress”async function checkLicenseProgress(custId: number) { const member = await iracing.member.get({ custIds: [custId], includeLicenses: true });
member.members[0].licenses.forEach(license => { const sr = license.safetyRating / 100; // Convert to decimal const nextLevel = Math.ceil(sr); const progress = ((sr % 1) * 100).toFixed(0);
console.log(`${license.categoryName}:`); console.log(` Class ${license.licenseLevel} - SR: ${sr.toFixed(2)}`); console.log(` Progress to Class ${String.fromCharCode(65 + nextLevel)}: ${progress}%`); });}Error Handling
Section titled “Error Handling”try { const info = await iracing.member.info();} catch (error) { if (error instanceof IRacingError) { if (error.isUnauthorized) { console.error('Not authenticated'); } else if (error.status === 404) { console.error('Member not found'); } }}Rate Limiting
Section titled “Rate Limiting”Type Definitions
Section titled “Type Definitions”All methods return fully typed responses. Key types include:
MemberInfoResponse- Complete member informationMemberGetResponse- Public member dataLicense- License level and safety ratingClub- Club membership informationAward- Achievement and award data
See Also
Section titled “See Also”- Stats Service - For member statistics
- Results Service - For race results
- League Service - For league membership