# Accessing Messages from custom route in Langgraph Platform instance

**URL:** <https://forum.langchain.com/t/accessing-messages-from-custom-route-in-langgraph-platform-instance/181>\
**Category:** Deployment\
**Created:** [July 1, 2025, 11:59pm UTC](https://forum.langchain.com/t/accessing-messages-from-custom-route-in-langgraph-platform-instance/181 "2025-07-01T23:59:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![noahtheinformation](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/noahtheinformation/32/73_2.png) [@noahtheinformation](https://forum.langchain.com/u/noahtheinformation)\
**Post date:** [July 1, 2025, 11:59pm UTC](https://forum.langchain.com/t/accessing-messages-from-custom-route-in-langgraph-platform-instance/181/1 "2025-07-01T23:59:15Z")

</div>

Hello folks!

I’m having trouble accessing messages based on a thread\_id in a custom route attached to the Langgraph Platform deployment.

What is the best approach to doing this?  
I’ve tried importing and compiling the graph with the thread\_id, but I get no messages in a thread I’m confident messages exist. The documentation says that accessing the internal postgres DB is not recommended/allowed. Can someone point me in the right direction? Thanks!

---

<div class="post-metadata">

**Author:** ![wfh](https://yyz1.discourse-cdn.com/flex007/user_avatar/forum.langchain.com/wfh/32/33_2.png) [@wfh](https://forum.langchain.com/u/wfh)\
**Post date:** [July 2, 2025, 12:02am UTC](https://forum.langchain.com/t/accessing-messages-from-custom-route-in-langgraph-platform-instance/181/2 "2025-07-02T00:02:35Z")

</div>

I’d recommend using the API/SDK.

```auto
from langgraph_sdk import get_client

sdk = get_client() # url can be None to connect to the loopback transport (current deployment)

async def my_route(...):
    await sdk.threads. get_state(thread_id)
    ...

```
