Skip to main content
The AnimeThemes GraphQL API provides powerful filtering capabilities to help you retrieve exactly the data you need.

WhereConditions Filter

The primary filtering mechanism is the where argument, which accepts a list of conditions with field, value, and operator.

Basic Filtering

Filter anime by year:
query {
  animePagination(first: 10, where: [
    { field: YEAR, value: 2009 }
  ]) {
    data {
      name
      year
      season
    }
  }
}

Comparison Operators

The following comparison operators are available:
OperatorSQL EquivalentDescription
EQ=Equal to (default)
NE<>Not equal to
LT<Less than
GT>Greater than
LTE<=Less than or equal to
GTE>=Greater than or equal to
LIKELIKEPattern matching
NOTLIKENOT LIKENegated pattern matching

Using Operators

query {
  animePagination(first: 10, where: [
    { field: YEAR, operator: GTE, value: 2020 }
  ]) {
    data {
      name
      year
    }
  }
}

LIKE Operator

Use the LIKE operator for pattern matching:
query {
  animePagination(first: 10, where: [
    { field: NAME, operator: LIKE, value: "%monogatari%" }
  ]) {
    data {
      name
      slug
    }
  }
}
Use % as a wildcard in LIKE patterns. For example:
  • %monogatari% matches any name containing “monogatari”
  • monogatari% matches names starting with “monogatari”
  • %monogatari matches names ending with “monogatari”

Logical Operators

Combine multiple conditions using AND and OR logical operators.

AND Conditions

All conditions must be true:
query {
  animePagination(first: 10, where: [
    {
      AND: [
        { field: YEAR, value: 2009 },
        { field: SEASON, value: "SUMMER" }
      ]
    }
  ]) {
    data {
      name
      year
      season
    }
  }
}

OR Conditions

At least one condition must be true:
query {
  animePagination(first: 10, where: [
    {
      OR: [
        { field: YEAR, value: 2009 },
        { field: YEAR, value: 2010 }
      ]
    }
  ]) {
    data {
      name
      year
    }
  }
}

Complex Nested Conditions

Combine AND and OR for complex filtering:
query {
  animePagination(first: 10, where: [
    {
      AND: [
        {
          OR: [
            { field: YEAR, value: 2009 },
            { field: YEAR, value: 2010 }
          ]
        },
        { field: SEASON, value: "SUMMER" }
      ]
    }
  ]) {
    data {
      name
      year
      season
    }
  }
}
This query finds anime from Summer 2009 OR Summer 2010.

Multiple Top-Level Conditions

Multiple top-level conditions in the where array are combined with AND:
query {
  animePagination(first: 10, where: [
    { field: YEAR, operator: GTE, value: 2020 },
    { field: SEASON, value: "SUMMER" }
  ]) {
    data {
      name
      year
      season
    }
  }
}

Filterable Fields

Each resource type has specific filterable fields. Use the GraphiQL sandbox to explore available fields through autocomplete.

Common Filterable Fields

Anime:
  • ID
  • NAME
  • SLUG
  • YEAR
  • SEASON
  • MEDIA_FORMAT
  • CREATED_AT
  • UPDATED_AT
Artist:
  • ID
  • NAME
  • SLUG
  • CREATED_AT
  • UPDATED_AT
Video:
  • ID
  • BASENAME
  • FILENAME
  • RESOLUTION
  • NC
  • SUBBED
  • LYRICS
  • UNCEN
  • SOURCE
  • OVERLAP

Trashed Filter

Some resources support soft deletes. Use the trashed argument to include or exclude soft-deleted records:
query {
  animePagination(first: 10, trashed: WITH) {
    data {
      name
      deleted_at
    }
  }
}
Trashed Options:
  • WITHOUT - Exclude soft-deleted records (default)
  • WITH - Include soft-deleted records
  • ONLY - Return only soft-deleted records

Filtering Relations

When querying nested relations, you can apply filters to the related resources:
query {
  anime(slug: "bakemonogatari") {
    name
    themes(where: [
      { field: TYPE, value: "OP" }
    ]) {
      id
      type
      sequence
      slug
    }
  }
}

Search Argument

Some resources support full-text search with the search argument:
query {
  animePagination(first: 10, search: "bakemonogatari") {
    data {
      name
      slug
      year
    }
  }
}
The search argument performs a full-text search across multiple fields, providing more flexible matching than the where filter.

Practical Examples

Find Recent Anime

query {
  animePagination(
    first: 20,
    where: [
      { field: YEAR, operator: GTE, value: 2023 }
    ],
    sort: [{ field: YEAR, order: DESC }]
  ) {
    data {
      name
      year
      season
    }
  }
}

Find Anime by Season Range

query {
  animePagination(
    first: 50,
    where: [
      { field: YEAR, operator: GTE, value: 2020 },
      { field: YEAR, operator: LTE, value: 2021 },
      { field: SEASON, value: "WINTER" }
    ]
  ) {
    data {
      name
      year
      season
    }
  }
}

Search by Name Pattern

query {
  animePagination(
    first: 20,
    where: [
      { field: NAME, operator: LIKE, value: "%attack%" }
    ]
  ) {
    data {
      name
      slug
    }
  }
}

Best Practices

Be as specific as possible with your filters to reduce the result set and improve query performance.
Always use pagination when filtering to avoid overwhelming responses with large datasets.
Filters on indexed fields (like ID, SLUG, YEAR) perform better than non-indexed fields.
Use the GraphiQL sandbox to test complex filter conditions and validate field names.

Next Steps

Sorting

Learn how to sort filtered results

Pagination

Paginate through filtered data

Build docs developers (and LLMs) love