Skip to content

API Reference

YattaAPI

The main class to interact with the Project Yatta API.

Provide asynchronous methods to fetch various game data like characters, light cones, relics, items, etc. Support caching via aiohttp-client-cache.

Parameters:

Name Type Description Default
lang Language

The language to use for API responses. Defaults to Language.EN.

EN
cache_ttl int

The time-to-live for the cache in seconds. Defaults to 3600 (1 hour).

3600
headers dict[str, Any] | None

Optional dictionary of headers to include in requests.

None
session ClientSession | None

Optional existing aiohttp.ClientSession to use. If None, a new CachedSession will be created.

None

close() async

Close the internal aiohttp session.

Should be called to release resources if not using async with.

fetch_book_detail(id, use_cache=True) async

Fetch detailed information for a specific book.

Parameters:

Name Type Description Default
id int

The unique identifier of the book.

required
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
BookDetail

A BookDetail object containing detailed book information.

Raises:

Type Description
DataNotFoundError

If no book with the given ID is found.

YattaAPIError

For other API errors.

fetch_books(use_cache=True) async

Fetch a list of all available books.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
list[Book]

A list of Book objects.

Raises:

Type Description
DataNotFoundError

If the book list endpoint returns 404.

YattaAPIError

For other API errors.

fetch_changelogs(use_cache=True) async

Fetch a list of all available changelogs.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
list[Changelog]

A list of Changelog objects.

Raises:

Type Description
DataNotFoundError

If the changelog endpoint returns 404.

YattaAPIError

For other API errors.

fetch_character_detail(id, use_cache=True) async

Fetch detailed information for a specific character.

Parameters:

Name Type Description Default
id int

The unique identifier of the character.

required
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
CharacterDetail

A CharacterDetail object containing detailed character information.

Raises:

Type Description
DataNotFoundError

If no character with the given ID is found.

YattaAPIError

For other API errors.

fetch_characters(use_cache=True) async

Fetch a list of all available characters.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
list[Character]

A list of Character objects.

Raises:

Type Description
DataNotFoundError

If the character list endpoint returns 404.

YattaAPIError

For other API errors.

fetch_item_detail(id, use_cache=True) async

Fetch detailed information for a specific item.

Parameters:

Name Type Description Default
id int

The unique identifier of the item.

required
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
ItemDetail

An ItemDetail object containing detailed item information.

Raises:

Type Description
DataNotFoundError

If no item with the given ID is found.

YattaAPIError

For other API errors.

fetch_items(use_cache=True) async

Fetch a list of all available items.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
list[Item]

A list of Item objects.

Raises:

Type Description
DataNotFoundError

If the item list endpoint returns 404.

YattaAPIError

For other API errors.

fetch_latest_version() async

Fetch the latest data version hash from the API.

This bypasses the regular cache to ensure the absolute latest version is retrieved.

Returns:

Type Description
str

The latest version hash string.

Raises:

Type Description
YattaAPIError

For API errors during the fetch.

fetch_light_cone_detail(id, use_cache=True) async

Fetch detailed information for a specific light cone.

Parameters:

Name Type Description Default
id int

The unique identifier of the light cone.

required
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
LightConeDetail

A LightConeDetail object containing detailed light cone information.

Raises:

Type Description
DataNotFoundError

If no light cone with the given ID is found.

YattaAPIError

For other API errors.

fetch_light_cones(use_cache=True) async

Fetch a list of all available light cones.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
list[LightCone]

A list of LightCone objects.

Raises:

Type Description
DataNotFoundError

If the light cone list endpoint returns 404.

YattaAPIError

For other API errors.

fetch_manual_avatar(use_cache=True) async

Fetch manual avatar data, typically used for stat mappings.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
dict[str, dict[str, str]]

A dictionary containing manual avatar data, often mapping stat keys to names and icons.

Raises:

Type Description
DataNotFoundError

If the manual avatar endpoint returns 404.

YattaAPIError

For other API errors.

fetch_message_types(use_cache=True) async

Fetch a mapping of message type IDs to their names.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
dict[str, str]

A dictionary where keys are message type IDs (as strings) and values are type names.

Raises:

Type Description
DataNotFoundError

If the message endpoint returns 404.

YattaAPIError

For other API errors.

fetch_messages(use_cache=True) async

Fetch a list of all available message threads.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
list[Message]

A list of Message objects.

Raises:

Type Description
DataNotFoundError

If the message list endpoint returns 404.

YattaAPIError

For other API errors.

fetch_relic_set_detail(id, use_cache=True) async

Fetch detailed information for a specific relic set.

Parameters:

Name Type Description Default
id int

The unique identifier of the relic set.

required
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
RelicSetDetail

A RelicSetDetail object containing detailed relic set information.

Raises:

Type Description
DataNotFoundError

If no relic set with the given ID is found.

YattaAPIError

For other API errors.

fetch_relic_sets(use_cache=True) async

Fetch a list of all available relic sets.

Parameters:

Name Type Description Default
use_cache bool

Whether to allow the response to be served from cache. Defaults to True.

True

Returns:

Type Description
list[RelicSet]

A list of RelicSet objects.

Raises:

Type Description
DataNotFoundError

If the relic list endpoint returns 404.

YattaAPIError

For other API errors.

start() async

Initialize the internal aiohttp session.

Must be called before making any API requests if not using async with.