Skip to content
墨 AniLink

Querying data ​

The query methods are grouped by domain. Every method takes a typed variables object and an optional trailing RequestOptions.

Selecting fields ​

Every query returns the maximal selection by default. Field-aware queries are those whose signature lists a fields option. They accept it in the trailing options to select fields at any nesting depth. The return type includes the requested fields and any always-selected keys. Plain-response queries such as query.markdown and query.viewer have no fields option. They always return their fixed shape:

typescript
const slim = await aniLink.anilist.query.media(
    { id: 123 },
    { fields: ["id", "title.romaji", "averageScore"] }
);
// slim: DeepPick<MediaResponse, "id" | "title.romaji" | "averageScore" | "idMal">

See Field selection for the nested path rules, the always-selected id, page and mutation support, and when to use aniLink.anilist.custom() instead.

Media ​

OperationPurpose
query.mediaOne anime or manga by id or idMal
query.mediaTrendPopularity/progression trends for a media
query.airingScheduleAiring schedule for a media
typescript
const anime = await aniLink.anilist.query.media({ id: 21, type: "ANIME" });

Characters & staff ​

OperationPurpose
query.characterOne character with their media
query.staffOne staff member with their media and characters

Studios ​

OperationPurpose
query.studioOne studio with its productions

Users ​

OperationPurpose
query.userOne user by id or name
query.viewerThe authenticated user, token required
query.followingUsers a user follows
query.followerUsers following a user

Lists ​

OperationPurpose
query.mediaListOne list entry for a user and media
query.mediaListCollectionA user's whole list collection, chunked

mediaListCollection returns lists nested by status and custom list. Flatten it with flattenMediaListCollection, and walk large collections with paginateChunks.

Taxonomy ​

OperationPurpose
query.genreCollectionAll genres
query.mediaTagCollectionAll tags
query.externalLinkSourceCollectionExternal link sources

Activity ​

OperationPurpose
query.activityOne activity
query.activityReplyOne activity reply
query.notificationNotifications for the viewer, token required

Community ​

OperationPurpose
query.threadOne forum thread
query.threadCommentOne thread comment

Reviews & recommendations ​

OperationPurpose
query.reviewOne review
query.recommendationOne recommendation

Misc ​

OperationPurpose
query.markdownRender AniList markdown to HTML
query.aniChartUserAniChart settings for the viewer
query.siteStatisticsSite-wide statistics

Example with variables ​

typescript
const character = await aniLink.anilist.query.character({
    id: 1,
    asHtml: true,
    mediaSort: ["POPULARITY_DESC"],
    mediaPage: 1,
    mediaPerPage: 10,
});

Next steps ​

AniLink, typed AniList & MyAnimeList client for TypeScript.