# Retrieve latest posts by ID

**URL:** https://meta.discourse.org/t/retrieve-latest-posts-by-id/202159
**Category:** Support
**Created:** [August 30, 2021, 7:19pm UTC](https://meta.discourse.org/t/retrieve-latest-posts-by-id/202159 "2021-08-30T19:19:55Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 31, 2021, 8:46pm UTC](https://meta.discourse.org/t/retrieve-latest-posts-by-id/202159/5 "2021-08-31T20:46:39Z")

</div>

> [@hkremer](#):
>
> Rafael has the right base, but I don’t think you can order by created date (I hope I’m wrong?).

The default ordering is the created date AFAIK.

> [@hkremer](#):
>
> And if you could, I don’t believe IDs are assigned to posts based on when they are created.

They are.

> [@hkremer](#):
>
> Anecdotally in our Discourse instance, we are seeing many examples of IDs being assigned to posts outside of their chronological order.

The gaps in the order are posts your user can’t see, most likely posts inside PMs.

> [@hkremer](#):
>
> This becomes an issue when you try to pull all posts using the method [discussed here.](https://meta.discourse.org/t/latest-posts-api-pagination/88589/4) If we can’t order posts by ID then it becomes impossible.

If your goal is to extract ALL the posts, loading a full backup in a local PostgreSQL instance or even using our [Data Explorer Plugin](https://meta.discourse.org/t/data-explorer-plugin/32566) may be easier.

---

_[View the full topic](https://meta.discourse.org/t/retrieve-latest-posts-by-id/202159)._
