@yaelouuu/fortnite-api 5.1.0 → 6.1.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.
package/dist/client.d.ts CHANGED
@@ -49,9 +49,9 @@ export declare class FortniteAPI {
49
49
  /**
50
50
  * Internal method to make HTTP requests
51
51
  */
52
- request<T>(endpoint: string, options?: RequestInit, version?: "v1" | "v2" | "v3"): Promise<T>;
52
+ request<T>(endpoint: string, options?: RequestInit, version?: "v1" | "v2"): Promise<T>;
53
53
  /**
54
54
  * Internal method for multipart/form-data requests (file uploads)
55
55
  */
56
- requestMultipart<T>(endpoint: string, formData: FormData, version?: "v1" | "v2" | "v3"): Promise<T>;
56
+ requestMultipart<T>(endpoint: string, formData: FormData, version?: "v1" | "v2"): Promise<T>;
57
57
  }
@@ -51,4 +51,9 @@ export declare class AccountResource {
51
51
  * @param fortniteToken - Optional user Fortnite token
52
52
  */
53
53
  getExternalAuth(accountId: string, platform: string, fortniteToken?: string): Promise<ExternalAuth>;
54
+ /**
55
+ * Resolve one or more Epic account IDs to their display names
56
+ * @param accountIds - Array of Epic Games account IDs (comma-separated, max 100)
57
+ */
58
+ getDisplayNames(accountIds: string[]): Promise<Account[]>;
54
59
  }
@@ -99,5 +99,13 @@ class AccountResource {
99
99
  }
100
100
  return this.client.request(`/account/${accountId}/externalAuths/${platform}`, { headers }, "v1");
101
101
  }
102
+ /**
103
+ * Resolve one or more Epic account IDs to their display names
104
+ * @param accountIds - Array of Epic Games account IDs (comma-separated, max 100)
105
+ */
106
+ async getDisplayNames(accountIds) {
107
+ const ids = accountIds.join(",");
108
+ return this.client.request(`/account/displaynames?ids=${encodeURIComponent(ids)}`, {}, "v1");
109
+ }
102
110
  }
103
111
  exports.AccountResource = AccountResource;
@@ -9,7 +9,7 @@ class BattlePassResource {
9
9
  * Get current battle pass items
10
10
  */
11
11
  async getBattlePass() {
12
- return this.client.request("/battlepass");
12
+ return this.client.request("/shop/battlepass");
13
13
  }
14
14
  }
15
15
  exports.BattlePassResource = BattlePassResource;
@@ -1,27 +1,15 @@
1
1
  import { FortniteAPI } from "../client";
2
- import { Profile, ProfileStats } from "../types";
3
2
  export declare class ProfilesResource {
4
3
  private client;
5
4
  constructor(client: FortniteAPI);
6
5
  /**
7
- * Get profile progress (ranked divisions, levels) by display name
6
+ * Get profile progress (track progress, levels) by display name
8
7
  * @param displayName - Epic Games display name
9
8
  */
10
9
  getProgress(displayName: string): Promise<any>;
11
10
  /**
12
- * Get profile stats by display name
11
+ * Get enriched ranked progress by display name (human-readable ranks, game modes, season dates)
13
12
  * @param displayName - Epic Games display name
14
- * @param timeWindow - Time period: "season" or "lifetime" (default: "lifetime")
15
13
  */
16
- getStats(displayName: string, timeWindow?: "season" | "lifetime"): Promise<ProfileStats>;
17
- /**
18
- * Get account info by ID
19
- * @param accountId - Epic Games Account ID
20
- */
21
- getAccount(accountId: string): Promise<Profile>;
22
- /**
23
- * Get multiple display names by account IDs
24
- * @param accountIds - Array of account IDs (max 100)
25
- */
26
- getDisplayNames(accountIds: string[]): Promise<Record<string, string>>;
14
+ getRanked(displayName: string): Promise<any>;
27
15
  }
@@ -6,39 +6,18 @@ class ProfilesResource {
6
6
  this.client = client;
7
7
  }
8
8
  /**
9
- * Get profile progress (ranked divisions, levels) by display name
9
+ * Get profile progress (track progress, levels) by display name
10
10
  * @param displayName - Epic Games display name
11
11
  */
