# Get only top level posts in topic via discourse API

**URL:** <https://meta.discourse.org/t/get-only-top-level-posts-in-topic-via-discourse-api/86319>\
**Category:** Development\
**Tags:** rest-api\
**Created:** [27 באפריל,‏ 2018,‏ 4:46pm UTC](https://meta.discourse.org/t/get-only-top-level-posts-in-topic-via-discourse-api/86319 "2018-04-27T16:46:18Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![coopaloop](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@coopaloop](https://meta.discourse.org/u/coopaloop)\
**Post date:** [27 באפריל,‏ 2018,‏ 4:46pm UTC](https://meta.discourse.org/t/get-only-top-level-posts-in-topic-via-discourse-api/86319/1 "2018-04-27T16:46:19Z")

</div>

I would like to be able to get the 20 most recent posts that are top level on a topic without having to recursively re-fetch and filter post replies until I have 20. Is there a filter for this and I have just missed it somewhere in the api?

Right now it just looks like the stream array in response includes post replies by post number. So, if I have 4 posts, [1,2,3,4] and post a reply to post 1, the stream will now be [1,2,3,4,5] and the only way I can tell that 5 is a reply to 1 is by examining the post itself, finding “reply\_to\_post\_number”=\>1 and filtering it out. Am I missing something?

---

_[View the full topic](https://meta.discourse.org/t/get-only-top-level-posts-in-topic-via-discourse-api/86319)._
