Skip to main content

User

This is an object representing an User. The API allows you to retrieve individual User as well as a list of them using various filters. Furthermore it lets you update and delete an User.

Endpoints
GET/v1/user/:id
GET/v1/user
POST/v1/user
DELETE/v1/user

The User object#

Attributes#


id integer#

Unique identifier for an User.


username string#

The User's username.


email string confidential#

The User's email.

note

This field is obscured1 to not-authorized in order to avoid email adresses' collecting behaviours.


email_verified bool confidential#

Indicates if the User has already confirmed their email.

note

This field is obscured1 to not-authorized.


role enum#

The User's role inside AniAPI.

Possible role enum values
"BASIC": 0,"MODERATOR": 1,"ADMINISTRATOR": 2

avatar string#

The User's avatar. This value is imported from external User's trackers.


gender enum#

The User's gender.

Possible gender enum values
"UNKNOWN": 0,"MALE": 1,"FEMALE": 2

localization string confidential#

The User's preferred locale reference.

info

Check on Resource for further details on locales.


has_anilist bool nullable#

Indicates if the User has linked their AniList account with AniAPI.


has_mal bool nullable#

Indicates if the User has linked their MyAnimeList account with AniAPI.


Example#

User object example
{  "username": "Dazorn",  "role": 0,  "gender": 1,  "avatar": "https://s4.anilist.co/file/anilistcdn/user/avatar/large/b192651-setw7IgPvmZS.jpg",  "id": 1}

Retrieve a specific User#

GET/v1/user/:id

Retrieves an User, based on its unique identifier.

Parameters#

No parameters.

Returns#

Returns an obscured1 User object if a valid identifier was provided.

Try it#

This feature is not available on mobile.

Get a list of User#

GET/v1/user

Returns a list of obscured1 User objects. The Users are returned sorted by username, following alphabetical ascending order.

Parameters#


username string optional#

A case-insensitive pattern filter on the list based on the username field value.


email string optional#

A case-sensitive filter on the list based on the email field value.


Returns#

Returns an array of obscured1 User objects with a size based on the filter provided.

Try it#

This feature is not available on mobile.

Update an User#

warning

We recommend you to not implement an User's update data form.

Instead, we strongly suggest you to redirect the User to the profile web page and to let us do the rest ♥.

POST/v1/user

Updates an User based on the provided values.

Parameters#


id integer required#

The User's id to update


password string optional#

The User's new password value.


gender enum required#

The User's gender value.


localization string optional#

The User's new localization value.


anilist_id integer optional#

The User's AniList account external id.


anilist_token string optional#

The User's AniList account external token. This value becomes required when you provide the anilist_id field.


Returns#

Returns the updated User object.

Example#

Example User update request
fetch('https://api.aniapi.com/v1/user', {  method: 'POST',  headers: {    'Authorization': 'Bearer <YOUR_JWT>',    'Content-Type': 'application/json',    'Accept': 'application/json'  },  body: {    id: 1,    gender: 1,    localization: 'it'  }});
Example User update response
{  "status_code": 200,  "message": "User updated",  "data": {    "username": "Dazorn",    "role": 0,    "gender": 1,    "localization": "it",    "has_anilist": true,    "has_mal": false,    "id": 1  },  "version": "1"}

Delete an User#

DELETE/v1/user

Deletes an User based on the provided unique identifier.

Parameters#

No parameters.

Returns#

No particular return.

Example#

Example User delete request
fetch('https://api.aniapi.com/v1/user/1', {  method: 'DELETE',  headers: {    'Authorization': 'Bearer <YOUR_JWT>',    'Content-Type': 'application/json',    'Accept': 'application/json'  }});
Example User delete response
{  "status_code": 200,  "message": "User deleted",  "data": "",  "version": "1"}

  1. An obscured object has certain fields hidden