Skip to main content
The AnimeThemes GraphQL API uses a strongly-typed schema built on GraphQL type system principles. This page explains the core types, scalars, and patterns used throughout the API.

Scalar Types

Scalars represent primitive values in the GraphQL schema.

Built-in Scalars

  • Int: Signed 32-bit integer
  • String: UTF-8 character sequence
  • Boolean: True or false value
  • ID: Unique identifier, serialized as a string

Custom Scalars

Mixed

A flexible scalar type that can represent any JSON-serializable value.
scalar Mixed
Use cases:
  • Dynamic filter values
  • Flexible metadata fields
  • Variable JSON structures

Enum Types

Enums represent a fixed set of possible values.

AnimeMediaFormat

Represents the format/medium of an anime production.
enum AnimeMediaFormat {
  TV
  MOVIE
  OVA
  ONA
  SPECIAL
  MUSIC_VIDEO
}

AnimeSeason

Represents the broadcast season.
enum AnimeSeason {
  WINTER
  SPRING
  SUMMER
  FALL
}

ThemeType

Represents the type of anime theme.
enum ThemeType {
  OP  # Opening theme
  ED  # Ending theme
  IN  # Insert song
}

VideoSource

Represents the source of video files.
enum VideoSource {
  WEB
  RAW
  BD   # Blu-ray Disc
  DVD
  VHS
  LD   # LaserDisc
}

VideoOverlap

Represents how the video transitions with the episode.
enum VideoOverlap {
  NONE    # Clean sequence
  TRANS   # Transitions to/from episode
  OVER    # Plays over episode content
}

Timestamp Fields

All models include standard timestamp fields:
type ModelTimestamps {
  created_at: String
  updated_at: String
  deleted_at: String  # Present if soft-deleted
}
Timestamps are returned as ISO 8601 formatted strings.

Pagination

The API uses cursor-based pagination for collection queries.

PaginationInfo

type PaginationInfo {
  total: Int!
  count: Int!
  per_page: Int!
  current_page: Int!
  total_pages: Int!
  has_more_pages: Boolean!
}

Paginated Response Pattern

type AnimePagination {
  data: [Anime!]!
  pagination: PaginationInfo!
}

Relationships

The GraphQL schema represents relationships between models using standard GraphQL patterns.

One-to-Many

Represented as array fields:
type Anime {
  animethemes: [AnimeTheme!]!
}

Many-to-Many

Represented with pivot types:
type Anime {
  studios: [Studio!]!
}

type Studio {
  anime: [Anime!]!
}

Polymorphic Relationships

Some relationships are polymorphic (e.g., images, resources):
type Anime {
  images: [Image!]!
  resources: [ExternalResource!]!
}

type Artist {
  images: [Image!]!
  resources: [ExternalResource!]!
}

Nullable vs Non-Nullable

Field nullability indicates data guarantees:
  • String! - Required, never null
  • String - Optional, may be null
  • [String!]! - Required array of required strings (array never null, elements never null)
  • [String] - Optional array with optional elements

Localized Enums

Enum types have corresponding localized fields for human-readable values:
type Anime {
  season: AnimeSeason
  season_localized: String  # e.g., "Winter", "Spring"
}

Query Arguments

Standard query arguments are available on collection queries:
query {
  animePagination(
    first: Int
    page: Int
    sort: [AnimeSortableColumn!]
    filter: AnimeFilterableColumns
    search: String
  ) {
    data {
      anime_id
      name
    }
  }
}

Filter Arguments

Filters use column-specific operators:
input AnimeFilterableColumns {
  year: IntFilter
  season: AnimeSeason
  name: StringFilter
}

input IntFilter {
  eq: Int
  gt: Int
  gte: Int
  lt: Int
  lte: Int
  in: [Int!]
}

input StringFilter {
  contains: String
  starts_with: String
  ends_with: String
}

Sort Arguments

Sort by one or more fields:
enum AnimeSortableColumn {
  ANIME_ID
  NAME
  YEAR
  CREATED_AT
  UPDATED_AT
}

input SortOrder {
  column: AnimeSortableColumn!
  direction: SortDirection!
}

enum SortDirection {
  ASC
  DESC
}

Field Selection

Use GraphQL field selection to request only needed data:
query {
  anime(anime_id: 1) {
    name
    year
    animethemes {
      slug
      song {
        title
      }
    }
  }
}
This reduces payload size and improves performance by avoiding unnecessary data transfer.

Next Steps

Build docs developers (and LLMs) love