@yaelouuu/fortnite-api 6.1.0 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { FortniteAPI } from "../client";
2
- import { EventWindows, PlayerEventHistory, TournamentDetails, ScoringRules, EventLeaderboard, PlayerEventData, EligibilityStatus, PlayerEligibilityResult, ArenaHype, EventRewards } from "../types";
2
+ import { EventWindows, PlayerEventHistory, TournamentDetails, ScoringRules, EventLeaderboard, PlayerEventData, EventRewards, PlayerTokensResponse } from "../types";
3
3
  /**
4
4
  * Events Resource
5
5
  * Handles tournament and competitive events data
@@ -58,32 +58,13 @@ export declare class EventsResource {
58
58
  */
59
59
  getPlayerEventData(eventId: string, eventWindowId: string, accountId: string, fortniteToken?: string): Promise<PlayerEventData>;
60
60
  /**
61
- * Get parsed tournament eligibility requirements.
62
- * No user token needed requirements are extracted from tournament metadata.
63
- * @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
64
- * @param eventWindowId - Optional: filter to a specific event window
65
- * @returns Parsed eligibility requirements
61
+ * Get the raw token set for one or more players.
62
+ * Tokens are eligibility flags earned by participating in tournaments
63
+ * (e.g. qualifying tokens, ban tokens).
64
+ * No user token required uses service auth.
65
+ * @param accountIds - One or more Epic account IDs
66
66
  */
67
- checkEligibility(eventId: string, eventWindowId?: string): Promise<EligibilityStatus>;
68
- /**
69
- * Check a player's eligibility against tournament requirements.
70
- * Cross-references ranked data with tournament requirements — no user token needed.
71
- * @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
72
- * @param accountId - Epic Games Account ID to check
73
- * @param options - Optional platform and eventWindowId
74
- * @returns Player eligibility check results
75
- */
76
- checkPlayerEligibility(eventId: string, accountId: string, options?: {
77
- platform?: string;
78
- eventWindowId?: string;
79
- }): Promise<PlayerEligibilityResult>;
80
- /**
81
- * Get Arena hype and division
82
- * @param accountId - Account ID
83
- * @param fortniteToken - Optional user Fortnite token
84
- * @returns Arena hype, division, and progress
85
- */
86
- getArenaHype(accountId: string, fortniteToken?: string): Promise<ArenaHype>;
67
+ getPlayerTokens(accountIds: string | string[]): Promise<PlayerTokensResponse>;
87
68
  /**
88
69
  * Get event rewards/prizes
89
70
  * @param eventId - Event ID
@@ -95,45 +95,16 @@ class EventsResource {
95
95
  return this.client.request(`/events/${eventId}/windows/${eventWindowId}/players/${accountId}`, { headers }, "v2");
96
96
  }
97
97
  /**
98
- * Get parsed tournament eligibility requirements.
99
- * No user token needed requirements are extracted from tournament metadata.
100
- * @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
101
- * @param eventWindowId - Optional: filter to a specific event window
102
- * @returns Parsed eligibility requirements
98
+ * Get the raw token set for one or more players.
99
+ * Tokens are eligibility flags earned by participating in tournaments
100
+ * (e.g. qualifying tokens, ban tokens).
101
+ * No user token required uses service auth.
102
+ * @param accountIds - One or more Epic account IDs
103
103
  */
