Clients

The client classes are the main way to interact with the Fortnite API. They provide all the methods to get data from the API. It’s through them that you are served most every object in this library.

There are two main clients you can use to interact with the API: the Client and the SyncClient. The Client is the main client and is the one you should use in most cases. It is asynchronous and uses the aiohttp library to make requests. The SyncClient is a synchronous client that uses the requests library to make requests. It is useful if you are working in a synchronous environment or if you don’t want to deal with the complexity of asynchronous programming.

Both clients have the same methods and return the same objects. The only difference is that the Client has asynchronous methods and the SyncClient has synchronous methods.

class fortnite_api.Client(api_key=None, *, default_language=GameLanguage.ENGLISH, session=None, beta=False, response_flags=<ResponseFlags.INCLUDE_NOTHING: 0>)

Represents a Fortnite API Client. This is the main class used to interact with the Fortnite API.

async with x:

This class is can be used as a context manager. This will automatically open and close the HTTP session for you. If you don’t use the async with statement, you will have to manually close the session. See Client Context Managers for more information.

Parameters:
  • api_key (Optional[str]) – The API key to use for the client. If not provided, some endpoints may not be available. An API key can be generated using the FortniteAPI website.

  • default_language (Optional[fortnite_api.GameLanguage]) – The default language to display the data in. Defaults to ENGLISH if not provided.

  • session (Optional[aiohttp.ClientSession]) – The session to use for the HTTP requests. If not provided, a new session will be created for you and you must use the class as an async context manager.

  • beta (bool) –

    Whether the client can make requests to the beta API. Any beta endpoints will not be available if this is set to False. Defaults to False. This is to prevent accidental usage of beta endpoints.

    Note

    All beta endpoints are prefixed with beta_.

  • response_flags (ResponseFlags) – Denotes the standard response flags to use for all requests that support them. Defaults to INCLUDE_NOTHING.

default_language

The default language set for the client.

Type:

fortnite_api.GameLanguage

beta

Denotes if the client can make requests to beta endpoints.

Type:

bool

response_flags

The standard response flags to use for all requests that support them.

Type:

ResponseFlags

