Comments API

Retrieve the full comment thread tree for any Substack post. Comments include nested replies, author information, timestamps, and like counts. The recursive structure preserves the original thread hierarchy.

GET/v1/posts/:slug/comments

Highlights

Full recursive comment thread tree
Nested replies with parent references
Comment author profiles
Timestamps and like counts
Handles deeply nested threads
Sorted by recency or popularity

Code Example

javascript
const res = await fetch(
  "https://stackhooks.com/v1/posts/the-ai-wars-begin/comments",
  { headers: { Authorization: "Bearer sk_live_..." } }
);
const { data } = await res.json();
data.forEach(comment => {
  console.log(`${comment.author.name}: ${comment.body.substring(0, 80)}`);
  console.log(`  ${comment.replies.length} replies, ${comment.like_count} likes`);
});

Response

json
{
  "data": [
    {
      "id": "abc123",
      "body": "Great analysis of the AI landscape...",
      "author": { "name": "Reader One" },
      "like_count": 12,
      "date": "2024-12-15T14:30:00Z",
      "replies": [
        { "body": "Agreed!", "author": { "name": "Reader Two" } }
      ]
    }
  ]
}

Start building today

Create a free account and start pulling structured Substack data in minutes.