WhereConditions Filter
The primary filtering mechanism is thewhere argument, which accepts a list of conditions with field, value, and operator.
Basic Filtering
Filter anime by year:Comparison Operators
The following comparison operators are available:| Operator | SQL Equivalent | Description |
|---|---|---|
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 |
LIKE | LIKE | Pattern matching |
NOTLIKE | NOT LIKE | Negated pattern matching |
Using Operators
LIKE Operator
Use theLIKE operator for pattern matching:
Use
% as a wildcard in LIKE patterns. For example:%monogatari%matches any name containing “monogatari”monogatari%matches names starting with “monogatari”%monogatarimatches names ending with “monogatari”
Logical Operators
Combine multiple conditions usingAND and OR logical operators.
AND Conditions
All conditions must be true:OR Conditions
At least one condition must be true:Complex Nested Conditions
Combine AND and OR for complex filtering:Multiple Top-Level Conditions
Multiple top-level conditions in thewhere array are combined with AND:
Filterable Fields
Each resource type has specific filterable fields. Use the GraphiQL sandbox to explore available fields through autocomplete.Common Filterable Fields
Anime:IDNAMESLUGYEARSEASONMEDIA_FORMATCREATED_ATUPDATED_AT
IDNAMESLUGCREATED_ATUPDATED_AT
IDBASENAMEFILENAMERESOLUTIONNCSUBBEDLYRICSUNCENSOURCEOVERLAP
Trashed Filter
Some resources support soft deletes. Use thetrashed argument to include or exclude soft-deleted records:
WITHOUT- Exclude soft-deleted records (default)WITH- Include soft-deleted recordsONLY- Return only soft-deleted records
Filtering Relations
When querying nested relations, you can apply filters to the related resources:Search Argument
Some resources support full-text search with thesearch argument:
The
search argument performs a full-text search across multiple fields, providing more flexible matching than the where filter.Practical Examples
Find Recent Anime
Find Anime by Season Range
Search by Name Pattern
Best Practices
Use Specific Filters
Use Specific Filters
Be as specific as possible with your filters to reduce the result set and improve query performance.
Combine with Pagination
Combine with Pagination
Always use pagination when filtering to avoid overwhelming responses with large datasets.
Leverage Indexes
Leverage Indexes
Filters on indexed fields (like
ID, SLUG, YEAR) perform better than non-indexed fields.Test in GraphiQL
Test in GraphiQL
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