Api Config


The API Config page is the central hub for connecting the plugin to a sports data API and controlling how data is fetched, stored, and updated. It contains six sections: API Configuration, Import Options, Media & Images, Highlights, Live Scores, and Background Sync.

Admin Menu: API & Import > API Config

Full API Config page overview showing API Configuration, Import Options, and Media sections with Test Connection and Save buttons at bottom

🔑 API Configuration

Core connection settings for the external API.

API Configuration section showing API Key field, Provider dropdown, Sports checkbox grid with status labels, and Cache toggle
SettingOptionsDefaultDescription
API KeyText inputYour RapidAPI key (required)
API ProviderAllSportsAPI2 / BasketAPI1 / BaseballAPIAllSportsAPI2Which API host to use
SportsCheckboxesNoneWhich sports to enable (Basketball, Baseball, etc.)
Cache API RequestsOn / OffOnCache API responses using transients to reduce API calls

API Provider

The provider setting is global (not per-sport). All three providers share the same endpoint structure but use different RapidAPI hosts:

ProviderBest For
AllSportsAPI2 (Multi-sport)Multiple sports — recommended for most users
BasketAPI1Basketball only
BaseballAPIBaseball only

Choose AllSportsAPI2 if you plan to use more than one sport. Single-sport providers may offer better pricing for that sport alone.

Test Connection

Click Test Connection to validate your API key. A successful test displays the provider name and confirms the key is active. If the test fails, check that:

  • The key is copied correctly (no leading/trailing spaces)
  • Your RapidAPI subscription is active
  • The selected provider matches your RapidAPI subscription

Sport Selection

Enable only the sports you need. Each enabled sport appears in the admin interface and creates its own permalink structure. Disabling a sport hides it from the import and admin interfaces but does not delete existing data. Sports show their current status — Basketball and Baseball are fully supported, others show “In Development” or “Planned”.

📥 Import Options

Controls what data is fetched when importing finished game details. These settings apply to all game detail imports (manual and scheduled). Match details are always fetched.

Import Options section with toggle switches for Player Statistics, Team Statistics, Scoring Timeline, Video Highlights, and Update Post Modified Date
SettingDefaultDescription
Player StatisticsOnBox scores and individual player performance
Team StatisticsOnTeam totals by period (includes overtime)
Scoring TimelineOffPlay-by-play scoring events
Video HighlightsOffHighlight clips (when available from API)
Update Post Modified DateOnTouch post_modified when data changes (for sitemaps and page cache)

API Cost

With all four data sub-options enabled, each finished game requires up to 5 API calls. With only Player Statistics enabled, it requires 2 calls per game. Start with Player Statistics and Team Statistics, then add others as needed.

🖼️ Media & Images

Controls automatic downloading of images from the API. Images are downloaded once on first import and saved as optimized WebP (50×50 and 150×150). Each image uses one API request.

Media and Images section with licensing disclaimer, Team Logos, League Logos, Player Photos, Manager Photos toggles, Custom Logos link, Manage Media button, and GD/Imagick requirement note
SettingDefaultDescription
Team LogosOnDownload team logos during import
League LogosOnDownload league logos during import
Player PhotosOffDownload player headshots during import
Manager PhotosOffDownload manager/coach photos during import

Server requirement: Your server must have GD or Imagick with WebP support (standard since WordPress 5.8+). A status indicator shows whether image processing is available.

Custom Logos: You can upload your own logos via the Custom Logos page — these override API images and work even with downloads disabled.

Manage Media: Click the “Manage Media” button to bulk remove or re-fetch logos and photos from the API, filtered by entity type and sport.

Highlights

Controls automatic fetching of YouTube video highlights for finished games.

Highlights section with Auto-Fetch Highlights toggle and Lookback Window dropdown set to 3 days
SettingOptionsDefaultDescription
Auto-Fetch HighlightsOn / OffOnDaily cron fetches YouTube highlights for recently finished games
Lookback Window3 / 5 / 7 days3 daysHow far back to search for games needing highlights. Highlights typically appear 24-48h after the game

When enabled, a daily background task searches for finished games that don’t have highlights yet and attempts to fetch YouTube video IDs from the API. Videos are validated before saving — dead or unavailable videos are automatically skipped.

📡 Live Scores

Real-time score updates during active games. When enabled, the plugin polls the API at regular intervals for games in progress.

Live Scores section showing Enable toggle, backend and frontend poll intervals, Live Detail Options, Scope selector, and Estimated Daily API Calls info box
SettingOptionsDefaultDescription
Enable Live ImportOn / OffOffAutomatically poll for live scores via WP Cron
Score Poll Interval60 / 120 seconds60sHow often to check for live score updates
Detail Poll Interval120 / 300 seconds120sHow often to fetch detailed stats for live games
Frontend Score Poll15 / 30 / 45 / 60 seconds30sHow often visitors’ browsers poll for score updates
Frontend Detail Poll2 / 3 / 5 minutes2 minHow often visitors’ browsers poll for detailed sections (timeline, stats, charts)

Live Detail Options

Additional data fetched during live polling (each adds API calls per live game):

SettingDefaultDescription
Team StatisticsOffUpdate team stats during game
Player StatisticsOffUpdate box scores during game
Scoring TimelineOffUpdate play-by-play events during game

Scope & Estimated Cost

Choose whether to poll all imported leagues or only selected ones. If you follow only a few leagues, set Scope to “Selected” and pick those leagues to reduce API usage.

The page shows an estimated daily API call count based on your settings, the typical active window (~6 hours), and the approximate number of simultaneous live games. A paid API plan with unlimited daily requests is recommended for live polling.

See Live Scores for the full guide on how live scoring works (backend pipeline + frontend polling).

🔄 Background Sync

Automatic data updates via WordPress Cron. When enabled, the plugin periodically syncs all imported seasons — active seasons get full sync, completed seasons are skipped.

Background Sync section with Enable toggle and 6 sync tasks with individual toggles and interval dropdowns: Game Details, Standings, Schedule, New Fixtures, Team Rosters, Brackets
TaskOptionsDefaultWhat It Does
Game DetailsEvery 6 / 12 hours6hFetches scores, lineups, and stats for finished games
StandingsEvery 12 / 24 hours12hUpdates league standings and rankings
ScheduleEvery 12 / 24 hours12hSyncs kickoff times, venue changes, postponements
New FixturesEvery 24 / 48 hours24hDiscovers newly added games
Team RostersEvery 7 / 14 days7 daysUpdates player lists and injury status
BracketsEvery 12 / 24 hours12hUpdates playoff bracket results

Recommendation

Enable Game Details (6h) and Standings (12h) as a baseline. Add Schedule and New Fixtures if you display upcoming games. Rosters can run at 7 days since roster changes are less time-sensitive. A paid API plan with unlimited daily requests is recommended.

See Background Sync for detailed task descriptions.

Saving Changes

A sticky bar at the bottom of the page contains two buttons:

  • Save Settings — saves all changes across all sections
  • Test Connection — tests the API key without saving

Changes are not applied until you click Save Settings. The page does not auto-save.

📚 Related