await fetch_cosmetics_all(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched cosmetics.

Return type:

fortnite_api.CosmeticsAll

await fetch_cosmetics_br(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all Battle Royale cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched Battle Royale cosmetics.

Return type:

List[fortnite_api.CosmeticBr]

await fetch_cosmetics_cars(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all Car cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched car cosmetics.

Return type:

List[fortnite_api.CosmeticCar]

await fetch_cosmetics_instruments(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all instrument cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched instruments.

Return type:

List[fortnite_api.CosmeticInstrument]

await fetch_cosmetics_lego_kits(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all lego kit cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched lego kits.

Return type:

List[fortnite_api.CosmeticLegoKit]

await fetch_variants_lego(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all lego cosmetic variants available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched lego cosmetic variants.

Return type:

List[fortnite_api.VariantLego]

await fetch_variants_beans(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all bean cosmetic variants available in Fortnite. For more information on what a bean is, see fortnite_api.VariantBean.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched bean cosmetic variants.

Return type:

List[fortnite_api.VariantBean]

await fetch_cosmetics_tracks(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all audio track cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched audio tracks.

Return type:

List[fortnite_api.CosmeticTrack]

await fetch_cosmetic_br(cosmetic_id, *, language=..., response_flags=...)

This function is a coroutine.

Fetch a specific Battle Royale cosmetic by its ID.

Parameters:
  • cosmetic_id (str) – The ID of the cosmetic to fetch.

  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The cosmetic fetched.

Return type:

fortnite_api.CosmeticBr

Raises:

NotFound – A cosmetic with that ID was not found.

await fetch_cosmetics_new(*, language=..., response_flags=...)

This function is a coroutine.

Fetches all new cosmetics recently made available in Fortnite. This encompasses all cosmetic types available in the game.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched new cosmetics.

Return type:

fortnite_api.NewCosmetics

await search_br_cosmetics(**kwargs)

This function is a coroutine.

Searches all Battle Royale cosmetics available in Fortnite and returns the best match(es) based on the search criteria. Passing any of the parameters to this function will filter the search results.

Parameters:
  • multiple (Optional[bool]) – Denotes if multiple matches should be returned. If this is True then a list of matches will be returned. If False, then only the best match will be returned. Defaults to False.

  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

  • search_language (Optional[fortnite_api.GameLanguage]) – The language to use for the search. Will override the default language set on the client. Defaults to the client’s default_language or fortnite_api.GameLanguage.ENGLISH.

  • match_method (Optional[fortnite_api.MatchMethod]) – The method to use for matching the search query. Defaults to FULL.

  • id (Optional[str]) – The ID of the cosmetic.

  • name (Optional[str]) – The name of the cosmetic.

  • description (Optional[str]) – The description of the cosmetic.

  • type (Optional[fortnite_api.CosmeticType]) – The cosmetic’s type.

  • type_display (Optional[str]) – The display type of the cosmetic.

  • type_backend (Optional[str]) – The backend type of the cosmetic.

  • rarity (Optional[fortnite_api.CosmeticRarity]) – The rarity of the cosmetic.

  • rarity_display (Optional[str]) – The display rarity of the cosmetic.

  • rarity_backend (Optional[str]) – The backend rarity of the cosmetic.

  • has_series (Optional[bool]) – If the cosmetic has a series.

  • series (Optional[str]) – The series of the cosmetic.

  • series_backend (Optional[str]) – The backend series of the cosmetic.

  • has_set (Optional[bool]) – If the cosmetic has a set.

  • set (Optional[str]) – The set of the cosmetic.

  • set_text (Optional[str]) – The text of the set of the cosmetic.

  • set_backend (Optional[str]) – The backend set of the cosmetic.

  • has_introduction (Optional[bool]) – If the cosmetic has an introduction.

  • introduction_backend (Optional[str]) – The backend introduction value of the cosmetic.

  • introduction_chapter (Optional[str]) – The chapter when the cosmetic was introduced.

  • introduction_season (Optional[str]) – The season that the cosmetic was introduced.

  • has_featured_image (Optional[bool]) – If the cosmetic has a featured image.

  • has_variants (Optional[bool]) – If the cosmetic has variants.

  • gameplay_tag (Optional[str]) – A gameplay tag of the cosmetic.

  • has_meta_tags (Optional[bool]) – If the cosmetic has meta tags.

  • has_dynamic_pak_id (Optional[bool]) – If the cosmetic has a dynamic pak ID.

  • dynamic_pak_id (Optional[str]) – The dynamic pak ID of the cosmetic.

  • added (Optional[datetime.datetime]) – The date when the cosmetic was added.

  • added_since (Optional[datetime.datetime]) – The date since the cosmetic was added.

  • unseen_for (Optional[int]) – The amount, in days, that the cosmetic has been unseen.

  • last_appearance (Optional[datetime.datetime]) – The last appearance of the cosmetic.

Raises:

NotFound – No cosmetics were found with the search criteria.

await fetch_aes(*, key_format=KeyFormat.HEX)

This function is a coroutine.

Fetches the AES key used to decrypt encrypted data from Fortnite.

Parameters:

key_format (fortnite_api.KeyFormat) – The format to return the key in. Defaults to HEX.

Returns:

The fetched AES key.

Return type:

fortnite_api.Aes

await fetch_banners(*, language=...)

This function is a coroutine.

Fetch all banners available in Fortnite.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the banners in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched banners.

Return type:

List[fortnite_api.Banner]

await fetch_banner_colors()

This function is a coroutine.

Fetch all banner colors available in Fortnite.

Returns:

The fetched banner colors.

Return type:

List[fortnite_api.BannerColor]

await fetch_creator_code(*, name)

This function is a coroutine.

Fetch information about a creator code in Fortnite from the creator code name.

Parameters:

name (str) – The name of the creator code to fetch.

Returns:

The fetched creator code.

Return type:

fortnite_api.CreatorCode

Raises:

NotFound – A creator code with that name was not found.

await fetch_map(*, language=...)

This function is a coroutine.

Fetches the current map of Fortnite.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the map in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched map.

Return type:

fortnite_api.Map

await fetch_news(*, language=...)

This function is a coroutine.

Fetch the news for Fortnite. This includes all news for all game modes.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the news in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched news.

Return type:

fortnite_api.News

await fetch_news_br(*, language=...)

This function is a coroutine.

Fetches the current Battle Royale news.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the news in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The Battle Royale news.

Return type:

fortnite_api.GameModeNews

await fetch_news_stw(*, language=...)

This function is a coroutine.

Fetches the current Save the World news.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the news in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The Save the World news.

Return type:

fortnite_api.GameModeNews

await fetch_playlists(*, language=...)

This function is a coroutine.

Fetches a list of current playlists available in Fortnite.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the playlists in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched current playlists available in Fortnite.

Return type:

List[fortnite_api.Playlist]

await fetch_playlist(id, /, *, language=...)

This function is a coroutine.

Fetch a specific playlist by its ID.

Parameters:
  • id (str) – The ID of the playlist to fetch.

  • language (Optional[fortnite_api.GameLanguage]) – The language to display the playlist in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched playlist.

Return type:

fortnite_api.Playlist

Raises:

NotFound – A playlist with that ID was not found.

await fetch_br_stats(*, name=None, account_id=None, type=AccountType.EPIC, time_window=TimeWindow.LIFETIME, image=StatsImageType.NONE)

This function is a coroutine.

Fetch stats for a Fortnite player by their name.

Note

The ratelimit for this endpoint is max 3 requests per second, 180 per minute.

Parameters:
  • name (Optional[str]) – The name of the player to fetch stats for. Cannot be used with account_id.

  • account_id (Optional[str]) – The account ID of the player to fetch stats for. Cannot be used with name.

  • type (Optional[fortnite_api.AccountType]) – The type of account to search statistics for. This parameter is only to narrow the search when fetching account stats by name. It will not do anything when fetching by account_id. Defaults to fortnite_api.AccountType.EPIC.

  • time_window (Optional[fortnite_api.TimeWindow]) – The time window to search statistics for. Defaults to LIFETIME.

  • image (Optional[fortnite_api.StatsImageType]) – The type of image to display in the statistics. Defaults to NONE. If this is set to fortnite_api.StatsImageType.NONE, there will be no image in the response.

Returns:

The fetched player statistics.

Return type:

fortnite_api.BrPlayerStats

Raises:
  • NotFound – A player with that name was not found.

  • ValueError – You cannot pass both a name and an account_id to fetch stats at the same time, or, you must pass either a name or an account_id to fetch stats.

  • RateLimited – The rate limit for this endpoint has been exceeded.

  • MissingAPIKey – The client does not have an API key set to fetch player stats.

await fetch_shop(*, language=..., response_flags=...)

This function is a coroutine.

Fetches the current Fortnite item shop.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the playlist in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched item shop.

Return type:

fortnite_api.Shop

await beta_fetch_material_instances()

This function is a coroutine.

Fetches all the material instances available in Fortnite.

Note

This is a beta method. This cannot be called unless beta is set to True in the client.

Warning

At any time, for any reason, this method could break - either from local parsing errors or upstream API changes. Always be prepared for this. It is highly recommended to wrap this method in a try/except block to catch any exceptions that may be raised.

try:
    instances = await client.beta_fetch_material_instances()
except fortnite_api.BetaUnknownException as exc:
    # Any exception raised from beta methods will be wrapped in BetaUnknownException,
    # get the root cause of the exception with exc.original.
    original = exc.original
    print(f"An unknown error occurred: {original}")
else:
    print(instances)
Returns:

The fetched material instances.

Return type:

List[fortnite_api.MaterialInstance]

Raises:
  • BetaAccessNotEnabled – The client does not have beta access enabled through beta.

  • BetaUnknownException – An unknown error occurred while fetching the material instances. This could be due to an issue with the API or the client. Any unknown errors raised will be wrapped in this exception.

class fortnite_api.SyncClient(api_key=None, *, default_language=GameLanguage.ENGLISH, session=None, beta=False, response_flags=<ResponseFlags.INCLUDE_NOTHING: 0>)

Represents a Sync Fortnite API client. This is the main class used to interact with the Fortnite API.

with x:

This class is a context manager. This means you can use it with the with statement. This will automatically open and close the HTTP session for you. If you don’t use the with statement, you will have to manually close the session.

Parameters:
  • api_key (Optional[str]) –

    The API key to use for the client. If not provided, some endpoints may not be available. An API key can be generated using the FortniteAPI website.

  • default_language (fortnite_api.GameLanguage) – The default language to display the data in. Defaults to ENGLISH.

  • session (Optional[requests.Session]) – The session to use for the HTTP requests. If not provided, a new session will be created for you and you must use the class as an async context manager.

  • beta (bool) –

    Whether the client can make requests to the beta API. Any beta endpoints will not be available if this is set to False. Defaults to False.

    Note

    All beta endpoints are prefixed with beta_.

  • response_flags (ResponseFlags) – Denotes the standard response flags to use for all requests that support them. Defaults to INCLUDE_NOTHING.

default_language

The default language set on the client.

Type:

fortnite_api.GameLanguage

beta

Denotes if the client can make requests to beta endpoints.

Type:

bool

response_flags

The standard response flags to use for all requests that support them.

Type:

ResponseFlags

fetch_cosmetics_all(*, language=..., response_flags=...)

Fetches all cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched cosmetics.

Return type:

fortnite_api.CosmeticsAll

fetch_cosmetics_br(*, language=..., response_flags=...)

Fetches all Battle Royale cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched Battle Royale cosmetics.

Return type:

List[fortnite_api.CosmeticBr]

fetch_cosmetics_cars(*, language=..., response_flags=...)

Fetches all Car cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched car cosmetics.

Return type:

List[fortnite_api.CosmeticCar]

fetch_cosmetics_instruments(*, language=..., response_flags=...)

Fetches all instrument cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched instruments.

Return type:

List[fortnite_api.CosmeticInstrument]

fetch_cosmetics_lego_kits(*, language=..., response_flags=...)

Fetches all lego kit cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched lego kits.

Return type:

List[fortnite_api.CosmeticLegoKit]

fetch_variants_lego(*, language=..., response_flags=...)

Fetches all lego cosmetic variants available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched lego cosmetic variants.

Return type:

List[fortnite_api.VariantLego]

fetch_variants_beans(*, language=..., response_flags=...)

Fetches all bean cosmetic variants available in Fortnite. For more information on what a bean is, see fortnite_api.VariantBean.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched bean cosmetic variants.

Return type:

List[fortnite_api.VariantBean]

fetch_cosmetics_tracks(*, language=..., response_flags=...)

Fetches all audio track cosmetics available in Fortnite.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched audio tracks.

Return type:

List[fortnite_api.CosmeticTrack]

fetch_cosmetic_br(cosmetic_id, *, language=..., response_flags=...)

Fetch a specific Battle Royale cosmetic by its ID.

Parameters:
  • cosmetic_id (str) – The ID of the cosmetic to fetch.

  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The cosmetic fetched.

Return type:

fortnite_api.CosmeticBr

Raises:

NotFound – A cosmetic with that ID was not found.

fetch_cosmetics_new(*, language=..., response_flags=...)

Fetches all new cosmetics recently made available in Fortnite. This encompasses all cosmetic types available in the game.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched new cosmetics.

Return type:

fortnite_api.NewCosmetics

search_br_cosmetics(**kwargs)

Searches all Battle Royale cosmetics available in Fortnite and returns the best match(es) based on the search criteria. Passing any of the parameters to this function will filter the search results.

Parameters:
  • multiple (Optional[bool]) – Denotes if multiple matches should be returned. If this is True then a list of matches will be returned. If False, then only the best match will be returned. Defaults to False.

  • language (Optional[fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

  • search_language (Optional[fortnite_api.GameLanguage]) – The language to use for the search. Will override the default language set on the client. Defaults to the client’s default_language or fortnite_api.GameLanguage.ENGLISH.

  • match_method (Optional[fortnite_api.MatchMethod]) – The method to use for matching the search query. Defaults to FULL.

  • id (Optional[str]) – The ID of the cosmetic.

  • name (Optional[str]) – The name of the cosmetic.

  • description (Optional[str]) – The description of the cosmetic.

  • type (Optional[fortnite_api.CosmeticType]) – The cosmetic’s type.

  • type_display (Optional[str]) – The display type of the cosmetic.

  • type_backend (Optional[str]) – The backend type of the cosmetic.

  • rarity (Optional[fortnite_api.CosmeticRarity]) – The rarity of the cosmetic.

  • rarity_display (Optional[str]) – The display rarity of the cosmetic.

  • rarity_backend (Optional[str]) – The backend rarity of the cosmetic.

  • has_series (Optional[bool]) – If the cosmetic has a series.

  • series (Optional[str]) – The series of the cosmetic.

  • series_backend (Optional[str]) – The backend series of the cosmetic.

  • has_set (Optional[bool]) – If the cosmetic has a set.

  • set (Optional[str]) – The set of the cosmetic.

  • set_text (Optional[str]) – The text of the set of the cosmetic.

  • set_backend (Optional[str]) – The backend set of the cosmetic.

  • has_introduction (Optional[bool]) – If the cosmetic has an introduction.

  • introduction_backend (Optional[str]) – The backend introduction value of the cosmetic.

  • introduction_chapter (Optional[str]) – The chapter when the cosmetic was introduced.

  • introduction_season (Optional[str]) – The season that the cosmetic was introduced.

  • has_featured_image (Optional[bool]) – If the cosmetic has a featured image.

  • has_variants (Optional[bool]) – If the cosmetic has variants.

  • gameplay_tag (Optional[str]) – A gameplay tag of the cosmetic.

  • has_meta_tags (Optional[bool]) – If the cosmetic has meta tags.

  • has_dynamic_pak_id (Optional[bool]) – If the cosmetic has a dynamic pak ID.

  • dynamic_pak_id (Optional[str]) – The dynamic pak ID of the cosmetic.

  • added (Optional[datetime.datetime]) – The date when the cosmetic was added.

  • added_since (Optional[datetime.datetime]) – The date since the cosmetic was added.

  • unseen_for (Optional[int]) – The amount, in days, that the cosmetic has been unseen.

  • last_appearance (Optional[datetime.datetime]) – The last appearance of the cosmetic.

Raises:

NotFound – No cosmetics were found with the search criteria.

fetch_aes(*, key_format=KeyFormat.HEX)

Fetches the AES key used to decrypt encrypted data from Fortnite.

Parameters:

key_format (fortnite_api.KeyFormat) – The format to return the key in. Defaults to HEX.

Returns:

The fetched AES key.

Return type:

fortnite_api.Aes

fetch_banners(*, language=...)

Fetch all banners available in Fortnite.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the banners in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched banners.

Return type:

List[fortnite_api.Banner]

fetch_banner_colors()

Fetch all banner colors available in Fortnite.

Returns:

The fetched banner colors.

Return type:

List[fortnite_api.BannerColor]

fetch_creator_code(*, name)

Fetch information about a creator code in Fortnite from the creator code name.

Parameters:

name (str) – The name of the creator code to fetch.

Returns:

The fetched creator code.

Return type:

fortnite_api.CreatorCode

Raises:

NotFound – A creator code with that name was not found.

fetch_map(*, language=...)

Fetches the current map of Fortnite.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the map in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched map.

Return type:

fortnite_api.Map

fetch_news(*, language=...)

Fetch the news for Fortnite. This includes all news for all game modes.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the news in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched news.

Return type:

fortnite_api.News

fetch_news_br(*, language=...)

Fetches the current Battle Royale news.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the news in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The Battle Royale news.

Return type:

fortnite_api.GameModeNews

fetch_news_stw(*, language=...)

Fetches the current Save the World news.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the news in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The Save the World news.

Return type:

fortnite_api.GameModeNews

fetch_playlists(*, language=...)

Fetches a list of current playlists available in Fortnite.

Parameters:

language (Optional[fortnite_api.GameLanguage]) – The language to display the playlists in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched current playlists available in Fortnite.

Return type:

List[fortnite_api.Playlist]

fetch_playlist(id, /, *, language=...)

Fetch a specific playlist by its ID.

Parameters:
  • id (str) – The ID of the playlist to fetch.

  • language (Optional[fortnite_api.GameLanguage]) – The language to display the playlist in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

Returns:

The fetched playlist.

Return type:

fortnite_api.Playlist

Raises:

NotFound – A playlist with that ID was not found.

fetch_br_stats(*, name=None, account_id=None, type=AccountType.EPIC, time_window=TimeWindow.LIFETIME, image=StatsImageType.NONE)

Fetch stats for a Fortnite player by their name.

Note

The ratelimit for this endpoint is max 3 requests per second, 180 per minute.

Parameters:
  • name (Optional[str]) – The name of the player to fetch stats for. Cannot be used with account_id.

  • account_id (Optional[str]) – The account ID of the player to fetch stats for. Cannot be used with name.

  • type (Optional[fortnite_api.AccountType]) – The type of account to search statistics for. This parameter is only to narrow the search when fetching account stats by name. It will not do anything when fetching by account_id. Defaults to fortnite_api.AccountType.EPIC.

  • time_window (Optional[fortnite_api.TimeWindow]) – The time window to search statistics for. Defaults to LIFETIME.

  • image (Optional[fortnite_api.StatsImageType]) – The type of image to display in the statistics. Defaults to NONE. If this is set to fortnite_api.StatsImageType.NONE, there will be no image in the response.

Returns:

The fetched player statistics.

Return type:

fortnite_api.BrPlayerStats

Raises:
  • NotFound – A player with that name was not found.

  • ValueError – You cannot pass both a name and an account_id to fetch stats at the same time, or, you must pass either a name or an account_id to fetch stats.

  • RateLimited – The rate limit for this endpoint has been exceeded.

  • MissingAPIKey – The client does not have an API key set to fetch player stats.

beta_fetch_material_instances()

Fetches all the material instances available in Fortnite.

Note

This is a beta method. This cannot be called unless beta is set to True in the client.

Warning

At any time, for any reason, this method could break - either from local parsing errors or upstream API changes. Always be prepared for this. It is highly recommended to wrap this method in a try/except block to catch any exceptions that may be raised.

try:
    instances = await client.beta_fetch_material_instances()
except fortnite_api.BetaUnknownException as exc:
    # Any exception raised from beta methods will be wrapped in BetaUnknownException,
    # get the root cause of the exception with exc.original.
    original = exc.original
    print(f"An unknown error occurred: {original}")
else:
    print(instances)
Returns:

The fetched material instances.

Return type:

List[fortnite_api.MaterialInstance]

Raises:
  • BetaAccessNotEnabled – The client does not have beta access enabled through beta.

  • BetaUnknownException – An unknown error occurred while fetching the material instances. This could be due to an issue with the API or the client. Any unknown errors raised will be wrapped in this exception.

fetch_shop(*, language=..., response_flags=...)

Fetches the current Fortnite item shop.

Parameters:
  • language (Optional[fortnite_api.GameLanguage]) – The language to display the playlist in. Defaults to None. This will override the default language set on the client. Passing None specifically omits any flags being passed to the API.

  • response_flags (Optional[ResponseFlags]) – The response flags the API should use when fetching the data. Passing this parameter will override the default response_flags set on the client. Specifically passing None will omit any flags field being passed to the HTTPs request.

Returns:

The fetched item shop.

Return type:

fortnite_api.Shop