MyAnimeList Unofficial API

MyAnimeList Unofficial API Documentation

This unofficial API is a supplement to the official API. The main reasons I'm working on this are:

Please report any bugs to @sliceoflifer on Twitter.

Table of Contents

Summary

The MyAnimeList Unofficial API allows developers to interact with the MyAnimeList site programmatically via HTTP requests.

Read methods

All read methods are HTTP GET requests. Some requests require authentication. The response data format is JSON by default (see data formats for XML responses).

Request Description Example
/animelist/username Fetch a user's anime list http://mal-api.com/animelist/xinil
/anime/anime_id Fetch an anime's details http://mal-api.com/anime/1887
/history/username Fetch a user's history http://mal-api.com/history/xinil
/anime/search Search for anime matching a query. http://mal-api.com/anime/search?q=haruhi
/anime/top Fetch the top anime. http://mal-api.com/anime/top
/anime/popular Fetch the popular anime. http://mal-api.com/anime/popular
/anime/upcoming Fetch the upcoming anime. http://mal-api.com/anime/upcoming
/anime/just_added Fetch the just added anime. http://mal-api.com/anime/just_added
/mangalist/username Fetch a user's manga list http://mal-api.com/mangalist/xinil
/manga/manga_id Fetch a manga's details http://mal-api.com/anime/104

Check out the full documentation for these read methods below.

Write methods

All write methods are HTTP POST, PUT or DELETE requests. Read the section on HTTP verb emulation if you have difficulties performing PUT or DELETE requests. Authentication is required.

Request Method Description Arguments
/animelist/anime POST Add an anime to user's anime list anime_id, status?, episodes?, score?
/animelist/anime/anime_id PUT Update an anime already on user's anime list status?, episodes?, score?
/animelist/anime/anime_id DELETE Delete an anime from user's anime list -

Check out the full documentation for these write methods below.

Core Concepts

Making API requests

All API methods are HTTP requests and support the full set of HTTP verbs - GET, POST, HEAD, PUT, DELETE. If your client doesn't support the full set of HTTP verbs and is capable of only GET and POST requests, HTTP verb emulation is also supported.

HTTP verb emulation

If you're using a client that only supports GET and POST requests, or making API requests from a web browser via AJAX, you'll need to fake PUT, DELETE and HEAD requests. Simply send along a _method parameter as part of your request body with the HTTP verb (case-insensitive).

For example, to emulate a HTTP DELETE to /animelist/anime/1:

POST /animelist/anime/1

Request body:
_method=delete

Response types

Anime list

An anime list is a user's personal list of anime. It also includes statistics on a user based on her list, such as her average score given to anime and number of days spent watching anime.

Format:

Anime

Note that not all these properties are available in /animelist requests and will be indicated below.

These additional properties are available for authenticated users who have the requested anime on their anime list:

Manga list

An anime list is a user's personal list of manga.

Format:

Manga

These additional properties are available for authenticated users who have the requested manga on their manga list:

Data formats

The MyAnimeList Unofficial API supports both JSON and XML output formats. Specify the output format using the format parameter (JSON is the default):

http://mal-api.com/anime/1887?format=json
http://mal-api.com/anime/1887?format=xml

Authentication

Authentication is required for certain API requests. The MyAnimeList Unofficial API only supports HTTP Basic Authentication because of the limitations of the MyAnimeList site.

Is my password secure?

The MyAnimeList Unofficial API takes your username and password and authenticates it with MyAnimeList directly - no passwords are saved or logged.

However, it is clearly inferior to secure solutions like OAuth and requires you to trust an unofficial API with your MyAnimeList password. It bothers us too. You can help us bug the MyAnimeList developers at the MAL API club.

Errors

The API returns appropriate HTTP status codes. In addition, the API also includes error information in the response body. Error responses have a single error property that is a string describing the error, e.g.:

{"error":"forbidden"}

An additional details property is sometimes available for further diagnostics.

Possible error codes are:

Reading data from MyAnimeList

/animelist - Read an anime list

Fetch an anime list with the given username:

http://mal-api.com/animelist/username

Example: http://mal-api.com/animelist/xinil

The response is an anime list.

/anime - Read an anime's details

Fetch an anime with the given anime id:

http://mal-api.com/anime/anime_id

Example: http://mal-api.com/anime/1887

The response is an anime.

The following optional parameters are supported:

