Quickstart
Get up and running with the NBA 2K Ratings API in under 5 minutes.
1. Get your API key
First, you'll need an API key to authenticate your requests. Click the button below to get started:
Get API Key2. Make your first request
Once you have your API key, you can start making requests. Here's how to fetch a player's data:
const response = await fetch(
'https://api.nba2kapi.com/api/players/slug/lebron-james',
{
headers: {
'X-API-Key': 'your_api_key_here'
}
}
);
const data = await response.json();
if (data.success) {
console.log(data.data.name); // "LeBron James"
console.log(data.data.overall); // 97
console.log(data.data.positions); // ["SF", "PF"]
console.log(data.data.team); // "Los Angeles Lakers"
}
// For players on multiple teams (like Michael Jordan), use team param:
// /api/players/slug/michael-jordan?teamType=class&team='95-'96 Bulls3. Understanding the response
All API responses follow a consistent structure:
{
"success": true,
"data": {
"_id": "abc123",
"name": "LeBron James",
"slug": "lebron-james",
"team": "Los Angeles Lakers",
"teamType": "curr",
"overall": 97,
"positions": ["SF", "PF"],
"height": "6'9\"",
"weight": "250 lbs",
"playerImage": "https://...",
"teamImg": "https://...",
// Detailed attributes
"closeShot": 92,
"midRangeShot": 88,
"threePointShot": 44,
// ... 40+ more attributes
"lastUpdated": "2025-01-15T00:00:00.000Z"
}
}4. Try other endpoints
Now that you've made your first request, explore other endpoints:
- GET /api/players - List all players with filtering
- GET /api/teams - Get all team rosters
- GET /api/players/search - Search for players by name
5. Explore visually in the playground
Not ready to write code yet? Try our interactive playground to explore player data visually with advanced filtering and search.
Next steps
- Learn about authentication best practices
- Explore the full API reference
- Understand rate limits