Skip to content
墨 AniLink

MAL operations ​

The aniLink.mal.* methods are grouped by domain: anime, manga, user, and forum. Every operation takes a typed params object and an optional trailing MalRequestOptions with fields selection and transport settings, merged over the instance defaults.

Each operation's full request parameters, response shape, auth requirements, and errors live in the MAL operation catalog, generated from source metadata so they cannot drift from the code.

Selecting fields ​

fields accepts a comma-separated string or an array. Both forms produce the same query parameter. Use either form:

typescript
// Equivalent:
await aniLink.mal.anime.get({ id: 21 }, { fields: "id,title,main_picture" });
await aniLink.mal.anime.get({ id: 21 }, { fields: ["id", "title", "main_picture"] });

Field names are MAL's own, and AniLink passes them through verbatim. See the MAL API v2 field reference for the full list.

anime.get is the only operation with a default for fields. If you omit fields, it sends DEFAULT_MAL_ANIME_FIELDS (id, title, main_picture, synopsis, status, mean, num_episodes, media_type, start_date, broadcast, average_episode_duration). That default lets await aniLink.mal.anime.get({ id: 21 }) work without options. An explicit fields value replaces the default. The discovery reads (seasonal, ranking, suggestions) omit fields when you do not provide it.

Anime ​

OperationPurpose
anime.getOne anime by its MyAnimeList ID
anime.searchAnime search by keyword
anime.seasonalThe anime of one broadcast season
anime.rankingOne of MAL's anime ranking lists
anime.suggestionsMAL's suggestions for the authenticated user
anime.updateMyListStatusUpdate the authenticated user's anime list status
anime.deleteFromListRemove an anime from the user's list
typescript
const anime = await aniLink.mal.anime.get(
    { id: 21 },
    { fields: ["id", "title", "main_picture", "synopsis"] }
);
console.log(anime.title, anime.main_picture?.large);

The list writes (updateMyListStatus, deleteFromList) require a MAL access token. deleteFromList is permanent.

Manga ​

OperationPurpose
manga.getOne manga by its MyAnimeList ID
manga.searchManga search by keyword
manga.rankingOne of MAL's manga ranking lists
manga.updateMyListStatusUpdate the authenticated user's manga list status
manga.deleteFromListRemove a manga from the user's list
typescript
const status = await aniLink.mal.manga.updateMyListStatus({
    id: 1,
    status: "reading",
    num_chapters_read: 10,
    score: 9,
});
console.log(status.num_chapters_read);

Users ​

OperationPurpose
user.meThe authenticated user, token required
user.getOne user profile; MAL documents only @me
user.animeListOne page of a user's anime list
user.mangaListOne page of a user's manga list
typescript
const list = await aniLink.mal.user.animeList(
    { username: "@me", status: "watching", sort: "list_score", limit: 100 },
    { fields: ["id", "title", "list_status"] }
);
console.log(list.data[0]?.node.title, list.data[0]?.list_status?.score);

@me and private lists require an access token; a client ID alone cannot resolve @me. Without a token, @me fails fast with AniLinkAuthError before any request is sent.

Forum ​

OperationPurpose
forum.boardsThe forum board tree
forum.topicsThe forum topic list, filterable
forum.topicOne topic with its posts and poll
typescript
const topic = await aniLink.mal.forum.topic({ id: 23744 });
console.log(topic.data.title, topic.data.posts[0]?.body);

Paging and caching notes ​

The list endpoints (search, ranking, seasonal, suggestions, user.animeList, user.mangaList, forum.topics) return a paging node. When more results remain, paging.next contains the next-page URL. Follow that URL manually only with care: manual requests bypass the library's pacing, retry, and circuit breaker. Prefer the mal.paginate helpers, which walk these endpoints with the guards applied.

With responseCache enabled, list reads can remain stale for ttlMs after updateMyListStatus. The cache uses a TTL and does not invalidate entries after writes.

Next steps ​

AniLink, typed AniList & MyAnimeList client for TypeScript.