104
- async checkEligibility(eventId, eventWindowId) {
105
- const query = eventWindowId ? `?eventWindowId=${eventWindowId}` : "";
106
- return this.client.request(`/events/${eventId}/eligibility${query}`, {}, "v2");
107
- }
108
- /**
109
- * Check a player's eligibility against tournament requirements.
110
- * Cross-references ranked data with tournament requirements — no user token needed.
111
- * @param eventId - Event ID (e.g. epicgames_S39_RankedCupDuosBR_ASIA)
112
- * @param accountId - Epic Games Account ID to check
113
- * @param options - Optional platform and eventWindowId
114
- * @returns Player eligibility check results
115
- */
116
- async checkPlayerEligibility(eventId, accountId, options) {
117
- const params = new URLSearchParams();
118
- if (options?.platform)
119
- params.set("platform", options.platform);
120
- if (options?.eventWindowId)
121
- params.set("eventWindowId", options.eventWindowId);
122
- const query = params.toString() ? `?${params.toString()}` : "";
123
- return this.client.request(`/events/${eventId}/eligibility/${accountId}${query}`, {}, "v2");
124
- }
125
- /**
126
- * Get Arena hype and division
127
- * @param accountId - Account ID
128
- * @param fortniteToken - Optional user Fortnite token
129
- * @returns Arena hype, division, and progress
130
- */
131
- async getArenaHype(accountId, fortniteToken) {
132
- const headers = {};
133
- if (fortniteToken) {
134
- headers["x-fortnite-token"] = fortniteToken;
135
- }
136
- return this.client.request(`/events/arena/${accountId}`, { headers }, "v2");
104
+ async getPlayerTokens(accountIds) {
105
+ const ids = Array.isArray(accountIds) ? accountIds : [accountIds];
106
+ const qs = ids.map(encodeURIComponent).join("%2C");
107
+ return this.client.request(`/events/tokens?teamAccountIds=${qs}`, {}, "v1");
137
108
  }
138
109
  /**
139
110
  * Get event rewards/prizes
@@ -1,15 +1,49 @@
1
1
  import { FortniteAPI } from "../client";
2
+ import { ProfileLevel, RankedProgress, TrackDefinition } from "../types";
2
3
  export declare class ProfilesResource {
3
4
  private client;
4
5
  constructor(client: FortniteAPI);
5
6
  /**
6
- * Get profile progress (track progress, levels) by display name
7
- * @param displayName - Epic Games display name
7
+ * Get raw Habanero track progress for a single account. Public — no token required.
8
+ * @param accountId - Epic account ID
9
+ */
10
+ getProgress(accountId: string): Promise<any>;
11
+ /**
12
+ * Get a player's XP, level, accountLevel, and battle pass tier.
13
+ * Parsed from QueryProfile (profileId=athena) on the MCP service.
14
+ * Requires the player's own Fortnite OAuth token — cannot be used for other accounts.
15
+ * @param accountId - Epic account ID
16
+ * @param fortniteToken - User's Fortnite OAuth token (required)
8
17
  */
9
- getProgress(displayName: string): Promise<any>;
18
+ getLevel(accountId: string, fortniteToken: string): Promise<ProfileLevel>;
10
19
  /**
11
- * Get enriched ranked progress by display name (human-readable ranks, game modes, season dates)
20
+ * Get enriched ranked progress human-readable rank names, game mode labels, season dates.
12
21
  * @param displayName - Epic Games display name
13
22
  */
14
- getRanked(displayName: string): Promise<any>;
23
+ getRanked(displayName: string): Promise<RankedProgress[]>;
24
+ /**
25
+ * Get all available ranked game mode tracks — modes, division counts, and season dates.
26
+ * @param options - Optional filters
27
+ */
28
+ getTracks(options?: {
29
+ /** ISO 8601 — only return tracks ending before this date */
30
+ endsBefore?: string;
31
+ /** ISO 8601 — only return tracks ending after this date */
32
+ endsAfter?: string;
33
+ }): Promise<TrackDefinition[]>;
34
+ /**
35
+ * Get ranked track progress for multiple account IDs in one request (L3AGUE bulk endpoint).
36
+ * @param accountIds - Array of Epic account IDs
37
+ */
38
+ getBulkTrackProgress(accountIds: string[]): Promise<any[]>;
39
+ /**
40
+ * Get a Habanero game leaderboard centered around an account.
41
+ * @param gameId - Habanero game identifier (e.g. "HazelnutSpread")
42
+ * @param accountId - Epic account ID to center the leaderboard around
43
+ * @param options - Query options
44
+ */
45
+ getGameLeaderboard(gameId: string, accountId: string, options?: {
46
+ fromIndex?: number;
47
+ findTeams?: boolean;
48
+ }): Promise<any>;
15
49
  }
@@ -6,18 +6,66 @@ class ProfilesResource {
6
6
  this.client = client;
7
7
  }
