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
  • Making a GraphQL API request
  • Tooling
  1. docs
  2. guide
  3. graphql

What is GraphQL?

Getting started with AniList's GraphQL API.

PreviousErrorsNextMutations

Last updated 7 months ago

is a strongly typed API query language. It allows clients to define the structure of data required and the server will respond with data in the same structure. This helps avoid the problems of both over and under-fetching data, while also allowing for a more powerful and flexible API.

:::info Prerequisite Knowledge Before continuing, it is highly recommended that you familiarize yourself with GraphQL. The is a good place to start. :::

Making a GraphQL API request

AniList requires all GraphQL requests be made as POST requests to https://graphql.anilist.co.

When making a request, you will need to include 2 objects in your payload: query and variables.

  • query: This is your query or mutation string. It defines the data and shape of data that you would like.

  • variables: Contains the values for the variables used within your query.

The variables object is optional if you are not using any, however, it is recommended that you use variables wherever it makes sense.

:::details Example Query Let's create a simple query to get an anime by it's unique ID.

::: code-group <<< @/guide/snippets/graphql/getting-started/javascript.js{js:line-numbers} [Javascript] <<< @/guide/snippets/graphql/getting-started/php.php{php:line-numbers} [PHP] <<< @/guide/snippets/graphql/getting-started/python.py{py:line-numbers} [Python] <<< @/guide/snippets/graphql/getting-started/rust.rs{rs:line-numbers} [Rust] :::

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

{
  "data": {
    "Media": {
      "id": 15125,
      "title": {
        "romaji": "Teekyuu",
        "english": "Teekyuu",
        "native": "てーきゅう"
      }
    }
  }
}

Tooling

These are some recommended tools for working with AniList:

  • Apollo Studio is a powerful tool for exploring and testing your GraphQL queries. It is a great way to get started with GraphQL and AniList.

  • Skip service-specific API clients and generate always up-to-date typings for your language of choice.

GraphQL has been used in major projects throughout the industry for over a decade, including Airbnb, Intuit, Microsoft, and more. It is battle tested and has for you to use.

GraphQL
official GraphQL documentation
Apollo Studio
many powerful tools
Apollo Studio
GraphQL Codegen