# How to get posts viewed by a user via APIs?

**URL:** https://meta.discourse.org/t/how-to-get-posts-viewed-by-a-user-via-apis/296028
**Category:** Development
**Tags:** rest-api
**Created:** [February 20, 2024, 8:17am UTC](https://meta.discourse.org/t/how-to-get-posts-viewed-by-a-user-via-apis/296028 "2024-02-20T08:17:44Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![armingrudd](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/armingrudd/32/348458_2.png) [@armingrudd](https://meta.discourse.org/u/armingrudd)
#### Post date: [February 20, 2024, 8:17am UTC](https://meta.discourse.org/t/how-to-get-posts-viewed-by-a-user-via-apis/296028/1 "2024-02-20T08:17:44Z")

</div>

Hi,

Is it possible to get the posts (IDs) that user has viewed? The use case here is to filter topics within a timeframe and count viewed topics in the custom timeframe.

Since “post read” is one of the user statistics in /u, I thought it should be possible to get that in a custom timeframe as well.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [February 20, 2024, 1:44pm UTC](https://meta.discourse.org/t/how-to-get-posts-viewed-by-a-user-via-apis/296028/2 "2024-02-20T13:44:35Z")

</div>

Have you had a look through the rest API documentation?

> [@Discourse REST API Documentation](https://meta.discourse.org/t/discourse-rest-api-documentation/22706):
>
> Discourse API Please view the Discourse API Documentation site for detailed info: [https://docs.discourse.org](https://docs.discourse.org)information_source Authentication API requests must use HTTP header based authentication. Pass your Api-Key and Api-Username as HTTP headers. Authentication via query parameters or request body is not supported (this was removed in April 2020). Please see the example cURL request below. The only API endpoints that continue to support credentials in query parameters are requests to…

> [@Reverse engineer the Discourse API](https://meta.discourse.org/t/reverse-engineer-the-discourse-api/20576):
>
> Discourse is backed by a complete JSON api. Anything you can do on the site you can also do using the JSON api. The API is documented at [docs.discourse.org](https://docs.discourse.org). You can also use the [discourse\_api](https://github.com/discourse/discourse_api) Ruby gem as a client library. However, not every endpoint is documented. To determine how to do something with the JSON API here are some steps you can follow. Example: recategorize a topic. Go to a topic and start editing a category: Open Chrome dev tools, switch to the Network tab, select …

> [@Discourse REST API comprehensive examples](https://meta.discourse.org/t/discourse-rest-api-comprehensive-examples/274354):
>
> There are [several guides](https://meta.discourse.org/search?q=%23rest-api%20%23documentation) covering various API uses or explanations. This one gives practical and comprehensive examples on how to use it. warning All code examples in this guide aren’t meant to display good practice or to be used as they are. A lot of checks, error handling and so on are purposely ignored or skipped to focus purely on the API’s usage. What is the API used for? Most of your actions in Discourse (posting, liking, editing a setting, etc.) are done using the API by making re…

Also [Data Explorer](https://meta.discourse.org/t/32566?silent=true) queries

> [@Discourse Data Explorer](https://meta.discourse.org/t/32566?silent=true):
>
> discourse2Summary Discourse [Data Explorer](https://meta.discourse.org/t/32566?silent=true) allows you to make SQL queries against your live database, allowing for up-to-the-minute stats reporting.open_bookInstall Guide This plugin is bundled with Discourse core. There is no need to install the plugin separately.information_source If you’re looking for examples or support for any custom queries, you can find lots of topics in our #Data & reporting category under the #sql-query tag. If there’s not one to suit your pa…
