The sports namespace exposes the new Sports API — multi‑sport competition data (football,
basketball, tennis, …) with seasons, stages, groups and standings.
Responses are cached and enriched automatically:
Cached with a stale‑while‑revalidate strategy — repeat reads are served instantly from a local
cache (browser: IndexedDB; server: in‑memory; React Native: AsyncStorage) and refreshed in the
background, so live standings stay up to date without extra round‑trips. The cache TTL is the value
configured for your client in the Management Portal (Features → Cache TTL).
Enriched — each competition is returned with its descriptive metadata (name, branding, assets, …), each stage with its resolved stage name , and each standing with its resolvedcompetitor (team / athlete / national team). Text fields (name, shortName) are localized to the lang you configured (see Configuration ).
Returns a single competition with its season, stages, groups and standings.
ts
sdk.sports.getCompetitionById(
competitionId: string,
filters?: CompetitionByIdFilters,
disableCache?: boolean,
): Promise<CompetitionModel>
Parameter Type Required Description competitionIdstringYes Competition identifier, e.g. "fb:c:1". filtersCompetitionByIdFiltersNo Optional query filters (see below). disableCachebooleanNo When true, bypasses the SDK cache and the server cache and returns a fresh origin response. Defaults to false.
CompetitionByIdFilters
Field Type Description seasonIdstringSeason identifier (e.g. "fb:c:1:2025/26"). Defaults to the current active season when omitted.
ts
import { FansUnitedSDK } from "fansunited-js-sdk";
const sdk = FansUnitedSDK({
apiKey: "<API_KEY>",
clientId: "<CLIENT_ID>",
idSchema: "native",
lang: "en",
});
// Current season
const competition = await sdk.sports.getCompetitionById("fb:c:1");
console.log(competition.name); // "First Professional League" (localized to `lang`)
const stage = competition.season?.stages?.[0];
console.log(stage?.stageNameModel?.name); // "Regular Season"
const standings = stage?.groups?.[0]?.standings ?? [];
standings.forEach((row) => {
console.log(row.rank, row.competitorModel?.name); // 1 "Arda Kardzhali"
});
// A specific season
const past = await sdk.sports.getCompetitionById("fb:c:1", {
seasonId: "fb:c:1:2024/25",
});
// Force a fresh response (skip both SDK and server cache)
const fresh = await sdk.sports.getCompetitionById("fb:c:1", undefined, true);
Field Type Description idstringCompetition ID. sportstringSport, e.g. "FOOTBALL". metaCompetitionMetaModel | nullReferenced entity IDs. seasonSeasonModel | nullSeason with stages and standings. typestring | nullEntity type, e.g. "COMPETITION". contentTypestring | nullContent type keyword. formatstring | nulle.g. "LEAGUE". genderstring | nulle.g. "MALE". namestring | nullCompetition name (localized). shortNamestring | nullShort name (localized). assetsAssetModel[]Keyed assets (e.g. LOGO). brandingCompetitionEntityBrandingModel | nullBrand colors / images. relatedRelatedModel[]Related entities (country, teams, …). providerRefProviderRefModel[]Provider references.
Field Type Description entityIdsstring[]Unique entity IDs referenced in the response (competition + competitors).
Field Type Description idstringSeason ID, e.g. "fb:c:1:2025/26". namestringSeason name. yearstringSeason year. statusstringe.g. "ACTIVE". startDatestringSeason start date. endDatestringSeason end date. stagesStageModel[]Stages within the season.
Field Type Description idstringStage ID. stageNameIdstringStage name ID (e.g. "stn:1"). stageNameModelStageNameModel | nullResolved stage name entity. typestring"standing" or "bracket".statusstringStage status. coveragestringCoverage level. ordernumber | nullOrder within the season. startDatestringStage start date. endDatestringStage end date. groupsGroupModel[] | nullGroups with standings. null for bracket stages.
Field Type Description idnumber | nullGroup ID. null for single‑group stages. namestring | nullGroup name. null for single‑group stages. standingsStandingEntryModel[] | nullStanding rows. null for bracket stages.
Field Type Description ranknumber | nullCurrent rank. lastRanknumber | nullPrevious rank. competitorIdstringCompetitor ID. competitorModelCompetitorModel | nullResolved competitor entity. statsStandingStatModel[]Standing stats (played, won, points, …). rulesstring[]Standing rules.
Field Type Description keystringStat key, e.g. "points". valuestringStat value (string‑encoded), e.g. "76".
Field Type Description idstringStage name ID. namestringStage name (localized). typestringe.g. "STAGE_NAME". providerRefProviderRefModel[]Provider references.
Field Type Description idstringCompetitor ID. sportstringSport. typestringTEAM, ATHLETE or NATIONAL_TEAM.contentTypestringContent type keyword, e.g. "COMPETITOR". genderstring | nullGender. namestringName (localized). fullNamestring | nullFull name. shortNamestring | nullShort name (localized). threeLetterCodestring | null3‑letter code. nicknamestring | nullNickname. assetsAssetModel[]Keyed assets (e.g. LOGO). countryIdstring | nullCountry ID. metadataCompetitorMetadataModel | nullAdditional metadata (branding). additionalInformationany[]Extra information. providerRefProviderRefModel[]Provider references. relatedRelatedModel[]Related entities.
AssetModel — { key: string; value: string } (e.g. { key: "LOGO", value: "https://…png" }).
ProviderRefModel — { provider: string; id: string }.
RelatedModel — { relationship: string; relatedId: string }.
CompetitorMetadataModel — { branding: CompetitorBrandingModel | null }.
CompetitorBrandingModel — { primaryColor, secondaryColor, tertiaryColor: string | null }.
CompetitionEntityBrandingModel — { primaryColor, secondaryColor, textColor, backgroundColor, backgroundGradientFromColor, backgroundGradientToColor, backgroundImage: string | null; shirtColors: any[] }.
The first call for a competition fetches from the network; subsequent calls within the TTL are
served instantly from the local cache.
Once the TTL lapses, the next call still returns instantly (from the cached copy) and refreshes in
the background, so the following call has fresh data.
Pass disableCache: true to force a fresh origin response (bypasses both the SDK cache and the
server cache).
To tune how long the enrichment entities (stage names, competitors, competitions) are cached, use
the cache configuration option .