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>)¶
- AttributesMethods
- asyncbeta_fetch_material_instances
- asyncfetch_aes
- asyncfetch_banner_colors
- asyncfetch_banners
- asyncfetch_br_stats
- asyncfetch_cosmetic_br
- asyncfetch_cosmetics_all
- asyncfetch_cosmetics_br
- asyncfetch_cosmetics_cars
- asyncfetch_cosmetics_instruments
- asyncfetch_cosmetics_lego_kits
- asyncfetch_cosmetics_new
- asyncfetch_cosmetics_tracks
- asyncfetch_creator_code
- asyncfetch_map
- asyncfetch_news
- asyncfetch_news_br
- asyncfetch_news_stw
- asyncfetch_playlist
- asyncfetch_playlists
- asyncfetch_shop
- asyncfetch_variants_beans
- asyncfetch_variants_lego
- asyncsearch_br_cosmetics
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 withstatement, 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 toENGLISHif 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 toFalse. 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 toINCLUDE_NOTHING.
- default_language¶
The default language set for the client.
- response_flags¶
The standard response flags to use for all requests that support them.
- Type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched cosmetics.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched instruments.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched lego kits.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched audio tracks.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The cosmetic fetched.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched new cosmetics.
- Return type:
- 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 isTruethen a list of matches will be returned. IfFalse, then only the best match will be returned. Defaults toFalse.language (Optional[
fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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’sdefault_languageorfortnite_api.GameLanguage.ENGLISH.match_method (Optional[
fortnite_api.MatchMethod]) – The method to use for matching the search query. Defaults toFULL.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 toHEX.- Returns:
The fetched AES key.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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.
- 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 toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.- Returns:
The fetched map.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.- Returns:
The fetched news.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.- Returns:
The Battle Royale news.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.- Returns:
The Save the World news.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.
- Returns:
The fetched playlist.
- Return type:
- 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 withaccount_id.account_id (Optional[
str]) – The account ID of the player to fetch stats for. Cannot be used withname.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 byaccount_id. Defaults tofortnite_api.AccountType.EPIC.time_window (Optional[
fortnite_api.TimeWindow]) – The time window to search statistics for. Defaults toLIFETIME.image (Optional[
fortnite_api.StatsImageType]) – The type of image to display in the statistics. Defaults toNONE. If this is set tofortnite_api.StatsImageType.NONE, there will be no image in the response.
- Returns:
The fetched player statistics.
- Return type:
- Raises:
NotFound – A player with that name was not found.
ValueError – You cannot pass both a
nameand anaccount_idto fetch stats at the same time, or, you must pass either anameor anaccount_idto 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched item shop.
- Return type:
- 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
betais set toTruein 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:
- 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>)¶
- AttributesMethods
- defbeta_fetch_material_instances
- deffetch_aes
- deffetch_banner_colors
- deffetch_banners
- deffetch_br_stats
- deffetch_cosmetic_br
- deffetch_cosmetics_all
- deffetch_cosmetics_br
- deffetch_cosmetics_cars
- deffetch_cosmetics_instruments
- deffetch_cosmetics_lego_kits
- deffetch_cosmetics_new
- deffetch_cosmetics_tracks
- deffetch_creator_code
- deffetch_map
- deffetch_news
- deffetch_news_br
- deffetch_news_stw
- deffetch_playlist
- deffetch_playlists
- deffetch_shop
- deffetch_variants_beans
- deffetch_variants_lego
- defsearch_br_cosmetics
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
withstatement. This will automatically open and close the HTTP session for you. If you don’t use thewithstatement, 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 toENGLISH.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 toFalse.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 toINCLUDE_NOTHING.
- default_language¶
The default language set on the client.
- response_flags¶
The standard response flags to use for all requests that support them.
- Type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched cosmetics.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched instruments.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched lego kits.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched audio tracks.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The cosmetic fetched.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched new cosmetics.
- Return type:
- 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 isTruethen a list of matches will be returned. IfFalse, then only the best match will be returned. Defaults toFalse.language (Optional[
fortnite_api.GameLanguage]) – The language to display the cosmetics in. Defaults toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill 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’sdefault_languageorfortnite_api.GameLanguage.ENGLISH.match_method (Optional[
fortnite_api.MatchMethod]) – The method to use for matching the search query. Defaults toFULL.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 toHEX.- Returns:
The fetched AES key.
- Return type:
- fetch_banners(*, language=...)¶
Fetch all banners available in Fortnite.
- Parameters:
language (Optional[
fortnite_api.GameLanguage]) – The language to display the banners in. Defaults toNone. This will override the default language set on the client. PassingNonespecifically 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.
- fetch_map(*, language=...)¶
Fetches the current map of Fortnite.
- Parameters:
language (Optional[
fortnite_api.GameLanguage]) – The language to display the map in. Defaults toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.- Returns:
The fetched map.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.- Returns:
The fetched news.
- Return type:
- fetch_news_br(*, language=...)¶
Fetches the current Battle Royale news.
- Parameters:
language (Optional[
fortnite_api.GameLanguage]) – The language to display the news in. Defaults toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.- Returns:
The Battle Royale news.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.- Returns:
The Save the World news.
- Return type:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 toNone. This will override the default language set on the client. PassingNonespecifically omits any flags being passed to the API.
- Returns:
The fetched playlist.
- Return type:
- 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 withaccount_id.account_id (Optional[
str]) – The account ID of the player to fetch stats for. Cannot be used withname.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 byaccount_id. Defaults tofortnite_api.AccountType.EPIC.time_window (Optional[
fortnite_api.TimeWindow]) – The time window to search statistics for. Defaults toLIFETIME.image (Optional[
fortnite_api.StatsImageType]) – The type of image to display in the statistics. Defaults toNONE. If this is set tofortnite_api.StatsImageType.NONE, there will be no image in the response.
- Returns:
The fetched player statistics.
- Return type:
- Raises:
NotFound – A player with that name was not found.
ValueError – You cannot pass both a
nameand anaccount_idto fetch stats at the same time, or, you must pass either anameor anaccount_idto 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
betais set toTruein 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:
- 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 toNone. This will override the default language set on the client. PassingNonespecifically 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 defaultresponse_flagsset on the client. Specifically passingNonewill omit any flags field being passed to the HTTPs request.
- Returns:
The fetched item shop.
- Return type: