# API to get private messages

**URL:** <https://forum.mattermost.com/t/api-to-get-private-messages/1388>\
**Category:** Troubleshooting\
**Created:** [April 27, 2016, 10:13am UTC](https://forum.mattermost.com/t/api-to-get-private-messages/1388 "2016-04-27T10:13:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![hmhealey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/hmhealey/32/1915_2.png) [@hmhealey](https://forum.mattermost.com/u/hmhealey)\
**Post date:** [April 28, 2016, 2:33pm UTC](https://forum.mattermost.com/t/api-to-get-private-messages/1388/2 "2016-04-28T14:33:26Z")

</div>

Hi Jayshree,

You’re able to use the following APIs to get posts from any channel (public, private, or direct) using it’s channel ID:

- /api/v1/channels/CHANNEL\_ID/posts/OFFSET/LIMIT gets the last LIMIT posts in a channel starting OFFSET posts back from the most recent one. So an offset of 50 and a limit of 100 would get you the 50th to 150th most recent posts
- /api/v1/channels/CHANNEL\_ID/posts/TIME gets all posts made in that channel since the given Unix timestamp

Also, so you have some advanced warning, our upcoming release will be replacing the v1 APIs due to some substantial internal changes to our code. You can read more about it [here](https://forum.mattermost.com/t/web-service-api-changing-recommend-using-drivers/1327). At this time, the above APIs will be moved to

- /api/v3/channels/CHANNEL\_ID/posts/page/OFFSET/LIMIT
- /api/v3/channels/CHANNEL\_ID/posts/since/TIME

---

_[View the full topic](https://forum.mattermost.com/t/api-to-get-private-messages/1388)._
