How to Use Fortnite API: Complete Developer Guide 2025
Learn how to use the Fortnite API to get player stats, FNCS tournament data, leaderboards, and match history. Step-by-step tutorial with code examples.
Introduction: Why Use a Fortnite API?
If you're building a Fortnite stats tracker, Discord bot, or competitive gaming application, you need reliable access to Fortnite player data, match history, and tournament information. A Fortnite API gives you programmatic access to this data without scraping websites or manually collecting stats.
In this comprehensive guide, you'll learn:
- How to get started with a Fortnite API
- Fetching player statistics and match history
- Tracking FNCS tournaments and leaderboards
- Building real-world applications with code examples
- Best practices for caching and rate limiting
By the end, you'll have everything you need to integrate Fortnite data into your application.
Try It Instantly (No Signup Required)
Before diving into the full tutorial, you can test the API right now with our demo key:
curl -H "Authorization: Bearer pk_demo_cito_live_a06c129e0a9ce1c39c3035bd187541c4" \
https://api.citoapi.com/v1/fortnite/matches/live
Demo key limits: 50 calls/day, read-only access. Get your free production key for 500 calls/month.
What Data Can You Get from a Fortnite API?
Before diving into code, let's understand what data is available:
Player Statistics
- Lifetime stats: Total wins, kills, K/D ratio, matches played
- Per-mode stats: Solo, Duo, Squad, and Arena breakdowns
- Seasonal stats: Performance tracking by competitive season
- Recent matches: Last 20+ games with detailed breakdowns
Competitive/FNCS Data
- Tournament standings: Real-time leaderboards during events
- Placement history: Player's tournament results over time
- PR (Power Ranking) points: Competitive ranking scores
- Earnings: Prize money won in official competitions
Match & Event Data
- Live tournament feeds: Real-time updates during FNCS
- Historical match data: Past game details with full stats
- Elimination feeds: Who eliminated whom, with timestamps
Getting Started: Setting Up Your API Access
Step 1: Sign Up for an API Key
First, you'll need an API key. Sign up for Cito API to get instant access—no sales calls or enterprise contracts required.
Step 2: Install Dependencies
For this tutorial, we'll use JavaScript/Node.js, but the concepts apply to any language.
mkdir fortnite-tracker
cd fortnite-tracker
npm init -y
npm install axios dotenv
Create a .env file:
CITO_API_KEY=your_api_key_here
Step 3: Create Your API Client
// api.js
const axios = require('axios');
require('dotenv').config();
const fortniteAPI = axios.create({
baseURL: 'https://api.citoapi.com/v1/fortnite',
headers: {
'x-api-key': process.env.CITO_API_KEY,
'Content-Type': 'application/json'
}
});
module.exports = fortniteAPI;
Fetching Player Statistics
The most common use case is looking up player stats. Here's how to get comprehensive player data:
Basic Player Lookup
const api = require('./api');async function getPlayerStats(username, platform = 'epic') {
try {
const response = await api.get(/players/${encodeURIComponent(username)}, {
params: { platform }
});
return response.data;
} catch (error) {
if (error.response?.status === 404) {
console.log('Player not found');
return null;
}
throw error;
}
}
// Example usage
async function main() {
const stats = await getPlayerStats('Ninja');
if (stats) {
console.log(Player: ${stats.data.username});
console.log(Total Wins: ${stats.data.stats.overall.wins});
console.log(K/D Ratio: ${stats.data.stats.overall.kd});
console.log(Matches Played: ${stats.data.stats.overall.matches});
}
}
main();
Response Structure
{
"success": true,
"data": {
"accountId": "4735ce91...",
"username": "Ninja",
"platform": "epic",
"stats": {
"overall": {
"wins": 1423,
"kills": 89521,
"deaths": 12453,
"kd": 7.19,
"matches": 13876,
"winRate": 10.26,
"killsPerMatch": 6.45
},
"solo": {
"wins": 523,
"kills": 31245,
"kd": 6.89,
"matches": 5123,
"top10": 1823,
"top25": 2912
},
"duo": { ... },
"squad": { ... },
"arena": { ... }
},
"lastUpdated": "2025-01-30T12:00:00Z"
}
}
Getting Player Match History
Want to show recent games? Here's how to fetch match history:
async function getMatchHistory(username, limit = 20) {
const response = await api.get(/players/${encodeURIComponent(username)}/matches, {
params: { limit }
});
return response.data;
}
// Display recent matches
async function showRecentGames(username) {
const history = await getMatchHistory(username, 10);
console.log(\nRecent matches for ${username}:\n);
history.data.forEach((match, i) => {
console.log(Game ${i + 1}: ${match.mode});
console.log( Placement: #${match.placement});
console.log( Kills: ${match.kills});
console.log( Damage: ${match.damageDealt});
console.log( Duration: ${match.duration}\n);
});
}
Tracking FNCS Tournament Data
Competitive Fortnite data is crucial for esports applications. Here's how to access FNCS tournament information:
Listing Active Tournaments
async function getActiveTournaments() {
const response = await api.get('/tournaments', {
params: {
status: 'active',
region: 'NAE'
}
});
return response.data;
}
// Example: Show upcoming FNCS events
async function showFNCSTournaments() {
const tournaments = await getActiveTournaments();
tournaments.data.forEach(event => {
console.log(${event.name});
console.log( Region: ${event.region});
console.log( Start: ${event.startDate});
console.log( Prize Pool: $${event.prizePool.toLocaleString()});
console.log( Format: ${event.format}\n);
});
}
Getting Tournament Leaderboards
async function getTournamentLeaderboard(tournamentId, limit = 100) {
const response = await api.get(/tournaments/${tournamentId}/leaderboard, {
params: { limit }
});
return response.data;
}
// Display top players in a tournament
async function showLeaderboard(tournamentId) {
const leaderboard = await getTournamentLeaderboard(tournamentId, 25);
console.log('FNCS Leaderboard:\n');
console.log('Rank | Player | Points | Wins | Elims');
console.log('-----|-----------------|--------|------|------');
leaderboard.data.forEach(entry => {
console.log(
${entry.rank.toString().padStart(4)} | +
${entry.player.padEnd(15)} | +
${entry.points.toString().padStart(6)} | +
${entry.wins.toString().padStart(4)} | +
${entry.eliminations.toString().padStart(5)}
);
});
}
Building a Complete Stats Tracker
Let's put it all together with a practical example—a player stats tracker:
const api = require('./api');class FortniteTracker {
async getPlayerProfile(username) {
const [stats, history, rankings] = await Promise.all([
this.getStats(username),
this.getMatchHistory(username, 5),
this.getCompetitiveRankings(username)
]);
return {
username,
stats: stats.data,
recentMatches: history.data,
competitive: rankings.data
};
}
async getStats(username) {
return api.get(/players/${encodeURIComponent(username)});
}
async getMatchHistory(username, limit) {
return api.get(/players/${encodeURIComponent(username)}/matches, {
params: { limit }
});
}
async getCompetitiveRankings(username) {
return api.get(/players/${encodeURIComponent(username)}/rankings);
}
async comparePlayers(player1, player2) {
const [p1, p2] = await Promise.all([
this.getPlayerProfile(player1),
this.getPlayerProfile(player2)
]);
return {
player1: p1,
player2: p2,
comparison: {
kdDiff: p1.stats.stats.overall.kd - p2.stats.stats.overall.kd,
winsDiff: p1.stats.stats.overall.wins - p2.stats.stats.overall.wins,
killsDiff: p1.stats.stats.overall.kills - p2.stats.stats.overall.kills
}
};
}
}
// Usage
async function main() {
const tracker = new FortniteTracker();
// Get full player profile
const profile = await tracker.getPlayerProfile('Bugha');
console.log(JSON.stringify(profile, null, 2));
// Compare two players
const comparison = await tracker.comparePlayers('Bugha', 'EpikWhale');
console.log('\nPlayer Comparison:');
console.log(K/D Difference: ${comparison.comparison.kdDiff.toFixed(2)});
}
main();
Building a Discord Bot with Fortnite Stats
Discord bots are one of the most popular ways to use Fortnite APIs. Here's a quick implementation:
const { Client, GatewayIntentBits, EmbedBuilder } = require('discord.js');
const api = require('./api');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent
]
});
client.on('messageCreate', async (message) => {
if (message.author.bot) return;
// !fn stats
if (message.content.startsWith('!fn stats ')) {
const username = message.content.slice(10).trim();
try {
const response = await api.get(/players/${encodeURIComponent(username)});
const stats = response.data.data;
const embed = new EmbedBuilder()
.setTitle(${stats.username}'s Fortnite Stats)
.setColor(0x9146FF)
.addFields(
{ name: 'Wins', value: stats.stats.overall.wins.toString(), inline: true },
{ name: 'K/D', value: stats.stats.overall.kd.toFixed(2), inline: true },
{ name: 'Matches', value: stats.stats.overall.matches.toString(), inline: true },
{ name: 'Win Rate', value: ${stats.stats.overall.winRate.toFixed(1)}%, inline: true },
{ name: 'Kills', value: stats.stats.overall.kills.toLocaleString(), inline: true },
{ name: 'Kills/Match', value: stats.stats.overall.killsPerMatch.toFixed(2), inline: true }
)
.setTimestamp();
message.reply({ embeds: [embed] });
} catch (error) {
message.reply('Player not found or API error occurred.');
}
}
// !fn leaderboard
if (message.content === '!fn leaderboard') {
const response = await api.get('/leaderboards/global', {
params: { limit: 10 }
});
const embed = new EmbedBuilder()
.setTitle('Top 10 Fortnite Players (Global)')
.setColor(0x9146FF);
let description = '';
response.data.data.forEach((player, i) => {
description += ${i + 1}. ${player.username} - ${player.prPoints} PR\n;
});
embed.setDescription(description);
message.reply({ embeds: [embed] });
}
});
client.login(process.env.DISCORD_TOKEN);
Caching Best Practices
To avoid hitting rate limits and improve performance, implement caching:
const NodeCache = require('node-cache');// Cache with 5-minute TTL
const cache = new NodeCache({ stdTTL: 300 });
async function getPlayerStatsCached(username) {
const cacheKey = player:${username.toLowerCase()};
// Check cache first
const cached = cache.get(cacheKey);
if (cached) {
console.log('Cache hit!');
return cached;
}
// Fetch from API
const response = await api.get(/players/${encodeURIComponent(username)});
// Store in cache
cache.set(cacheKey, response.data);
return response.data;
}
When to Cache
| Data Type | Recommended TTL |
|---|---|
| Player lifetime stats | 5-15 minutes |
| Match history | 2-5 minutes |
| Tournament standings | 30-60 seconds |
| Live match data | No cache (real-time) |
Error Handling
Robust error handling ensures your app stays reliable:
async function safeApiCall(fn) {
try {
return await fn();
} catch (error) {
if (error.response) {
switch (error.response.status) {
case 404:
return { error: 'Player not found', code: 404 };
case 429:
console.log('Rate limited, retrying in 60s...');
await new Promise(r => setTimeout(r, 60000));
return safeApiCall(fn);
case 500:
return { error: 'Server error, try again later', code: 500 };
default:
return { error: 'Unknown error', code: error.response.status };
}
}
throw error;
}
}
// Usage
const stats = await safeApiCall(() =>
api.get(/players/${username})
);
if (stats.error) {
console.log(Error: ${stats.error});
} else {
console.log(stats.data);
}
Common Use Cases
1. Stats Website/App
Build a Fortnite stats tracker like FortniteTracker.com with player lookups, leaderboards, and match history.
2. Discord Bot
Create commands for your gaming community to look up stats, compare players, and track FNCS tournaments.
3. Competitive Team Tools
Help esports teams analyze player performance, track improvement over time, and scout opponents.
4. Streaming Overlays
Display real-time stats on Twitch/YouTube streams using OBS browser sources.
5. Fantasy Esports
Build fantasy league platforms with live scoring during FNCS events.
Pricing: What Does a Fortnite API Cost?
Unlike enterprise APIs that require sales calls and $500+/month contracts, Cito API offers transparent pricing:
| Plan | Price | Requests/Month | Best For |
|---|---|---|---|
| Free | $0 | 500 | Learning & testing |
| Basic | $20 | 50,000 | Side projects |
| Pro | $50 | 250,000 | Production apps |
| Business | $200 | 2,000,000 | High-traffic sites |
Getting Started Today
Ready to build with Fortnite data? Here's your action plan:
Conclusion
Using a Fortnite API opens up countless possibilities for developers. Whether you're building a stats tracker, Discord bot, or competitive esports platform, having reliable access to player data, match history, and tournament information is essential.
With Cito API, you get:
- Instant access - No sales calls or enterprise contracts
- Comprehensive data - Player stats, match history, FNCS tournaments
- Developer-friendly - Clear docs, code examples, fair pricing
- Reliable infrastructure - 99.9% uptime SLA
Stop waiting weeks for API access. Get your free API key now and start building today.
---
*Have questions? Check out our documentation or reach out on Discord.*
---
Related reading:
- Tracking FNCS Tournament Data in Real-Time — Build a live leaderboard for FNCS events using webhooks
- How to Build a Discord Bot with Esports Data — Add real-time stat commands to your Discord server
- API Rate Limiting Best Practices — Keep your Fortnite app fast under load
Ready to Build?
Get your API key and start building with esports data in minutes.