12
12
  async getProgress(displayName) {
13
13
  return this.client.request(`/profile/progress?displayName=${encodeURIComponent(displayName)}`);
14
14
  }
15
15
  /**
16
- * Get profile stats by display name
16
+ * Get enriched ranked progress by display name (human-readable ranks, game modes, season dates)
17
17
  * @param displayName - Epic Games display name
18
- * @param timeWindow - Time period: "season" or "lifetime" (default: "lifetime")
19
18
  */
20
- async getStats(displayName, timeWindow) {
21
- const params = new URLSearchParams({
22
- displayName,
23
- });
24
- if (timeWindow)
25
- params.set("timeWindow", timeWindow);
26
- return this.client.request(`/profile/stats?${params.toString()}`);
27
- }
28
- /**
29
- * Get account info by ID
30
- * @param accountId - Epic Games Account ID
31
- */
32
- async getAccount(accountId) {
33
- return this.client.request(`/account/${accountId}`);
34
- }
35
- /**
36
- * Get multiple display names by account IDs
37
- * @param accountIds - Array of account IDs (max 100)
38
- */
39
- async getDisplayNames(accountIds) {
40
- const ids = accountIds.join(",");
41
- return this.client.request(`/displaynames/multiple?ids=${encodeURIComponent(ids)}`);
19
+ async getRanked(displayName) {
20
+ return this.client.request(`/profile/ranked?displayName=${encodeURIComponent(displayName)}`);
42
21
  }
43
22
  }
44
23
  exports.ProfilesResource = ProfilesResource;
@@ -29,7 +29,7 @@ export declare class QuestsResource {
29
29
  *
30
30
  * **Authentication**: Requires user's personal Fortnite OAuth token
31
31
  *
32
- * **API Version**: v3
32
+ * **API Version**: v2
33
33
  *
34
34
  * **Rate Limit**: Standard API rate limits apply
35
35
  *
@@ -31,7 +31,7 @@ class QuestsResource {
31
31
  *
32
32
  * **Authentication**: Requires user's personal Fortnite OAuth token
33
33
  *
34
- * **API Version**: v3
34
+ * **API Version**: v2
35
35
  *
36
36
  * **Rate Limit**: Standard API rate limits apply
37
37
  *
@@ -56,7 +56,7 @@ class QuestsResource {
56
56
  headers: {
57
57
  "x-fortnite-token": fortniteToken,
58
58
  },
59
- }, "v3");
59
+ }, "v2");
60
60
  }
61
61
  }
62
62
  exports.QuestsResource = QuestsResource;
@@ -33,12 +33,26 @@ export declare class TournamentsResource {
33
33
  }, fortniteToken: string): Promise<any>;
34
34
  /**
35
35
  * Get tournament leaderboard
36
- * @param params.eventId - Event ID
37
- * @param params.eventWindowId - Event window ID
36
+ *
37
+ * The `leaderboardDef` parameter serves two distinct purposes depending on the tournament type:
38
+ *
39
+ * **1. Ranked Cup (rank-tier leaderboards)**
40
+ * Pass the rank-tier def ID found in `eventWindow.metadata.defaultLeaderboardByRank`.
41
+ * The server resolves this to a different internal window ID to return rank-filtered results.
42
+ * Example: `"ranked_br_division_7"`
43
+ *
44
+ * **2. Cumulative leaderboard**
45
+ * Pass the cumulative def ID found in `eventWindow.scoreLocations` where
46
+ * `isMainWindowLeaderboard === false`. The server forwards this as Epic's `sm=` query param,
47
+ * returning the combined leaderboard across all sessions in the same group (e.g. Day 1 + Day 2).
48
+ * Example: `"S40_FNCSMajor1_PlayInStage_CumulativeLeaderboardDef"`
49
+ *
50
+ * @param params.eventId - Event ID (e.g. `"epicgames_S40_FNCSMajor1_PlayInStage_EU"`)
51
+ * @param params.eventWindowId - Event window ID (e.g. `"S40_FNCSMajor1_PlayInStage_Day1_EU"`)
38
52
  * @param params.page - Page number (default: 0)
39
- * @param params.leaderboardDef - Optional leaderboard definition
40
- * @param params.accountId - Optional account ID to highlight
41
- * @param fortniteToken - Optional user's Fortnite token for personalized view
53
+ * @param params.leaderboardDef - Optional leaderboard definition ID (Ranked Cup tier or cumulative def)
54
+ * @param params.accountId - Optional account ID highlights that player in the response
55
+ * @param fortniteToken - Optional user's Fortnite access token for personalized view
42
56
  */
