# AniList

{% hint style="success" %}
Difficulty: Easy
{% endhint %}

## Permission

{% hint style="warning" %}
`anilist` permission is required.
{% endhint %}

<pre class="language-json" data-title="my-plugin.json"><code class="lang-json">{
    //...
    "plugin": {
        "permissions": {
<strong>            "scopes": ["anilist"]
</strong>        }
    }
}
</code></pre>

## Refresh collections

This is needed if you edit the user's collection.

```typescript
$anilist.refreshAnimeCollection()
$anilist.refreshMangaCollection()
```

## Empty cache

Clears the cache for fetched anime/manga entries.

```typescript
$anilist.clearCache()
```

## Update entry

```typescript
$anilist.updateEntry(
    mediaId: number,
    status: $app.AL_MediaListStatus | undefined,
    scoreRaw: number | undefined,
    progress: number | undefined,
    startedAt: $app.AL_FuzzyDateInput | undefined,
    completedAt: $app.AL_FuzzyDateInput | undefined,
): void
```

## Update entry progress

```typescript
$anilist.updateEntryProgress(
    mediaId: number,
    progress: number,
    status: $app.AL_MediaListStatus | undefined,
): void
```

## Update entry repeat

```typescript
$anilist.updateEntryRepeat(mediaId: number, repeat: number): void
```

## Delete entry

```typescript
$anilist.deleteEntry(mediaListEntryId: number): void
```

## Add media to collection

```typescript
/**
* Add media to collection.
* 
* This will add the media to the collection with the status "PLANNING".
* 
* The anime/manga collection should be refreshed after adding the media.
*/
$anilist.addMediaToCollection(mediaIds: number[]): void
```

## Get collections

```typescript
/**
* Get the user's anime collection.
* This collection does not include lists with no status.
*/
$anilist.getAnimeCollection(bypassCache: boolean): $app.AL_AnimeCollection

/**
* Get the raw anime collection data.
* This collection includes lists with no status.
*/
$anilist.getRawAnimeCollection(bypassCache: boolean): $app.AL_AnimeCollection

/**
* Get the user's manga collection.
* This collection does not include lists with no status.
*/
$anilist.getMangaCollection(bypassCache: boolean): $app.AL_MangaCollection

/**
* Get the raw manga collection data.
* This collection includes lists with no status.
*/
$anilist.getRawMangaCollection(bypassCache: boolean): $app.AL_MangaCollection

/**
* Get anime collection with relations
*/
$anilist.getAnimeCollectionWithRelations(): $app.AL_AnimeCollectionWithRelations
```

## Get anime/manga data

```typescript
/**
* Get anime by ID
*/
$anilist.getAnime(id: number): $app.AL_BaseAnime

/**
* Get manga by ID
*/
$anilist.getManga(id: number): $app.AL_BaseManga

/**
* Get detailed anime info by ID
*/
$anilist.getAnimeDetails(id: number): $app.AL_AnimeDetailsById_Media

/**
* Get detailed manga info by ID
*/
$anilist.getMangaDetails(id: number): $app.AL_MangaDetailsById_Media

/**
* Get studio details
*/
$anilist.getStudioDetails(studioId: number): $app.AL_StudioDetails
```

## Search / List

```typescript
/**
 * List anime based on search criteria
 */
$anilist.listAnime(
    page: number | undefined,
    search: string | undefined,
    perPage: number | undefined,
    sort: $app.AL_MediaSort[] | undefined,
    status: $app.AL_MediaStatus[] | undefined,
    genres: string[] | undefined,
    averageScoreGreater: number | undefined,
    season: $app.AL_MediaSeason | undefined,
    seasonYear: number | undefined,
    format: $app.AL_MediaFormat | undefined,
    isAdult: boolean | undefined,
): $app.AL_ListAnime

/**
 * List manga based on search criteria
 */
$anilist.listManga(
    page: number | undefined,
    search: string | undefined,
    perPage: number | undefined,
    sort: $app.AL_MediaSort[] | undefined,
    status: $app.AL_MediaStatus[] | undefined,
    genres: string[] | undefined,
    averageScoreGreater: number | undefined,
    startDateGreater: string | undefined,
    startDateLesser: string | undefined,
    format: $app.AL_MediaFormat | undefined,
    countryOfOrigin: string | undefined,
    isAdult: boolean | undefined,
): $app.AL_ListManga

/**
 * List recent anime
 */
$anilist.listRecentAnime(
    page: number | undefined,
    perPage: number | undefined,
    airingAtGreater: number | undefined,
    airingAtLesser: number | undefined,
    notYetAired: boolean | undefined,
): $app.AL_ListRecentAnime
```

## Custom GraphQL query

```typescript
$anilist.customQuery<T = any>(body: Record<string, any>, token: string): T
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://seanime.gitbook.io/seanime-extensions/plugins/apis/anilist.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
