Skip to content

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:

  • lang

    (Language, default: EN ) –

    The language for the API responses. Defaults to English (EN).

  • cache_ttl

    (int, default: 3600 ) –

    Time-to-live for cached responses in seconds. Defaults to 3600 (1 hour).

  • headers

    (dict[str, Any] | None, default: None ) –

    Optional custom headers for HTTP requests.

  • session

    (ClientSession | 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:

BASE_URL class-attribute instance-attribute

BASE_URL: Final[str] = 'https://gi.yatta.moe/api/v2'

lang instance-attribute

lang = lang

close async

close() -> None

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_cache
    (bool, 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:

fetch_achievement_categories async

fetch_achievement_categories(use_cache: bool = True) -> list[AchievementCategory]

Fetches all achievement categories.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (int) –

    The ID of the artifact set to fetch.

  • fetch_story
    (bool, default: False ) –

    Whether to do five additional requests to fetch the lore of each artifact piece. Defaults to False.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_artifact_sets async

fetch_artifact_sets(use_cache: bool = True) -> list[ArtifactSet]

Fetches summary information for all artifact sets.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_avatar_curve async

fetch_avatar_curve(use_cache: bool = True) -> dict[str, dict[str, dict[str, float]]]

Fetches the character stat growth curves.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (int) –

    The ID of the book to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_books async

fetch_books(use_cache: bool = True) -> list[Book]

Fetches summary information for all readable books.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

  • list[Book] –

    A list of Book objects.

Raises:

fetch_changelogs async

fetch_changelogs(use_cache: bool = True) -> list[Changelog]

Fetches the API changelogs.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (str) –

    The ID of the character to fetch (e.g., "10000002" for Ayaka).

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (str) –

    The ID of the character to fetch fetter data for.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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_id
    (str) –

    The ID of the character to fetch guides for.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

  • CharacterGuide –

    A CharacterGuide object containing build, playstyle, and synergy recommendations.

Raises:

fetch_characters async

fetch_characters(use_cache: bool = True) -> list[Character]

Fetches summary information for all characters.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_domains async

fetch_domains(use_cache: bool = True) -> Domains

Fetches information about daily domains and their rewards for each day of the week.

Parameters:

  • use_cache
    (bool, 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:

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:

  • id
    (int) –

    The ID of the food item to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_foods async

fetch_foods(use_cache: bool = True) -> list[Food]

Fetches summary information for all food items.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

  • list[Food] –

    A list of Food objects.

Raises:

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:

  • id
    (int) –

    The ID of the furniture item to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (int) –

    The ID of the furniture set to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_furniture_sets async

fetch_furniture_sets(use_cache: bool = True) -> list[FurnitureSet]

Fetches summary information for all furniture sets (Serenitea Pot).

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_furnitures async

fetch_furnitures(use_cache: bool = True) -> list[Furniture]

Fetches summary information for all furniture items (Serenitea Pot).

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

fetch_manual_weapon async

fetch_manual_weapon(use_cache: bool = True) -> dict[str, str]

Fetches manual weapon data (purpose unclear from API structure).

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

  • dict[str, str] –

    A dictionary containing the manual weapon data.

Raises:

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:

  • id
    (int) –

    The ID of the material to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_materials async

fetch_materials(use_cache: bool = True) -> list[Material]

Fetches summary information for all materials (includes ingredients, ascension items, etc.).

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_monster_curve async

fetch_monster_curve(use_cache: bool = True) -> dict[str, dict[str, dict[str, float]]]

Fetches the monster stat growth curves.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (int) –

    The ID of the monster/being to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_monsters async

fetch_monsters(use_cache: bool = True) -> list[Monster]

Fetches summary information for all monsters and living beings.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (int) –

    The ID of the namecard to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_namecards async

fetch_namecards(use_cache: bool = True) -> list[Namecard]

Fetches summary information for all namecards.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (int) –

    The ID of the quest chapter to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_quests async

fetch_quests(use_cache: bool = True) -> list[Quest]

Fetches summary information for all quests.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_readable async

fetch_readable(id: str, use_cache: bool = True) -> str

Fetches the text content of a specific readable item (like a book volume) by its ID.

Parameters:

  • id
    (str) –

    The ID of the readable item to fetch.

  • use_cache
    (bool, 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:

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:

  • id
    (int) –

    The ID of the TCG card to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_tcg_cards async

fetch_tcg_cards(use_cache: bool = True) -> list[TCGCard]

Fetches summary information for all Genius Invokation TCG cards.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_upgrade_data async

fetch_upgrade_data(use_cache: bool = True) -> UpgradeData

Fetches general upgrade material requirements for characters and weapons.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

  • UpgradeData –

    An UpgradeData object containing lists of upgrade requirements.

Raises:

fetch_weapon_curve async

fetch_weapon_curve(use_cache: bool = True) -> dict[str, dict[str, dict[str, float]]]

Fetches the weapon stat growth curves.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

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:

  • id
    (int) –

    The ID of the weapon to fetch.

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

fetch_weapon_types async

fetch_weapon_types(use_cache: bool = True) -> dict[str, str]

Fetches a mapping of weapon type identifiers to their display names.

Parameters:

  • use_cache
    (bool, 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:

fetch_weapons async

fetch_weapons(use_cache: bool = True) -> list[Weapon]

Fetches summary information for all weapons.

Parameters:

  • use_cache
    (bool, default: True ) –

    Whether to use cached data if available. Defaults to True.

Returns:

Raises:

start async

start() -> None

Initializes the internal aiohttp client session.

Must be called before making any API requests if not using the client as an async context manager. Creates a CachedSession if no session was provided during initialization.