# How to get all topics from a specific category using offset/page param in the API query?

**URL:** https://meta.discourse.org/t/how-to-get-all-topics-from-a-specific-category-using-offset-page-param-in-the-api-query/348554
**Category:** Data & reporting
**Created:** [January 23, 2025, 7:46am UTC](https://meta.discourse.org/t/how-to-get-all-topics-from-a-specific-category-using-offset-page-param-in-the-api-query/348554 "2025-01-23T07:46:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Shubham\_G](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shubham_g/32/482220_2.png) [@Shubham\_G](https://meta.discourse.org/u/Shubham_G)
#### Post date: [January 23, 2025, 7:46am UTC](https://meta.discourse.org/t/how-to-get-all-topics-from-a-specific-category-using-offset-page-param-in-the-api-query/348554/1 "2025-01-23T07:46:56Z")

</div>

I have found an API which can list all the topics from a specific subject (whose slug is “mlt-kb”) from between a certain date range. Here is the endpoint:

https://{default\_host}/search.json?q=%23courses%3Amlt-kb%20after%3A2024-09-24%20before%3A2024-12-29

But this URL doesn’t list all topics. It only lists the first 50 topics. There **must be some other parameter like offset or page**..but I cannot understand **how to add them to this URL**. Can someone figure this out?

Thanks in advance!

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [January 23, 2025, 8:44am UTC](https://meta.discourse.org/t/how-to-get-all-topics-from-a-specific-category-using-offset-page-param-in-the-api-query/348554/2 "2025-01-23T08:44:27Z")

</div>

As always: If this is possible using UI, try [Reverse engineer the Discourse API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576)

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [January 23, 2025, 8:48am UTC](https://meta.discourse.org/t/how-to-get-all-topics-from-a-specific-category-using-offset-page-param-in-the-api-query/348554/3 "2025-01-23T08:48:48Z")

</div>

You can use this - [https://docs.discourse.org/#tag/Search/operation/search](https://docs.discourse.org/#tag/Search/operation/search) (scroll down!)

You’ll see that besides `?q`, we also have `?page`, so..

`https://{default_host}/search.json?q=%23courses%3Amlt-kb%20after%3A2024-09-24%20before%3A2024-12-29&page=1 `

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [January 23, 2025, 3:31pm UTC](https://meta.discourse.org/t/how-to-get-all-topics-from-a-specific-category-using-offset-page-param-in-the-api-query/348554/4 "2025-01-23T15:31:42Z")

</div>

If you want them all at once you could [Run Data Explorer queries with the Discourse API](https://meta.discourse.org/t/run-data-explorer-queries-with-the-discourse-api/120063)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [January 23, 2025, 4:37pm UTC](https://meta.discourse.org/t/how-to-get-all-topics-from-a-specific-category-using-offset-page-param-in-the-api-query/348554/5 "2025-01-23T16:37:42Z")

</div>

There’s a script example that loops page results here:

> [@Searching for image urls in topics](https://meta.discourse.org/t/searching-for-image-urls-in-topics/346912/9):
>
> You don’t need an API key to do searches. I’m not sure having an API key could help you resolve your issue more easily. Here’s an robot example Python script that loops my posts (1 post every 3 sec) on meta and returns those having the substring upload:// in the raw content: import requests import time def fetch\_posts(page): url = f"https://meta.discourse.org/search.json?q=%40cocoquark&page={page}" response = requests.get(url) return response.json() def fetch\_post\_content(pos…

But as Jay said, depending on your goal, using [data explorer](https://meta.discourse.org/t/32566?silent=true) might be a way better solution if you’re admin.