43
57
  getLeaderboard(params: {
44
58
  eventId: string;
@@ -49,12 +49,26 @@ class TournamentsResource {
49
49
  }
50
50
  /**
51
51
  * Get tournament leaderboard
52
- * @param params.eventId - Event ID
53
- * @param params.eventWindowId - Event window ID
52
+ *
53
+ * The `leaderboardDef` parameter serves two distinct purposes depending on the tournament type:
54
+ *
55
+ * **1. Ranked Cup (rank-tier leaderboards)**
56
+ * Pass the rank-tier def ID found in `eventWindow.metadata.defaultLeaderboardByRank`.
57
+ * The server resolves this to a different internal window ID to return rank-filtered results.
58
+ * Example: `"ranked_br_division_7"`
59
+ *
60
+ * **2. Cumulative leaderboard**
61
+ * Pass the cumulative def ID found in `eventWindow.scoreLocations` where
62
+ * `isMainWindowLeaderboard === false`. The server forwards this as Epic's `sm=` query param,
63
+ * returning the combined leaderboard across all sessions in the same group (e.g. Day 1 + Day 2).
64
+ * Example: `"S40_FNCSMajor1_PlayInStage_CumulativeLeaderboardDef"`
65
+ *
66
+ * @param params.eventId - Event ID (e.g. `"epicgames_S40_FNCSMajor1_PlayInStage_EU"`)
67
+ * @param params.eventWindowId - Event window ID (e.g. `"S40_FNCSMajor1_PlayInStage_Day1_EU"`)
54
68
  * @param params.page - Page number (default: 0)
55
- * @param params.leaderboardDef - Optional leaderboard definition
56
- * @param params.accountId - Optional account ID to highlight
57
- * @param fortniteToken - Optional user's Fortnite token for personalized view
69
+ * @param params.leaderboardDef - Optional leaderboard definition ID (Ranked Cup tier or cumulative def)
70
+ * @param params.accountId - Optional account ID highlights that player in the response
71
+ * @param fortniteToken - Optional user's Fortnite access token for personalized view
58
72
  */
59
73
  async getLeaderboard(params, fortniteToken) {
60
74
  const { eventId, eventWindowId, page = 0, leaderboardDef, accountId, } = params;
@@ -85,7 +99,7 @@ class TournamentsResource {
85
99
  * @param fortniteToken - User's Fortnite access token (from OAuth flow)
86
100
  */
87
101
  async getTracker(accountId, fortniteToken) {
88
- return this.client.request(`/tournament-tracker?accountId=${accountId}`, {
102
+ return this.client.request(`/events/tracker?accountId=${accountId}`, {
89
103
  headers: {
90
104
  "x-fortnite-token": fortniteToken,
91
105
  },
@@ -108,7 +122,7 @@ class TournamentsResource {
108
122
  if (options?.requiredTournaments) {
109
123
  params.append("requiredTournaments", options.requiredTournaments.toString());
110
124
  }
111
- return this.client.request(`/tournament-eligibility?${params.toString()}`, {
125
+ return this.client.request(`/events/tracker/eligibility?${params.toString()}`, {
112
126
  headers: {
113
127
  "x-fortnite-token": fortniteToken,
114
128
  },
@@ -43,7 +43,7 @@ class WeaponsResource {
43
43
  * Get rarity definitions (colors, display names, backend values)
44
44
  */
45
45
  async getRarityDefinitions() {
46
- return this.client.request("/rarity", {}, "v2");
46
+ return this.client.request("/weapons/rarity", {}, "v2");
47
47
  }
48
48
  }
49
49
  exports.WeaponsResource = WeaponsResource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaelouuu/fortnite-api",
3
- "version": "5.1.0",
3
+ "version": "6.1.0",
4
4
  "description": "SDK for Fortnite Tournaments API by Royal Arena - Author : Yael Brinkert",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",