/history - Read a user's history

NOT YET IMPLEMENTED

Fetch the history of a user with the given username.

http://mal-api.com/history/username

Example: http://mal-api.com/history/xinil

The response is a list of anime and/or manga IDs together with the episode/chapter watched or read, and the time it was watched or read.

TODO Give an example of the response format.

Anime-only and manga-only history

To get only the user's anime history, use the http://mal-api.com/history/username/anime

To get only the user's manga history, use the http://mal-api.com/history/username/manga

/anime/search - Search anime

Search for anime matching a query.

http://mal-api.com/anime/search?q=query

Example: http://mal-api.com/anime/search?q=haruhi

Only 1 required parameter is supported:

The response is a list of anime. Only the following anime properties are available: id, title, episodes, type, synopsis, image_url, members_score, classification

/anime/top - Read the top anime

NOT YET IMPLEMENTED

Fetch the top ranking anime.

http://mal-api.com/anime/top

Example: http://mal-api.com/anime/top?page=1&per_page=30

The following optional parameters are supported:

How are the top anime determined?

To quote MyAnimeList:

Weighted Rank (WR) = (v / (v + m)) * S + (m / (v + m)) * C

S = Average score for the Anime (mean).
v = Number of votes for the Anime = (Number of people scoring the Anime).
m = Minimum votes/scores required to get a calculated score (currently 50 scores required).
C = The mean score across the entire Anime DB.

NOT YET IMPLEMENTED

Fetch the most popular anime. The popularity of an anime is determined by the number of MyAnimeList members watching it.

http://mal-api.com/anime/popular

Example: http://mal-api.com/anime/popular?page=1&per_page=30

The following optional parameters are supported:

/anime/upcoming - Read the upcoming anime

NOT YET IMPLEMENTED

Fetch the upcoming anime. This is a list of anime sorted by airing date.

http://mal-api.com/anime/upcoming

Example: http://mal-api.com/anime/upcoming?start_date=20090815

The following optional parameters are supported:

/anime/just_added - Read the anime that have just been added to MyAnimeList

NOT YET IMPLEMENTED

Fetch anime that have just been added to the MyAnimeList database. The anime are sorted with the most recently added ones in front.

http://mal-api.com/anime/just_added

Example: http://mal-api.com/anime/just_added?page=1&per_page=30

The following optional parameters are supported:

/mangalist - Read a manga list

NOT YET IMPLEMENTED

Fetch a manga list with the given username:

http://mal-api.com/mangalist/username

Example: http://mal-api.com/mangalist/xinil

The response is a manga list.

/manga - Read a manga's details

Retrieve details for the manga with the given manga id:

http://mal-api.com/manga/manga_id

Example: http://mal-api.com/manga/104

The response is an manga.

The following optional parameters are supported:

Writing data to MyAnimeList

All write methods require authentication.

/animelist/anime - Add anime to anime list

Adds an anime to a user's anime list:

POST http://mal-api.com/animelist/anime

Parameters:

Example:

POST http://mal-api.com/animelist/anime

Request body:
  anime_id=1887
  status=watching
  episodes=1
  score=9

/animelist/anime/anime_id - Update an anime on user's anime list

Updates an anime already on a user's anime list:

PUT http://mal-api.com/animelist/anime/anime_id

Parameters:

Example:

PUT http://mal-api.com/animelist/anime/1887

Request body:
  status=completed
  episodes=24
  score=10

/animelist/anime/anime_id - Delete an anime from user's anime list

Delete an anime from a user's anime list. This removes any record of the anime from a user's anime list and cannot be undone.

DELETE http://mal-api.com/animelist/anime/anime_id

Parameters: none.

Returns: HTTP 200 OK and the original anime (this is useful for undoing a delete) if the anime was successfully deleted from animelist. Otherwise, returns appropriate HTTP response code and an error message.

Example:

DELETE http://mal-api.com/animelist/anime/1887

Utility methods

/account/verify_credentials - Test if user credentials are valid

Test whether supplied user credentials are valid. The authentication mechanism is HTTP Basic Authentication. This method is rate-limited (the response status code will be HTTP 503 Service Temporarily Unavailable) because it can be a vector for brute force attacks.

http://mal-api.com/account/verify_credentials

The response is an HTTP 200 OK status code if authentication was successful. Otherwise, an HTTP 401 Unauthorized status code is returned.