# How can I filter/paginate the list CategoryTopics route?

**URL:** <https://meta.discourse.org/t/how-can-i-filter-paginate-the-list-categorytopics-route/290560>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [January 4, 2024, 8:59pm UTC](https://meta.discourse.org/t/how-can-i-filter-paginate-the-list-categorytopics-route/290560 "2024-01-04T20:59:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PhishAndChips](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/phishandchips/32/352100_2.png) [@PhishAndChips](https://meta.discourse.org/u/PhishAndChips)\
**Post date:** [January 4, 2024, 8:59pm UTC](https://meta.discourse.org/t/how-can-i-filter-paginate-the-list-categorytopics-route/290560/1 "2024-01-04T20:59:39Z")

</div>

We’re building a custom integration to our self-hosted discourse instance within our app and would like to filter the results from [https://docs.discourse.org/#tag/Categories/operation/listCategoryTopics](https://docs.discourse.org/#tag/Categories/operation/listCategoryTopics) to allow us to show the newest and top topics. Currently, it’s paginated to 30 indexes per page.

We either need to:

1. Filter the results so the 30 indexes returned are the newest, or top topics (ideal)
2. Increase the pagination limit to do this filtering/sorting on the client (not ideal but would work)

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)\
**Post date:** [January 6, 2024, 5:22am UTC](https://meta.discourse.org/t/how-can-i-filter-paginate-the-list-categorytopics-route/290560/2 "2024-01-06T05:22:08Z")

</div>

Hi,

I believe what you’re looking for is this:

`/c/{slug}/{id}/l/{filter}.json?{query}`

Where:

`{filter}` is either:

```plaintext
latest 
unread 
new 
unseen 
top 
read 
posted 
bookmarks

```

`{query}` can be (probably non-exhaustive)

```plaintext
page=<int>
before=<timestamp>
bumped_before=<timestamp>
topic_ids=<id1[,id2, ..]>
order=<likes|op_likes|views|posts|activity|posters|category|created>
ascending=<true|false>
min_posts=<int>
max_posts=<int>
status=<open|closed|archived|listed|unlisted|deleted>
state=<muted|regular|normal|tracking|watching>
search=<term>
subset=<topics|replied>
tags=<tag1[,tag2,..]>
match_all_tags=<true|false>
no_subcategories=<true|false>
no_tags=<true|false>
exclude_tag=<tag>

```

It doesn’t seem like you can change the `per_page` with the API.

You can play with `order` and paginate with `page`. you can know the next URL to use using `more_topic_url`, see below in the response example:

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/d/9/5d975c8b7f683477291542a93e3d9d12c6d40842.png)

Worth to be noted: [Topics list filter feature](https://meta.discourse.org/t/experimental-topics-list-filter-feature/263641)

Hope that helps!