8
8
  /**
9
- * Get profile progress (track progress, levels) by display name
10
- * @param displayName - Epic Games display name
9
+ * Get raw Habanero track progress for a single account. Public — no token required.
10
+ * @param accountId - Epic account ID
11
+ */
12
+ async getProgress(accountId) {
13
+ return this.client.request(`/profile/progress?accountId=${encodeURIComponent(accountId)}`);
14
+ }
15
+ /**
16
+ * Get a player's XP, level, accountLevel, and battle pass tier.
17
+ * Parsed from QueryProfile (profileId=athena) on the MCP service.
18
+ * Requires the player's own Fortnite OAuth token — cannot be used for other accounts.
19
+ * @param accountId - Epic account ID
20
+ * @param fortniteToken - User's Fortnite OAuth token (required)
11
21
  */
12
- async getProgress(displayName) {
13
- return this.client.request(`/profile/progress?displayName=${encodeURIComponent(displayName)}`);
22
+ async getLevel(accountId, fortniteToken) {
23
+ return this.client.request(`/profile/level?accountId=${encodeURIComponent(accountId)}`, { headers: { "x-fortnite-token": fortniteToken } });
14
24
  }
15
25
  /**
16
- * Get enriched ranked progress by display name (human-readable ranks, game modes, season dates)
26
+ * Get enriched ranked progress human-readable rank names, game mode labels, season dates.
17
27
  * @param displayName - Epic Games display name
18
28
  */
19
29
  async getRanked(displayName) {
20
30
  return this.client.request(`/profile/ranked?displayName=${encodeURIComponent(displayName)}`);
21
31
  }
32
+ /**
33
+ * Get all available ranked game mode tracks — modes, division counts, and season dates.
34
+ * @param options - Optional filters
35
+ */
36
+ async getTracks(options) {
37
+ const params = new URLSearchParams();
38
+ if (options?.endsBefore)
39
+ params.append("endsBefore", options.endsBefore);
40
+ if (options?.endsAfter)
41
+ params.append("endsAfter", options.endsAfter);
42
+ const qs = params.toString();
43
+ return this.client.request(`/profile/tracks${qs ? `?${qs}` : ""}`);
44
+ }
45
+ /**
46
+ * Get ranked track progress for multiple account IDs in one request (L3AGUE bulk endpoint).
47
+ * @param accountIds - Array of Epic account IDs
48
+ */
49
+ async getBulkTrackProgress(accountIds) {
50
+ return this.client.request("/profile/trackprogress/bulk", {
51
+ method: "POST",
52
+ headers: { "Content-Type": "application/json" },
53
+ body: JSON.stringify(accountIds),
54
+ });
55
+ }
56
+ /**
57
+ * Get a Habanero game leaderboard centered around an account.
58
+ * @param gameId - Habanero game identifier (e.g. "HazelnutSpread")
59
+ * @param accountId - Epic account ID to center the leaderboard around
60
+ * @param options - Query options
61
+ */
62
+ async getGameLeaderboard(gameId, accountId, options) {
63
+ const params = new URLSearchParams({ accountId });
64
+ if (options?.fromIndex != null)
65
+ params.append("fromIndex", String(options.fromIndex));
66
+ if (options?.findTeams != null)
67
+ params.append("findTeams", String(options.findTeams));
68
+ return this.client.request(`/profile/leaderboard/${encodeURIComponent(gameId)}?${params.toString()}`, { method: "POST", headers: { "Content-Type": "application/json" }, body: "{}" });
69
+ }
22
70
  }
23
71
  exports.ProfilesResource = ProfilesResource;
