API Reference
client
Classes:
-
AmbrAPI–Asynchronous client for interacting with the Ambr project API (gi.yatta.moe).
AmbrAPI
Asynchronous client for interacting with the Ambr project API (gi.yatta.moe).
Provides methods to fetch various Genshin Impact game data.
Parameters:
-
(langLanguage, default:EN) –The language for the API responses. Defaults to English (EN).
-
(cache_ttlint, default:3600) –Time-to-live for cached responses in seconds. Defaults to 3600 (1 hour).
-
(headersdict[str, Any] | None, default:None) –Optional custom headers for HTTP requests.
-
(sessionClientSession | None, default:None) –Optional existing aiohttp.ClientSession to use. If None, a new CachedSession is created.
Attributes:
-
lang–The language used for API requests.
-
BASE_URL(Final[str]) –The base URL for the Ambr API v2.
Methods:
-
close–Closes the internal aiohttp client session.
-
fetch_abyss_data–Fetches data for the current and potentially previous Spiral Abyss cycles.
-
fetch_achievement_categories–Fetches all achievement categories.
-
fetch_artifact_set_detail–Fetches detailed information for a specific artifact set by its ID.
-
fetch_artifact_sets–Fetches summary information for all artifact sets.
-
fetch_avatar_curve–Fetches the character stat growth curves.
-
fetch_book_detail–Fetches detailed information for a specific book by its ID, including volumes.
-
fetch_books–Fetches summary information for all readable books.
-
fetch_changelogs–Fetches the API changelogs.
-
fetch_character_detail–Fetches detailed information for a specific character by their ID.
-
fetch_character_fetter–Fetches character stories and voice-over quotes (fetter information) by character ID.
-
fetch_character_guide–Fetches community-sourced build guides for a specific character.
-
fetch_characters–Fetches summary information for all characters.
-
fetch_domains–Fetches information about daily domains and their rewards for each day of the week.
-
fetch_food_detail–Fetches detailed information for a specific food item by its ID.
-
fetch_foods–Fetches summary information for all food items.
-
fetch_furniture_detail–Fetches detailed information for a specific furniture item by its ID.
-
fetch_furniture_set_detail–Fetches detailed information for a specific furniture set by its ID.
-
fetch_furniture_sets–Fetches summary information for all furniture sets (Serenitea Pot).
-
fetch_furnitures–Fetches summary information for all furniture items (Serenitea Pot).
-
fetch_latest_version–Fetches the latest data version hash from the API.
-
fetch_manual_weapon–Fetches manual weapon data (purpose unclear from API structure).
-
fetch_material_detail–Fetches detailed information for a specific material by its ID.
-
fetch_materials–Fetches summary information for all materials (includes ingredients, ascension items, etc.).
-
fetch_monster_curve–Fetches the monster stat growth curves.
-
fetch_monster_detail–Fetches detailed information for a specific monster or living being by its ID.
-
fetch_monsters–Fetches summary information for all monsters and living beings.
-
fetch_namecard_detail–Fetches detailed information for a specific namecard by its ID.
-
fetch_namecards–Fetches summary information for all namecards.
-
fetch_quest_detail–Fetches detailed information for a specific quest chapter by its ID.
-
fetch_quests–Fetches summary information for all quests.
-
fetch_readable–Fetches the text content of a specific readable item (like a book volume) by its ID.
-
fetch_tcg_card_detail–Fetches detailed information for a specific TCG card by its ID.
-
fetch_tcg_cards–Fetches summary information for all Genius Invokation TCG cards.
-
fetch_upgrade_data–Fetches general upgrade material requirements for characters and weapons.
-
fetch_weapon_curve–Fetches the weapon stat growth curves.
-
fetch_weapon_detail–Fetches detailed information for a specific weapon by its ID.
-
fetch_weapon_types–Fetches a mapping of weapon type identifiers to their display names.
-
fetch_weapons–Fetches summary information for all weapons.
-
start–Initializes the internal aiohttp client session.
close
async
Closes the internal aiohttp client session.
Should be called to gracefully shut down the session if not using the client as an async context manager.
fetch_abyss_data
async
fetch_abyss_data(use_cache: bool = True) -> AbyssResponse
Fetches data for the current and potentially previous Spiral Abyss cycles.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
AbyssResponse–An AbyssResponse object containing details about abyss cycles, floors, enemies, etc.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_achievement_categories
async
fetch_achievement_categories(use_cache: bool = True) -> list[AchievementCategory]
Fetches all achievement categories.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
list[AchievementCategory]–A list of AchievementCategory objects.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_artifact_set_detail
async
fetch_artifact_set_detail(id: int, *, fetch_story: bool = False, use_cache: bool = True) -> ArtifactSetDetail
Fetches detailed information for a specific artifact set by its ID.
Parameters:
-
(idint) –The ID of the artifact set to fetch.
-
(fetch_storybool, default:False) –Whether to do five additional requests to fetch the lore of each artifact piece. Defaults to False.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
ArtifactSetDetail–An ArtifactSetDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_artifact_sets
async
fetch_artifact_sets(use_cache: bool = True) -> list[ArtifactSet]
Fetches summary information for all artifact sets.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
list[ArtifactSet]–A list of ArtifactSet objects.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_avatar_curve
async
Fetches the character stat growth curves.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
dict[str, dict[str, dict[str, float]]]–A nested dictionary representing character growth curves.
-
Structure(dict[str, dict[str, dict[str, float]]]) –{ level: { curve_id: { stat_id: value } } }
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_book_detail
async
fetch_book_detail(id: int, use_cache: bool = True) -> BookDetail
Fetches detailed information for a specific book by its ID, including volumes.
Parameters:
-
(idint) –The ID of the book to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
BookDetail–A BookDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_books
async
Fetches summary information for all readable books.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_changelogs
async
Fetches the API changelogs.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_character_detail
async
fetch_character_detail(id: str, use_cache: bool = True) -> CharacterDetail
Fetches detailed information for a specific character by their ID.
Parameters:
-
(idstr) –The ID of the character to fetch (e.g., "10000002" for Ayaka).
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
CharacterDetail–A CharacterDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_character_fetter
async
fetch_character_fetter(id: str, use_cache: bool = True) -> CharacterFetter
Fetches character stories and voice-over quotes (fetter information) by character ID.
Parameters:
-
(idstr) –The ID of the character to fetch fetter data for.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
CharacterFetter–A CharacterFetter object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_character_guide
async
fetch_character_guide(character_id: str, *, use_cache: bool = True) -> CharacterGuide
Fetches community-sourced build guides for a specific character.
Combines data from sources like Genshin Wizard and genshin.aza.gg.
Parameters:
-
(character_idstr) –The ID of the character to fetch guides for.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
CharacterGuide–A CharacterGuide object containing build, playstyle, and synergy recommendations.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_characters
async
Fetches summary information for all characters.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_domains
async
Fetches information about daily domains and their rewards for each day of the week.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
Domains–A Domains object containing lists of domains for each weekday.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_food_detail
async
fetch_food_detail(id: int, use_cache: bool = True) -> FoodDetail
Fetches detailed information for a specific food item by its ID.
Parameters:
-
(idint) –The ID of the food item to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
FoodDetail–A FoodDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_foods
async
Fetches summary information for all food items.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_furniture_detail
async
fetch_furniture_detail(id: int, use_cache: bool = True) -> FurnitureDetail
Fetches detailed information for a specific furniture item by its ID.
Parameters:
-
(idint) –The ID of the furniture item to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
FurnitureDetail–A FurnitureDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_furniture_set_detail
async
fetch_furniture_set_detail(id: int, use_cache: bool = True) -> FurnitureSetDetail
Fetches detailed information for a specific furniture set by its ID.
Parameters:
-
(idint) –The ID of the furniture set to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
FurnitureSetDetail–A FurnitureSetDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_furniture_sets
async
fetch_furniture_sets(use_cache: bool = True) -> list[FurnitureSet]
Fetches summary information for all furniture sets (Serenitea Pot).
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
list[FurnitureSet]–A list of FurnitureSet objects.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_furnitures
async
Fetches summary information for all furniture items (Serenitea Pot).
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_latest_version
async
fetch_latest_version() -> str
Fetches the latest data version hash from the API.
This hash is used internally to ensure requests use up-to-date data.
Returns:
-
str–The latest version hash string.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_manual_weapon
async
Fetches manual weapon data (purpose unclear from API structure).
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_material_detail
async
fetch_material_detail(id: int, use_cache: bool = True) -> MaterialDetail
Fetches detailed information for a specific material by its ID.
Parameters:
-
(idint) –The ID of the material to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
MaterialDetail–A MaterialDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_materials
async
Fetches summary information for all materials (includes ingredients, ascension items, etc.).
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_monster_curve
async
Fetches the monster stat growth curves.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
dict[str, dict[str, dict[str, float]]]–A nested dictionary representing monster growth curves.
-
Structure(dict[str, dict[str, dict[str, float]]]) –{ level: { curve_id: { stat_id: value } } }
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_monster_detail
async
fetch_monster_detail(id: int, use_cache: bool = True) -> MonsterDetail
Fetches detailed information for a specific monster or living being by its ID.
Parameters:
-
(idint) –The ID of the monster/being to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
MonsterDetail–A MonsterDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_monsters
async
Fetches summary information for all monsters and living beings.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_namecard_detail
async
fetch_namecard_detail(id: int, use_cache: bool = True) -> NamecardDetail
Fetches detailed information for a specific namecard by its ID.
Parameters:
-
(idint) –The ID of the namecard to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
NamecardDetail–A NamecardDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_namecards
async
Fetches summary information for all namecards.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_quest_detail
async
fetch_quest_detail(id: int, use_cache: bool = True) -> QuestDetail
Fetches detailed information for a specific quest chapter by its ID.
Parameters:
-
(idint) –The ID of the quest chapter to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
QuestDetail–A QuestDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_quests
async
Fetches summary information for all quests.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_readable
async
Fetches the text content of a specific readable item (like a book volume) by its ID.
Parameters:
-
(idstr) –The ID of the readable item to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
str–The text content of the readable item, with HTML tags removed.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_tcg_card_detail
async
fetch_tcg_card_detail(id: int, use_cache: bool = True) -> TCGCardDetail
Fetches detailed information for a specific TCG card by its ID.
Parameters:
-
(idint) –The ID of the TCG card to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
TCGCardDetail–A TCGCardDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_tcg_cards
async
Fetches summary information for all Genius Invokation TCG cards.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_upgrade_data
async
fetch_upgrade_data(use_cache: bool = True) -> UpgradeData
Fetches general upgrade material requirements for characters and weapons.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
UpgradeData–An UpgradeData object containing lists of upgrade requirements.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_weapon_curve
async
Fetches the weapon stat growth curves.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
dict[str, dict[str, dict[str, float]]]–A nested dictionary representing weapon growth curves.
-
Structure(dict[str, dict[str, dict[str, float]]]) –{ level: { curve_id: { stat_id: value } } }
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_weapon_detail
async
fetch_weapon_detail(id: int, use_cache: bool = True) -> WeaponDetail
Fetches detailed information for a specific weapon by its ID.
Parameters:
-
(idint) –The ID of the weapon to fetch.
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
WeaponDetail–A WeaponDetail object.
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_weapon_types
async
Fetches a mapping of weapon type identifiers to their display names.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
-
dict[str, str]–A dictionary mapping weapon type IDs (e.g., "WEAPON_SWORD_ONE_HAND") to names (e.g., "Sword").
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.
fetch_weapons
async
Fetches summary information for all weapons.
Parameters:
-
(use_cachebool, default:True) –Whether to use cached data if available. Defaults to True.
Returns:
Raises:
-
DataNotFoundError–If the requested data is not found (404).
-
ConnectionTimeoutError–If the connection times out (522, 524).
-
AmbrAPIError–For other API-related errors.