API Documentation
Welcome to the Realtime Sports API documentation. This API provides real-time access to NFL and College Football data including events, plays, penalties, teams, officials, and athletes.
Base URL
https://api.realtimesportsapi.comAuthentication
All API requests require authentication using JWT tokens. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEYNote: Get your API key from the dashboard.
Rate Limits
Rate limits vary by subscription tier. All limits reset daily at midnight EST.
| Tier | Calls/Day | Calls/Second |
|---|---|---|
| Free | 1,000 | 1 |
| Starter | 10,000 | 5 |
| Pro | 50,000 | 20 |
| Enterprise | Unlimited | 100+ |
API Structure
The API follows a hierarchical structure: Sport → League → Resource
/api/v1/sports
/{sport}/leagues
/{league}
/teams # All teams in league
/athletes # All athletes (paginated)
/{athleteId} # Single athlete
/seasons # Historical seasons
/{year} # Season details
/events # All events
/live # Live events only
/{eventId} # Single event
/plays # Play-by-play (paginated)
/penalties # Penalties onlySports & Leagues
/v1/sportsGet all available sports.
Example Request
curl -X GET "https://api.realtimesportsapi.com/api/v1/sports" \
-H "Authorization: Bearer YOUR_API_KEY"Example Response
{
"success": true,
"data": [
{
"id": "20",
"name": "Football",
"slug": "football",
"displayName": "Football"
},
{
"id": "40",
"name": "Basketball",
"slug": "basketball",
"displayName": "Basketball"
}
]
}/v1/sports/:sport/leaguesGet all leagues for a specific sport.
Example Request
curl -X GET "https://api.realtimesportsapi.com/api/v1/sports/football/leagues" \
-H "Authorization: Bearer YOUR_API_KEY"Example Response
{
"success": true,
"data": [
{
"id": "28",
"name": "National Football League",
"slug": "nfl",
"abbreviation": "NFL",
"currentSeason": 2025
},
{
"id": "35",
"name": "NCAA Football",
"slug": "college-football",
"abbreviation": "NCAA"
}
]
}Teams
/sports/{sport}/leagues/{league}/teamsGet all teams for a league.
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/baseball/leagues/mlb/teams" \
-H "Authorization: Bearer YOUR_API_KEY"Response Includes
- ✓ Team names, abbreviations, slugs
- ✓ Logos (default & dark theme, proxied)
- ✓ Team colors (hex codes)
- ✓ Venue information (stadium, capacity)
- ✓ Records and standings
Athletes
/sports/{sport}/leagues/{league}/athletesGet all athletes for a league (paginated).
Note: MLB has 36,000+ athletes. Always use pagination!
Query Parameters
page- Page number (default: 1)limit- Results per page (default: 25)
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/baseball/leagues/mlb/athletes?page=1&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"/sports/{sport}/leagues/{league}/athletes/{athleteId}Get single athlete by ID.
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/baseball/leagues/mlb/athletes/30836" \
-H "Authorization: Bearer YOUR_API_KEY"Response Includes
- ✓ Full name, position, jersey number
- ✓ Headshot (proxied image)
- ✓ Team affiliation
- ✓ Age and stats availability
Seasons
/sports/{sport}/leagues/{league}/seasonsGet all seasons for a league (historical data).
Note: MLB has 150+ seasons dating back to 1870s!
Query Parameters
page- Page number (default: 1)limit- Results per page (default: 25)
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/football/leagues/nfl/seasons?limit=5" \
-H "Authorization: Bearer YOUR_API_KEY"/sports/{sport}/leagues/{league}/seasons/{year}Get details for a specific season.
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/baseball/leagues/mlb/seasons/2025" \
-H "Authorization: Bearer YOUR_API_KEY"Response Includes
- ✓ Season year and display name
- ✓ Current season type (preseason, regular, postseason, offseason)
- ✓ Start and end dates
- ✓ All season types with dates
Events
/sports/{sport}/leagues/{league}/eventsGet all events for a league.
Query Parameters
limit- Results per page (default: 50)
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/football/leagues/nfl/events?limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"/sports/{sport}/leagues/{league}/events/liveGet currently live events only.
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/football/leagues/nfl/events/live" \
-H "Authorization: Bearer YOUR_API_KEY"Example Response
{
"success": true,
"data": [
{
"id": "401772982",
"name": "Buffalo Bills at Denver Broncos",
"shortName": "BUF @ DEN",
"date": "2026-01-17T21:30Z",
"status": {
"state": "in",
"period": 3,
"clock": "10:45"
},
"homeTeam": {
"id": "7",
"name": "Denver Broncos",
"abbreviation": "DEN",
"logo": "/api/images/proxy?url=...",
"color": "0a2343",
"score": 21
},
"awayTeam": {
"id": "2",
"name": "Buffalo Bills",
"abbreviation": "BUF",
"score": 17
},
"venue": {
"name": "Empower Field at Mile High",
"city": "Denver",
"state": "CO"
}
}
]
}/sports/{sport}/leagues/{league}/events/{eventId}Get single event with full details.
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/football/leagues/nfl/events/401772982" \
-H "Authorization: Bearer YOUR_API_KEY"Plays & Pagination
/sports/{sport}/leagues/{league}/events/{eventId}/playsGet plays for an event (paginated - games can have 200+ plays).
Query Parameters
page- Page number (default: 1)limit- Plays per page (default: 25, max: 100)
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/football/leagues/nfl/events/401772982/plays?page=1&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"Example Response
{
"success": true,
"data": [
{
"id": "40177298265",
"text": "B.Nix pass to P.Bryant for 12 yards",
"type": { "id": "24", "text": "Pass Reception" },
"period": 1,
"clock": { "displayValue": "14:56" },
"situation": {
"down": 1,
"distance": 10,
"yardLine": 26,
"downDistanceText": "1st & 10 at DEN 26"
},
"yardsGained": 12,
"athletes": [
{ "type": "passer", "order": 1 },
{ "type": "receiver", "order": 2 }
]
}
],
"meta": {
"pagination": {
"page": 1,
"pageSize": 25,
"total": 213,
"totalPages": 9,
"hasNextPage": true
}
}
}/sports/{sport}/leagues/{league}/events/{eventId}/penaltiesGet penalties only from an event.
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/football/leagues/nfl/events/401772982/penalties" \
-H "Authorization: Bearer YOUR_API_KEY"JavaScript Example
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.realtimesportsapi.com/api/v1';
// Discover sports and leagues
async function discoverAPI() {
// Get all sports
const sports = await fetch(`${BASE_URL}/sports`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
}).then(r => r.json());
console.log('Sports:', sports.data);
// Get football leagues
const leagues = await fetch(`${BASE_URL}/sports/football/leagues`, {
headers: { 'Authorization': `Bearer ${API_KEY}` }
}).then(r => r.json());
console.log('Leagues:', leagues.data);
}
// Get live NFL games
async function getLiveNFLGames() {
const response = await fetch(
`${BASE_URL}/sports/football/leagues/nfl/events/live`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
const data = await response.json();
if (data.success) {
console.log('Live games:', data.data);
}
}
// Get plays with pagination
async function getPlays(eventId, page = 1) {
const response = await fetch(
`${BASE_URL}/sports/football/leagues/nfl/events/${eventId}/plays?page=${page}&limit=25`,
{ headers: { 'Authorization': `Bearer ${API_KEY}` } }
);
const data = await response.json();
console.log(`Page ${page}: ${data.data.length} plays`);
console.log(`Total: ${data.meta.pagination.total} plays`);
return data;
}
// Get all plays (all pages)
async function getAllPlays(eventId) {
const allPlays = [];
let page = 1;
let hasMore = true;
while (hasMore) {
const response = await getPlays(eventId, page);
allPlays.push(...response.data);
hasMore = response.meta.pagination.hasNextPage;
page++;
}
return allPlays;
}
// Usage
discoverAPI();
getLiveNFLGames();
getAllPlays('401772982').then(plays => {
console.log(`Fetched ${plays.length} total plays`);
});Teams & Athletes
/sports/{sport}/leagues/{league}/teamsGet all teams for a league.
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/baseball/leagues/mlb/teams" \
-H "Authorization: Bearer YOUR_API_KEY"Response Includes
- ✓ Team names, abbreviations, colors
- ✓ Logos (proxied through our CDN)
- ✓ Venue information
- ✓ Records and standings
/sports/{sport}/leagues/{league}/athletesGet athletes (paginated - MLB has 36,000+!).
Example Request
curl "https://api.realtimesportsapi.com/api/v1/sports/baseball/leagues/mlb/athletes?page=1&limit=25" \
-H "Authorization: Bearer YOUR_API_KEY"Special Features
Image Proxying
All images (team logos, athlete headshots) are automatically proxied through our CDN. No ESPN URLs in responses!
// Team logos are proxied
"logo": "https://api.realtimesportsapi.com/api/images/proxy?url=..."
// Direct image access (no auth required)
<img src="/api/images/proxy?url=..." alt="Team Logo" />Pagination Best Practices
- ✓ Plays: Default 25 per page (games have 200+ plays)
- ✓ Athletes: Default 25 per page (MLB: 36,000+)
- ✓ Check
hasNextPagein meta - ✓ Use
totalPagesto show progress
Rate Limit Headers
Check these headers in every response:
X-RateLimit-Limit: 50000
X-RateLimit-Remaining: 49995
X-RateLimit-Reset: 1642636800000 // Unix timestampPython Example
import requests
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'https://api.realtimesportsapi.com/api/v1'
class RealtimeSportsAPI:
def __init__(self, api_key):
self.api_key = api_key
self.base_url = BASE_URL
self.headers = {'Authorization': f'Bearer {api_key}'}
def get_sports(self):
"""Get all available sports"""
response = requests.get(f'{self.base_url}/sports', headers=self.headers)
return response.json()['data']
def get_leagues(self, sport):
"""Get leagues for a sport"""
response = requests.get(
f'{self.base_url}/sports/{sport}/leagues',
headers=self.headers
)
return response.json()['data']
def get_live_games(self, sport, league):
"""Get live games for a league"""
response = requests.get(
f'{self.base_url}/sports/{sport}/leagues/{league}/events/live',
headers=self.headers
)
return response.json()['data']
def get_plays(self, sport, league, event_id, page=1, limit=25):
"""Get plays for an event (paginated)"""
response = requests.get(
f'{self.base_url}/sports/{sport}/leagues/{league}/events/{event_id}/plays',
params={'page': page, 'limit': limit},
headers=self.headers
)
return response.json()
# Usage
api = RealtimeSportsAPI(API_KEY)
# Discover sports
sports = api.get_sports()
print(f"Available sports: {[s['name'] for s in sports]}")
# Get live NFL games
nfl_games = api.get_live_games('football', 'nfl')
for game in nfl_games:
print(f"{game['name']}: {game['awayTeam']['score']} - {game['homeTeam']['score']}")
# Get plays with pagination
plays_response = api.get_plays('football', 'nfl', '401772982', page=1)
print(f"Page 1: {len(plays_response['data'])} plays")
print(f"Total: {plays_response['meta']['pagination']['total']} plays")
print(f"Total pages: {plays_response['meta']['pagination']['totalPages']}")