ThreadAPI provides real-time access to Reddit posts, comments, subreddits, and user profiles as clean JSON or LLM-ready Markdown.
1. Create an account and get an API key
- Open the ThreadAPI Console.
- Sign in with your email address using a one-time code or OAuth. New accounts receive free trial credits.
- In the console, navigate to API Keys and click Create Key.
- Copy your key immediately (starts with
tapi_). It is only shown once.
2. Make your first API call
Pass your API key in the Authorization header as a Bearer token:
Example: Read subreddit information
curl -X GET "https://api.threadapi.dev/v1/reddit/subreddit?sub=selfhosted" \
-H "Authorization: Bearer $THREADAPI_API_KEY"import os, requests
res = requests.get(
"https://api.threadapi.dev/v1/reddit/subreddit",
headers={"Authorization": f"Bearer {os.environ['THREADAPI_API_KEY']}"},
params={"sub": "selfhosted"},
)
res.raise_for_status()
sub = res.json()
print(sub["name"], "-", sub["title"])
print(f"Subscribers: {sub['subscribers']:,}")const res = await fetch("https://api.threadapi.dev/v1/reddit/subreddit?sub=selfhosted", {
headers: { Authorization: `Bearer ${process.env.THREADAPI_API_KEY}` },
});
const sub = await res.json();
console.log(`${sub.name} - ${sub.title} (${sub.subscribers} subscribers)`);Response:
{
"name": "selfhosted",
"title": "Self-Hosted Alternatives to Popular Services",
"public_description": "A place to share, discuss, discover, assist with, gain assistance for, and critique self-hosted alternatives...",
"subscribers": 868722,
"created_at": "2014-07-08T09:34:14.239Z",
"is_nsfw": false,
"type": "public",
"url": "/r/selfhosted/",
"icon": "https://styles.redditmedia.com/t5_32hch/styles/communityIcon_zttnt3jjmddh1.png?width=64&frame=1&auto=webp&s=4a0dfbfac29b79ce75d06e5079e027aad47a849b",
"rules": [
{
"priority": 0,
"short_name": "Low-Effort / Off-Topic",
"description": "All posts must be about self-hosting...",
"violation_reason": "Low-Effort / Off-Topic (Not Selfhosted)"
}
]
}Example: Fetch a post and comment tree
curl -X GET "https://api.threadapi.dev/v1/reddit/post?url=https://www.reddit.com/r/selfhosted/comments/1sey9ch/&format=json" \
-H "Authorization: Bearer $THREADAPI_API_KEY"import os, requests
res = requests.get(
"https://api.threadapi.dev/v1/reddit/post",
headers={"Authorization": f"Bearer {os.environ['THREADAPI_API_KEY']}"},
params={
"url": "https://www.reddit.com/r/selfhosted/comments/1sey9ch/",
"format": "json",
},
)
res.raise_for_status()
data = res.json()
print(data["post"]["title"])
print(f"Comments returned: {data['meta']['comments_returned']}/{data['post']['comments_count']}")const params = new URLSearchParams({
url: "https://www.reddit.com/r/selfhosted/comments/1sey9ch/",
format: "json",
});
const res = await fetch(`https://api.threadapi.dev/v1/reddit/post?${params}`, {
headers: { Authorization: `Bearer ${process.env.THREADAPI_API_KEY}` },
});
const data = await res.json();
console.log(`${data.post.title} (${data.meta.comments_returned} comments)`);To receive a clean, structured Markdown digest instead of JSON, pass format=md:
curl -X GET "https://api.threadapi.dev/v1/reddit/post?url=https://www.reddit.com/r/selfhosted/comments/1sey9ch/&format=md" \
-H "Authorization: Bearer $THREADAPI_API_KEY"import os, requests
res = requests.get(
"https://api.threadapi.dev/v1/reddit/post",
headers={"Authorization": f"Bearer {os.environ['THREADAPI_API_KEY']}"},
params={
"url": "https://www.reddit.com/r/selfhosted/comments/1sey9ch/",
"format": "md",
},
)
res.raise_for_status()
print(res.text) # Plain markdown with indented discussion treeconst params = new URLSearchParams({
url: "https://www.reddit.com/r/selfhosted/comments/1sey9ch/",
format: "md",
});
const res = await fetch(`https://api.threadapi.dev/v1/reddit/post?${params}`, {
headers: { Authorization: `Bearer ${process.env.THREADAPI_API_KEY}` },
});
const markdown = await res.text();
console.log(markdown);3. Rate limits & billing
- Credits: Standard listing and post requests cost 1 credit. Deep comment trees cost 1 credit per 500 comments.
- Response headers: Every response returns
X-Credits-Used,X-Cache(HITorMISS), andX-Request-Id. - Zero charge on failure: Requests resulting in 4xx or 5xx errors are never billed.
- Top up: Purchase non-expiring credit packs anytime in the Billing Console.
4. Next steps
- Interactive Playground: Test every endpoint directly in your browser.
- API Reference: Explore full OpenAPI specifications and interactive curl builders for all endpoints.
- MCP Server: Connect Claude, Cursor, VS Code, or Codex to real-time Reddit data via MCP.
- Keyword Monitors: Stream new Reddit posts and comments matching your keywords to webhooks or Discord.