Creates a new AniLink instance. The authToken
parameter is optional and only required for authenticated queries and mutations. If no authToken
is provided, only public queries will be available. You are able to create multiple AniLink instances with different authToken
s.
Optional
authToken: stringThe authentication token to use for API requests.
const aniLink = new AniLink('authToken');
const aniLink2 = new AniLink();
Anilist API methods.
Custom query or mutation.
const viewer = await aniLink.anilist.custom('query {Viewer {id}}');
const mutation = 'mutation ($about: String) {UpdateUser (about: $about) {id}}';
const variables = { about: "New about text" };
const response = await aniLink.anilist.custom(mutation, variables);
The query for the request.
The variables for the request. This parameter is optional.
Mutation methods for updating data on the Anilist API.
Deletes an activity on the Anilist API. Mod Only
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.deleteActivity({id: 1});
The variables for the mutation.
Deletes an activity reply on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.deleteActivityReply({id: 1});
The variables for the mutation.
Deletes a custom list on the Anilist API. There is no mutation specifically for creating a custom list. You can create a custom list through the updateUser
mutation under the animeListOptions
or mangaListOptions
variables.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.deleteCustomLists({customList: 'test'});
The variables for the mutation.
Deletes a media list entry on the Anilist API.
A promise that resolves when the mutation is complete.
You cannot delete a media list entry without first fetching the entry's id. The entry's id is not the same as the mediaId. It is specific to each user and media.
// Fetch the entry's id first by quering the user's media list by the mediaId.
const entryId = (
await handleRateLimit(() => aniLink.anilist.query.mediaList(
{
userId: 6503722,
mediaId: 143271
}
))).data.MediaList.id;
aniLink.anilist.mutation.deleteMediaListEntry({id: entryId});
The variables for the mutation.
Deletes a review on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.deleteReview({id: 1});
The variables for the mutation.
Deletes a thread on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.deleteThread({id: 1});
The variables for the mutation.
Deletes a thread comment on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.deleteThreadComment({id: 1});
The variables for the mutation.
Saves an activity reply on the Anilist API. If no id
is provided, a new activity reply will be created. If an id
is provided, the activity reply with that id
will be updated.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveActivityReply({activityId: 1, text: 'Hello, world!'});
The variables for the mutation.
Saves a list activity on the Anilist API. Mod Only
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveListActivity({id: 1});
The variables for the mutation.
Saves a media list entry on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveMediaListEntry({mediaId: 1, status: 'COMPLETED'});
The variables for the mutation.
Saves a message activity on the Anilist API. If no id
is provided, a new activity will be created. If an id
is provided, the activity with that id
will be updated.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveMessageActivity({text: 'Hello, world!'});
The variables for the mutation.
Saves a recommendation on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveRecommendation({mediaId: 1, mediaRecommendationId: 2, rating: 8});
The variables for the mutation.
Saves a review on the Anilist API. If no id
is provided, a new review will be created. If an id
is provided, the review with that id
will be updated.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveReview({mediaId: 1, body: 'testing', summary: 'testing', score: 8, private: true});
The variables for the mutation.
Saves a text activity on the Anilist API. If no id
is provided, a new activity will be created. If an id
is provided, the activity with that id
will be updated.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveTextActivity({text: 'Hello, world!'});
The variables for the mutation.
Saves a thread on the Anilist API. If no id
is provided, a new thread will be created. If an id
is provided, the thread with that id
will be updated.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveThread({title: 'Hello, world!', body: 'Hello, world!'});
The variables for the mutation.
Saves a thread comment on the Anilist API. If no id
is provided, a new thread comment will be created. If an id
is provided, the thread comment with that id
will be updated.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.saveThreadComment({threadId: 1, comment: 'Hello, world!'});
The variables for the mutation.
Toggles the pin status of an activity on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.toggleActivityPin({id: 1, pinned: true});
The variables for the mutation.
Toggles the subscription status of an activity on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.toggleActivitySubscription({activityId: 1, subscribe: true});
The variables for the mutation.
Toggles a favorite on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.toggleFavorite({studioId: 561});
The variables for the mutation.
Toggles a follow on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.toggleFollow({userId: 542244});
The variables for the mutation.
Toggles a like on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.toggleLike({id: 1, type: 'ACTIVITY'});
The variables for the mutation.
Toggles a like on the Anilist API.
Returns a different response than the toggleLike
mutation.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.toggleLikeV2({id: 1, type: 'ACTIVITY'});
The variables for the mutation.
Toggles a thread subscription on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.toggleThreadSubscription({threadId: 1, subscribe: true});
The variables for the mutation.
Updates the AniChart highlights for a user on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.updateAniChartHighlights({highlights: [{mediaId: 1, highlight: 'test'}]});
The variables for the mutation.
Updates the AniChart settings for a user on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.updateAniChartSettings({titleLanguage: 'romaji', theme: 'dark'});
The variables for the mutation.
Updates the order of favourites on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.updateFavouriteOrder({ids: [1, 2, 3]});
The variables for the mutation.
Updates media list entries on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.updateMediaListEntries({
status: 'CURRENT',
score: 8.5,
progress: 3,
ids: [143271, 156822, 170890],
});
The variables for the mutation.
Updates a user on the Anilist API.
A promise that resolves when the mutation is complete.
await aniLink.anilist.mutation.updateUser({
about: 'New about text',
titleLanguage: 'ENGLISH',
displayAdultContent: true,
airingNotifications: true,
scoreFormat: 'POINT_10',
rowOrder: 'title',
profileColor: 'blue',
donatorBadge: 'Supporter',
notificationOptions: [{type: 'AIRING', enabled: true}],
timezone: '-06:00',
activityMergeTime: 30,
animeListOptions: {sectionOrder: ['title'], customLists: ['test'], advancedScoring: [], advancedScoringEnabled: false},
mangaListOptions: {sectionOrder: ['title'], customLists: ['test'], advancedScoring: [], advancedScoringEnabled: false},
staffNameLanguage: 'ROMAJI',
restrictMessagesToFollowing: false,
disabledListActivity: [{type: 'CURRENT', disabled: false}]
});
The variables for the mutation.
Query methods for fetching data from the Anilist API.
Fetches activity data from the Anilist API.
A promise that resolves to the activity data.
await aniLink.anilist.query.activity({id: 723235883, asHtml: true});
The variables for the query.
Fetches activity reply data from the Anilist API.
A promise that resolves to the activity reply data.
await aniLink.anilist.query.activityReply({id: 12191046, asHtml: true});
The variables for the query.
Fetches airing schedule data from the Anilist API.
A promise that resolves to the airing schedule data.
await aniLink.anilist.query.airingSchedule({mediaId: 130590});
Must be quering an airing anime. Returns error if not.
The variables for the query.
Fetches aniChart user data from the Anilist API.
A promise that resolves to the aniChart user data.
await aniLink.anilist.query.aniChartUser();
Must be authenticated.
Fetches character data from the Anilist API.
A promise that resolves to the character data.
await aniLink.anilist.query.character({
id: 1,
asHtml: true,
mediaSort: ['POPULARITY_DESC'],
mediaType: 'ANIME',
mediaOnList: true,
mediaPage: 1,
mediaPerPage: 10
});
The variables for the query.
Fetches external link source collection data from the Anilist API.
A promise that resolves to the external link source collection data.
await aniLink.anilist.query.externalLinkSourceCollection();
Fetches follower data from the Anilist API.
A promise that resolves to the follower data.
await aniLink.anilist.query.follower({userId: 542244});
The variables for the query.
Fetches following data from the Anilist API.
A promise that resolves to the following data.
await aniLink.anilist.query.following({userId: 542244});
The variables for the query.
Fetches genre collection data from the Anilist API.
A promise that resolves to the genre collection data.
await aniLink.anilist.query.genreCollection()
Fetches markdown data from the Anilist API.
A promise that resolves to the markdown data.
await aniLink.anilist.query.markdown({markdown: 'Hello, world!'});
The variables for the query.
Fetches media data from the Anilist API.
A promise that resolves to the media data.
await aniLink.anilist.query.media({id: 1, type: 'ANIME'});
The variables for the query.
Fetches media list data from the Anilist API.
A promise that resolves to the media list data.
await aniLink.anilist.query.mediaList({userId: 542244});
The variables for the query.
Fetches media list collection data from the Anilist API.
A promise that resolves to the media list collection data.
await aniLink.anilist.query.mediaListCollection({
userId: 542244,
type: 'ANIME',
status: 'COMPLETED',
chunk: 1,
perChunk: 10000
});
The variables for the query.
Fetches media tag collection data from the Anilist API.
A promise that resolves to the media tag collection data.
await aniLink.anilist.query.mediaTagCollection()
Fetches media trend data from the Anilist API.
A promise that resolves to the media trend data.
await aniLink.anilist.query.mediaTrend({mediaId: 1, type: 'ANIME'});
The variables for the query.
Fetches notification data from the Anilist API.
A promise that resolves to the notification data.
await aniLink.anilist.query.notification({asHtml: true});
Must be authenticated.
The variables for the query.
Fetches pages of data from the Anilist API.
All page queries have the same structure as original queries with the addition of page
and perPage
variables.
Fetches activities data from the Anilist API.
A promise that resolves to the activities data.
await aniLink.anilist.query.page.activities({page: 1, perPage: 10, userId: 542244});
The variables for the query.
Fetches activity replies data from the Anilist API.
A promise that resolves to the activity replies data.
await aniLink.anilist.query.page.activityReplies({page: 1, perPage: 10, activityId: 723235883});
The variables for the query.
Fetches airing schedules data from the Anilist API.
A promise that resolves to the airing schedules data.
await aniLink.anilist.query.page.airingSchedules({page: 1, perPage: 10});
The variables for the query.
Fetches characters data from the Anilist API.
A promise that resolves to the characters data.
await aniLink.anilist.query.page.characters({page: 1, perPage: 10});
The variables for the query.
Fetches followers data from the Anilist API.
A promise that resolves to the followers data.
await aniLink.anilist.query.page.followers({page: 1, perPage: 10, userId: 542244});
The variables for the query.
Fetches following data from the Anilist API.
A promise that resolves to the following data.
await aniLink.anilist.query.page.following({page: 1, perPage: 10, userId: 542244});
The variables for the query.
Fetches likes data from the Anilist API.
A promise that resolves to the likes data.
await aniLink.anilist.query.page.likes({page: 1, perPage: 10, likeAbleId: 1});
The variables for the query.
Fetches media lists data from the Anilist API.
A promise that resolves to the media lists data.
await aniLink.anilist.query.page.mediaLists({page: 1, perPage: 10, userId: 542244});
The variables for the query.
Fetches media trends data from the Anilist API.
A promise that resolves to the media trends data.
await aniLink.anilist.query.page.mediaTrends({page: 1, perPage: 10, type: 'ANIME'});
Must be quering an airing anime. Returns error if not.
The variables for the query.
Fetches medias data from the Anilist API.
A promise that resolves to the medias data.
await aniLink.anilist.query.page.medias({page: 1, perPage: 10, type: 'ANIME'});
The variables for the query.
Fetches notifications data from the Anilist API.
A promise that resolves to the notifications data.\
await aniLink.anilist.query.page.notifications({page: 1, perPage: 10});
The variables for the query.
Fetches recommendations data from the Anilist API.
A promise that resolves to the recommendations data.
await aniLink.anilist.query.page.recommendations({page: 1, perPage: 10, mediaId: 1});
The variables for the query.
Fetches reviews data from the Anilist API.
A promise that resolves to the reviews data.
await aniLink.anilist.query.page.reviews({page: 1, perPage: 10, mediaId: 1});
The variables for the query.
Fetches staffs data from the Anilist API.
A promise that resolves to the staffs data.
await aniLink.anilist.query.page.staffs({page: 1, perPage: 10});
The variables for the query.
Fetches studios data from the Anilist API.
A promise that resolves to the studios data.
await aniLink.anilist.query.page.studios({page: 1, perPage: 10});
The variables for the query.
Fetches thread comments data from the Anilist API.
A promise that resolves to the thread comments data.
await aniLink.anilist.query.page.threadComments({page: 1, perPage: 10, threadId: 71881});
The variables for the query.
Fetches threads data from the Anilist API.
A promise that resolves to the threads data.
await aniLink.anilist.query.page.threads({page: 1, perPage: 10});
The variables for the query.
Fetches users data from the Anilist API.
A promise that resolves to the users data.
await aniLink.anilist.query.page.users({page: 1, perPage: 10});
The variables for the query.
Fetches recommendation data from the Anilist API.
A promise that resolves to the recommendation data.
await aniLink.anilist.query.recommendation({mediaId: 156822, asHtml: true});
The variables for the query.
Fetches review data from the Anilist API.
A promise that resolves to the review data.
await aniLink.anilist.query.review({id: 8008, asHtml: true});
The variables for the query.
Fetches site statistics data from the Anilist API.
A promise that resolves to the site statistics data.
await aniLink.anilist.query.siteStatistics();
Fetches staff data from the Anilist API.
A promise that resolves to the staff data.
await aniLink.anilist.query.staff({
id: 132186,
asHtml: true,
staffMediaSort: ['POPULARITY_DESC'],
staffMediaType: 'ANIME',
staffMediaOnList: true,
staffMediaPage: 1,
staffMediaPerPage: 10,
charactersSort: ['ID'],
charactersPage: 1,
charactersPerPage: 10,
characterMediaSort: ['POPULARITY_DESC'],
characterMediaOnList: true,
characterMediaPage: 1,
characterMediaPerPage: 10
});
The variables for the query.
Fetches studio data from the Anilist API.
A promise that resolves to the studio data.
await aniLink.anilist.query.studio({id: 561, asHtml: true});
The variables for the query.
Fetches thread data from the Anilist API.
A promise that resolves to the thread data.
await aniLink.anilist.query.thread({id: 71881, asHtml: true});
The variables for the query.
Fetches thread comment data from the Anilist API.
A promise that resolves to the thread comment data.
await aniLink.anilist.query.threadComment({id: 2555166, asHtml: true});
The variables for the query.
Fetches user data from the Anilist API.
A promise that resolves to the user's data.
await aniLink.anilist.query.user({id: 542244, isHTML: true});
The variables for the query.
Fetches viewer data from the Anilist API.
A promise that resolves to the viewer data.
await aniLink.anilist.query.viewer({isHTML: true});
Must be authenticated.
AniLink
is a class for interacting with the APIs. It provides methods for querying and mutating data.