AniList APIv2 Docs
  • README
  • docs
    • index
    • guide
      • Considerations
      • Introduction
      • Rate Limiting
      • Terms of Use
      • auth
        • Authenticated Requests
        • Authorization Code Grant
        • Implicit Grant
        • Getting Started
      • graphql
        • Connections
        • Errors
        • What is GraphQL?
        • Mutations
        • Pagination
        • What's Next?
        • queries
          • Queries
          • Media List
          • Media
          • User
      • migration
        • version-1
          • Migrating from API v1
          • Api v1 to Api v2 migration queries
    • reference
      • API Reference
      • Root Mutation
      • Root Query
      • enum
        • ActivitySort
        • ActivityType
        • AiringSort
        • CharacterRole
        • CharacterSort
        • ExternalLinkMediaType
        • ExternalLinkType
        • LikeableType
        • MediaFormat
        • MediaListSort
        • MediaListStatus
        • MediaRankType
        • MediaRelation
        • MediaSeason
        • MediaSort
        • MediaSource
        • MediaStatus
        • MediaTrendSort
        • MediaType
        • ModActionType
        • ModRole
        • NotificationType
        • RecommendationRating
        • RecommendationSort
        • ReviewRating
        • ReviewSort
        • RevisionHistoryAction
        • ScoreFormat
        • SiteTrendSort
        • StaffLanguage
        • StaffSort
        • StudioSort
        • SubmissionSort
        • SubmissionStatus
        • ThreadCommentSort
        • ThreadSort
        • UserSort
        • UserStaffNameLanguage
        • UserStatisticsSort
        • UserTitleLanguage
      • input
        • AiringScheduleInput
        • AniChartHighlightInput
        • CharacterNameInput
        • FuzzyDateInput
        • ListActivityOptionInput
        • MediaExternalLinkInput
        • MediaListOptionsInput
        • MediaTitleInput
        • NotificationOptionInput
        • StaffNameInput
      • object
        • ActivityLikeNotification
        • ActivityMentionNotification
        • ActivityMessageNotification
        • ActivityReply
        • ActivityReplyLikeNotification
        • ActivityReplyNotification
        • ActivityReplySubscribedNotification
        • AiringNotification
        • AiringProgression
        • AiringSchedule
        • AiringScheduleConnection
        • AiringScheduleEdge
        • AniChartUser
        • Character
        • CharacterConnection
        • CharacterEdge
        • CharacterImage
        • CharacterName
        • CharacterSubmission
        • CharacterSubmissionConnection
        • CharacterSubmissionEdge
        • Deleted
        • Favourites
        • FollowingNotification
        • FormatStats
        • FuzzyDate
        • GenreStats
        • InternalPage
        • ListActivity
        • ListActivityOption
        • ListScoreStats
        • Media
        • MediaCharacter
        • MediaConnection
        • MediaCoverImage
        • MediaDataChangeNotification
        • MediaDeletionNotification
        • MediaEdge
        • MediaExternalLink
        • MediaList
        • MediaListCollection
        • MediaListGroup
        • MediaListOptions
        • MediaListTypeOptions
        • MediaMergeNotification
        • MediaRank
        • MediaStats
        • MediaStreamingEpisode
        • MediaSubmission
        • MediaSubmissionComparison
        • MediaSubmissionEdge
        • MediaTag
        • MediaTitle
        • MediaTrailer
        • MediaTrend
        • MediaTrendConnection
        • MediaTrendEdge
        • MessageActivity
        • ModAction
        • NotificationOption
        • Page
        • PageInfo
        • ParsedMarkdown
        • Recommendation
        • RecommendationConnection
        • RecommendationEdge
        • RelatedMediaAdditionNotification
        • Report
        • Review
        • ReviewConnection
        • ReviewEdge
        • RevisionHistory
        • ScoreDistribution
        • SiteStatistics
        • SiteTrend
        • SiteTrendConnection
        • SiteTrendEdge
        • Staff
        • StaffConnection
        • StaffEdge
        • StaffImage
        • StaffName
        • StaffRoleType
        • StaffStats
        • StaffSubmission
        • StatusDistribution
        • Studio
        • StudioConnection
        • StudioEdge
        • StudioStats
        • TagStats
        • TextActivity
        • Thread
        • ThreadCategory
        • ThreadComment
        • ThreadCommentLikeNotification
        • ThreadCommentMentionNotification
        • ThreadCommentReplyNotification
        • ThreadCommentSubscribedNotification
        • ThreadLikeNotification
        • User
        • UserActivityHistory
        • UserAvatar
        • UserCountryStatistic
        • UserFormatStatistic
        • UserGenreStatistic
        • UserLengthStatistic
        • UserModData
        • UserOptions
        • UserPreviousName
        • UserReleaseYearStatistic
        • UserScoreStatistic
        • UserStaffStatistic
        • UserStartYearStatistic
        • UserStatistics
        • UserStatisticTypes
        • UserStats
        • UserStatusStatistic
        • UserStudioStatistic
        • UserTagStatistic
        • UserVoiceActorStatistic
        • YearStats
      • union
        • ActivityUnion Reference
        • LikeableUnion
        • NotificationUnion
Powered by GitBook
On this page
  • Create
  • Update
  1. docs
  2. guide
  3. graphql

Mutations

Creating and modifying data on the AniList.

PreviousWhat is GraphQL?NextPagination

Last updated 7 months ago

allow you to create, update, and delete data. All mutations require authentication, so you will need to before you can use them.

::: tip Unlike queries, where you can exclude the query keyword, mutations require the mutation keyword. :::

The majority of our mutations have the following prefixes:

  • Save: Create new or update existing data

    We usually determine if you would like to create or update data depending on if you provide an id or not.

  • Delete: Delete data

    This will usually return a object type. However, some mutations will return an updated version of the sibling data if this is more useful.

  • Toggle: Toggle a boolean value

::: info Authorization needed In the examples below, you will also need to include your access token in the Authorization header of your request. For the sake of brevity, we will be skipping that step here. :::

Create

Let's create a new media list entry on our user's list. We'll use , which has an ID of 1, as an example.

:::details Example Query

::: code-group

<<< @/guide/snippets/graphql/mutations/create/php.php{php:line-numbers} [PHP]

:::

The request in the above example will return the following JSON response:

{
  "data": {
    "SaveMediaListEntry": {
        "id": 4,
        "status": "CURRENT"
    }
  }
}

Keep in mind that the id that was returned is the ID of the newly created list entry.

Update

Using the id returned above, we can update the status of the list entry.

Note how the above mutation includes the $listEntryId variable, which is used to identify the list entry to update. It went unused in the example above, but we can make use of it now.

If using the above studio link, you will need to replace the listEntryId variable with the ID returned from the previous mutation.

::: code-group

<<< @/guide/snippets/graphql/mutations/update/php.php{php:line-numbers} [PHP]

:::

The request in the above example will return an identical response to the one above, but with the status field updated to COMPLETED.

:::details Example Query

Mutations
obtain an access token
Deleted
Cowboy Bebop
Apollo Studio
Apollo Studio