Skip to main content

Pagination and Filtering

When working with the TMDB API, many endpoints return large datasets. To manage this data efficiently, our API supports pagination and filtering.

Pagination

Pagination allows you to retrieve a subset of the available data by specifying the number of items to return. Most endpoints that return a list of items (e.g., movies, TV shows, or people) are paginated. This means the results are split into smaller chunks (pages) to improve performance and usability.

How Pagination Works

By default, our API returns the first page, when you do not select any page. You can control which page of results to retrieve using the page query parameter. The response includes metadata about the total number of pages and results. Example Request To retrieve the second page of popular movies:
Response Structure The response includes the following pagination-related fields:
  • page: The current page number.
  • results: The list of items for the current page.
  • total_pages: The total number of pages available.
  • total_results: The total number of items across all pages.

Filtering

Many endpoints allow you to filter results based on specific criteria. Filtering is done using query parameters in the request URL. Here are some commonly used filter parameters: Filtered Request To retrieve popular movies released in 2020 with a minimum vote average of 7:

Combining Pagination and Filtering

You can combine pagination and filtering to retrieve specific subsets of data. For example, to get the third page of action movies with a (genre_id=28) sorted by popularity: