How to Track Fortnite Player Stats in Real-Time
Learn how to use the Fortnite API to build a real-time player stats tracker. Covers endpoints, data structures, and implementation tips.
tutorialplayer-statsreal-time
Why Track Player Stats?
Fortnite player stats are some of the most requested data points for gaming apps, Discord bots, and streaming overlays. With the Fortnite API, you can access detailed statistics for any player across all platforms.
The Player Stats Endpoint
The primary endpoint for player stats is:
GET /v1/stats/:platform/:usernameWhere :platform is one of pc, psn, xbl, or touch, and :username is the player's Epic Games display name.
Example Response
A typical response includes:
Building a Real-Time Tracker
To track stats in real-time, you'll want to:
Implementation Example (JavaScript)
const API_KEY = process.env.FORTNITE_API_KEY;
const BASE_URL = "https://api-fortnite.com";
async function getPlayerStats(platform, username) {
const response = await fetch(
`${BASE_URL}/v1/stats/${platform}/${encodeURIComponent(username)}`,
{ headers: { Authorization: API_KEY } }
);
return response.json();
}
// Fetch stats for a player
const stats = await getPlayerStats("pc", "Ninja");
console.log(`Wins: ${stats.data.overall.wins}`);