# Which Discourse API can directly get the last comment information of a post?

**URL:** https://meta.discourse.org/t/discourse/381511
**Category:** Development
**Tags:** rest-api
**Created:** [September 4, 2025, 2:22am UTC](https://meta.discourse.org/t/discourse/381511 "2025-09-04T02:22:09Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![MachineScholar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/machinescholar/32/424719_2.png) [@MachineScholar](https://meta.discourse.org/u/MachineScholar)
#### Post date: [September 4, 2025, 2:27am UTC](https://meta.discourse.org/t/discourse/381511/2 "2025-09-04T02:27:09Z")

</div>

I would recommend using a [data explorer](https://meta.discourse.org/t/32566?silent=true) query for that. You can programmatically run queries and get JSON results. Here you go:

```sql
-- [params]
-- post_id :post_id

SELECT
  p.id,
  p.topic_id,
  p.post_number,
  p.raw AS raw_content, -- Markdown/source
  p.cooked AS html_content, -- Rendered HTML
  p.user_id,
  p.created_at,
  p.updated_at
FROM posts p
WHERE p.id = :post_id
  AND p.deleted_at IS NULL -- drop if you want deleted posts too
-- AND p.hidden = false -- optionally exclude hidden posts
LIMIT 1;

```

---

_[View the full topic](https://meta.discourse.org/t/discourse/381511)._