@@ -15,8 +15,10 @@ export declare class StatsResource {
15
15
  * @returns Player statistics
16
16
  */
17
17
  getPlayerStats(accountId: string, options?: {
18
- startDate?: string;
19
- endDate?: string;
18
+ /** Unix timestamp (e.g. 1773900001). NOT an ISO date string. */
19
+ startTime?: string | number;
20
+ /** Unix timestamp (e.g. 1782950340). NOT an ISO date string. */
21
+ endTime?: string | number;
20
22
  stats?: string[];
21
23
  }, fortniteToken?: string): Promise<PlayerStats>;
22
24
  /**
@@ -22,10 +22,10 @@ class StatsResource {
22
22
  headers["x-fortnite-token"] = fortniteToken;
23
23
  }
24
24
  const queryParams = new URLSearchParams();
25
- if (options?.startDate)
26
- queryParams.append("startDate", options.startDate);
27
- if (options?.endDate)
28
- queryParams.append("endDate", options.endDate);
25
+ if (options?.startTime)
26
+ queryParams.append("startTime", String(options.startTime));
27
+ if (options?.endTime)
28
+ queryParams.append("endTime", String(options.endTime));
29
29
  if (options?.stats)
30
30
  queryParams.append("stats", options.stats.join(","));
31
31
  const query = queryParams.toString();
@@ -1,5 +1,5 @@
1
1
  import { FortniteAPI } from "../client";
2
- import { Leaderboard, TournamentTrackerResponse, TournamentEligibilityResponse } from "../types";
2
+ import { Leaderboard, TournamentTrackerResponse, TournamentEligibilityResponse, EventTokenEligibilityResponse } from "../types";
3
3
  export declare class TournamentsResource {
4
4
  private client;
5
5
  constructor(client: FortniteAPI);
@@ -81,6 +81,25 @@ export declare class TournamentsResource {
81
81
  days?: number;
82
82
  requiredTournaments?: number;
83
83
  }): Promise<TournamentEligibilityResponse>;
84
+ /**
85
+ * Check a player's token eligibility for a specific event window.
86
+ *
87
+ * Verifies all token requirements (requireAllTokens, requireAnyTokens,
88
+ * requireNoneTokensCaller, etc.) using the Epic tokens endpoint — no player
89
+ * auth needed. Hardware/system requirements and MFA are always listed as
90
+ * unverified since they cannot be checked remotely.
91
+ *
92
+ * Accepts a display name or an Epic account ID (with or without dashes).
93
+ *
94
+ * @param identifier - Player display name or Epic account ID
95
+ * @param eventId - Epic event ID (e.g. `"epicgames_S40_FNCSMajor1_LCQ_EU"`)
96
+ * @param options.eventWindowId - Optional window ID; defaults to the most relevant window (live → upcoming → latest ended)
97
+ * @param options.fortniteToken - Optional user Fortnite token for future extended checks
98
+ */
99
+ checkEventEligibility(identifier: string, eventId: string, options?: {
100
+ eventWindowId?: string;
101
+ fortniteToken?: string;
102
+ }): Promise<EventTokenEligibilityResponse>;
84
103
  /**
85
104
  * Get tournament leaderboard using V2 endpoint (POST with teams body)
86
105
  *
@@ -128,6 +128,33 @@ class TournamentsResource {
128
128
  },
129
129
  });
130
130
  }
131
+ /**
132
+ * Check a player's token eligibility for a specific event window.
133
+ *
134
+ * Verifies all token requirements (requireAllTokens, requireAnyTokens,
135
+ * requireNoneTokensCaller, etc.) using the Epic tokens endpoint — no player
136
+ * auth needed. Hardware/system requirements and MFA are always listed as
137
+ * unverified since they cannot be checked remotely.
138
+ *
139
+ * Accepts a display name or an Epic account ID (with or without dashes).
140
+ *
141
+ * @param identifier - Player display name or Epic account ID
142
+ * @param eventId - Epic event ID (e.g. `"epicgames_S40_FNCSMajor1_LCQ_EU"`)
143
+ * @param options.eventWindowId - Optional window ID; defaults to the most relevant window (live → upcoming → latest ended)
144
+ * @param options.fortniteToken - Optional user Fortnite token for future extended checks
145
+ */
146
+ async checkEventEligibility(identifier, eventId, options) {
147
+ const query = new URLSearchParams();
148
+ if (options?.eventWindowId) {
149
+ query.append("eventWindowId", options.eventWindowId);
150
+ }
151
+ const qs = query.toString();
152
+ const path = `/events/tracker/eligibility/${encodeURIComponent(identifier)}/${encodeURIComponent(eventId)}${qs ? `?${qs}` : ""}`;
153
+ const requestOptions = options?.fortniteToken
154
+ ? { headers: { "x-fortnite-token": options.fortniteToken } }
155
+ : undefined;
156
+ return this.client.request(path, requestOptions);
157
+ }
131
158
  /**
132
159
  * Get tournament leaderboard using V2 endpoint (POST with teams body)
133
160
  *
@@ -214,6 +214,36 @@ export interface TournamentEligibilityResponse {
214
214
  newest_tournament_date: string | null;
215
215
  recent_tournaments: TournamentTrackerEntry[];
216
216
  }
217
+ export type TokenRequirementType = "mustHave" | "mustHaveAny" | "mustNotHave";
218
+ export type TokenGroupType = "requireAllTokens" | "requireAnyTokens" | "requireNoneTokensCaller" | "requireAllTokensCaller" | "requireAnyTokensCaller";
219
+ export interface VerifiedRequirement {
220
+ token: string;
221
+ label: string;
222
+ type: TokenRequirementType;
223
+ tokenGroup: TokenGroupType;
224
+ met: boolean;
225
+ }
226
+ export interface UnverifiedRequirement {
227
+ type: "accountLevel" | "systemFeature" | "mfa";
228
+ key: string;
229
+ label: string;
230
+ description: string;
231
+ /** Only present for accountLevel requirements */
232
+ threshold?: number;
233
+ /** Only present for accountLevel requirements */
234
+ estimatedCurrentLevel?: number | null;
235
+ /** Only present for accountLevel requirements */
236
+ estimatedMet?: boolean | null;
237
+ }
238
+ export interface EventTokenEligibilityResponse {
239
+ accountId: string;
240
+ displayName: string;
241
+ eventId: string;
242
+ eventWindowId: string;
243
+ isEligible: boolean;
244
+ verifiedRequirements: VerifiedRequirement[];
245
+ unverifiedRequirements: UnverifiedRequirement[];
246
+ }
217
247
  export interface SeasonEntry {
218
248
  chapter: number;
219
249
  season: number;
@@ -454,6 +484,47 @@ export interface SuggestedFriend {
454
484
  displayName?: string;
455
485
  mutualFriends?: number;
456
486
  }
487
+ export interface ProfileLevel {
488
+ accountId: string;
489
+ /** Current season level */
490
+ level: number | null;
491
+ /** Current season XP */
492
+ xp: number | null;
493
+ /** Cumulative lifetime account level across all seasons — used for eligibility requirements */
494
+ accountLevel: number | null;
495
+ battlePass: {
496
+ tier: number | null;
497
+ xp: number | null;
498
+ purchased: boolean;
499
+ };
500
+ }
501
+ export interface RankedProgress {
502
+ trackguid: string;
503
+ rankingType: string | null;
504
+ gameMode: string;
505
+ seasonId: string | null;
506
+ seasonBegin: string | null;
507
+ seasonEnd: string | null;
508
+ isCurrent: boolean;
509
+ currentDivision: number;
510
+ currentRank: string;
511
+ highestDivision: number;
512
+ highestRank: string;
513
+ rankProgress: number | null;
514
+ unrealRank: number | null;
515
+ }
516
+ export interface TrackDefinition {
517
+ trackguid: string;
518
+ trackId: string;
519
+ rankingType: string;
520
+ divisionCount: number;
521
+ beginTime: string | null;
522
+ endTime: string | null;
523
+ [key: string]: any;
524
+ }
525
+ export interface PlayerTokensResponse {
526
+ [accountId: string]: string[];
527
+ }
457
528
  export interface PlayerStats {
458
529
  accountId: string;
459
530
  stats: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yaelouuu/fortnite-api",
3
- "version": "6.1.0",
4
- "description": "SDK for Fortnite Tournaments API by Royal Arena - Author : Yael Brinkert",
3
+ "version": "7.0.0",
4
+ "description": "SDK for Fortnite API - api-fortnite.com - Author : Yael Brinkert",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {