DM
Fetch a Direct Message Thread's Full History
Fetch the complete message history of a single Reddit DM thread with cursor-based pagination — every message, sender, timestamp, and redaction state.
POST
/api/reddit/dm/messages$0.025 / callFetch the messages inside one DM thread (room). Cursor-based pagination — pass the previous response's next_cursor as before to load older pages, repeat until has_more: false.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
room_id | string | yes | Thread ID from /api/reddit/dm/threads (e.g. !hdsti…:reddit.com) |
limit | number | no | Messages per page (default 50, max 100) |
before | string | no | Cursor from a previous response's next_cursor. Omit for the first page (latest messages). |
reddit_session | string | yes | Session cookie from /api/reddit/login |
loid | string | yes | Long-lived account identifier cookie |
csrf_token | string | yes | Anti-CSRF cookie |
Example
# Page 1 — latest 50 messages
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{
"room_id": "!hdstiJypyVtzbpoUJZe9mUc-zl-5BnADoRlS7h4itZg:reddit.com",
"limit": 50,
"reddit_session": "eyJhbGc...",
"loid": "000000...",
"csrf_token": "1c0819..."
}' \
"https://api.redditapis.com/api/reddit/dm/messages"
# Page 2 — older messages (use the previous next_cursor)
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{
"room_id": "!hdstiJypyVtzbpoUJZe9mUc-zl-5BnADoRlS7h4itZg:reddit.com",
"limit": 50,
"before": "t16_1771566217300",
"reddit_session": "eyJhbGc...",
"loid": "000000...",
"csrf_token": "1c0819..."
}' \
"https://api.redditapis.com/api/reddit/dm/messages"async function loadAllMessages(roomId, cookies) {
const all = [];
let before = null;
while (true) {
const res = await fetch("https://api.redditapis.com/api/reddit/dm/messages", {
method: "POST",
headers: {
Authorization: "Bearer TOKEN",
"Content-Type": "application/json",
},
body: JSON.stringify({
room_id: roomId,
limit: 50,
before,
...cookies,
}),
});
const data = await res.json();
if (!data.success) throw new Error(data.error);
all.unshift(...data.messages); // prepend older pages to keep oldest→newest order
if (!data.has_more) break;
before = data.next_cursor;
}
return all;
}import requests
def load_all_messages(room_id, cookies, token):
all_msgs = []
before = None
while True:
body = {"room_id": room_id, "limit": 50, \*\*cookies}
if before:
body["before"] = before
r = requests.post(
"https://api.redditapis.com/api/reddit/dm/messages",
json=body,
headers={"Authorization": f"Bearer {token}"},
)
data = r.json()
if not data.get("success"):
raise Exception(data.get("error")) # prepend older pages so the result stays oldest -> newest
all_msgs = data["messages"] + all_msgs
if not data.get("has_more"):
break
before = data["next_cursor"]
return all_msgsSuccess Response
{
"success": true,
"room_id": "!hdstiJypyVtzbpoUJZe9mUc-zl-5BnADoRlS7h4itZg:reddit.com",
"message_count": 5,
"messages": [
{
"event_id": "$abcDEF...",
"body": "Hi",
"msgtype": "m.text",
"sender_t2": "t2_284523vyfl",
"sender_displayname": "henry-gilbert",
"from_me": false,
"ts": 1771485811109,
"date": "2026-02-19T07:23:31.109Z",
"redacted": false
},
{
"event_id": "$xyzGHI...",
"body": "Hi",
"msgtype": "m.text",
"sender_t2": "t2_xxxxxxxx",
"sender_displayname": "your_reddit_username",
"from_me": true,
"ts": 1771496023456,
"date": "2026-02-19T10:33:43.456Z",
"redacted": false
}
],
"next_cursor": "t16_1771566217300",
"has_more": true
}Field Reference
| Field | Description |
|---|---|
messages | Array of messages in the page, oldest → newest so the array can be prepended directly when paginating. |
messages[].event_id | Unique event ID for this message. |
messages[].body | Plain-text content. null if the message was redacted. |
messages[].msgtype | Message type (almost always m.text for DMs). |
messages[].sender_t2 | Sender's t2_* ID. |
messages[].sender_displayname | Sender's username. May be null in rare cases. |
messages[].from_me | true if the authenticated account sent this message. |
messages[].redacted | true if the message was deleted. body will be null. |
next_cursor | Pass back as before to fetch the next (older) page. null when there are no more pages. |
has_more | false when you've reached the start of the conversation. |
message_count | Number of messages in this page. May be slightly less than limit when the underlying timeline window contained state events or redactions. |
Pagination Notes
- The first call (no
before) returns the latest N messages. Subsequent calls withbefore: <previous next_cursor>walk backwards in time. - Each page is internally ordered oldest → newest. To assemble a full transcript: prepend older pages to the front of your local array (see the JS/Python examples above).
has_more: falseis the canonical end-of-history signal. Do not rely onnext_cursorbeingnullalone — always checkhas_more.- For full-history scraping, batch large
limitvalues (up to 100) to minimise the number of pages.
Errors
| Status | Meaning |
|---|---|
400 | Missing room_id or required cookies |
401 | Missing Bearer token |
403 | Invalid Bearer token |
502 | Could not fetch messages (cookies expired or room not accessible) |
500 | Unexpected server error |
List DM ThreadsNew
List the account's direct-message conversations and chat sidebar — newest activity first, with full thread metadata, last message, and unread count.
Update BioNew
Update the logged-in Reddit account's profile bio (publicDescription) via HTTP — plain text up to 200 characters, no browser automation needed.
