---
title: "Quickstart"
description: "Read a Reddit post and its comments with one HTTPS request, as JSON or as Markdown for a model."
---

> Documentation Index
> Fetch the complete documentation index at: https://staging.threadapi.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

threadapi reads public Reddit for programs and AI agents. One request returns a post with its comment tree, as JSON or as one Markdown document, with a digest of what the thread agrees and argues about. There are also subreddit listings and search, a [remote MCP server](/docs/mcp), and nothing to run on your side: no Reddit app, no OAuth with Reddit, no proxies.

> **Base URL**
>
> All API requests are made against `https://api.threadapi.dev/v1`.

1. ### Get a key

   Sign in at [threadapi.dev](https://threadapi.dev/auth/login?utm_source=docs) with Google, GitHub or an email code. New accounts get 100 free credits. Create a key under [API keys](https://threadapi.dev/app/api-keys?utm_source=docs); it starts with `tapi_`.

2. ### Read a thread

   ### cURL

   ```bash
   curl "https://api.threadapi.dev/v1/reddit/post?format=md&url=https://www.reddit.com/r/programming/comments/1x144ok/" \
     -H "Authorization: Bearer $THREADAPI_API_KEY"
   ```

   ### Python

   ```python
   import os, requests

   r = requests.get(
       "https://api.threadapi.dev/v1/reddit/post",
       params={"url": "https://www.reddit.com/r/programming/comments/1x144ok/"},
       headers={"Authorization": f"Bearer {os.environ['THREADAPI_API_KEY']}"},
   )
   r.raise_for_status()
   thread = r.json()
   print(thread["post"]["title"], thread["meta"]["comments_returned"])
   ```

   ### TypeScript

   ```ts
   const params = new URLSearchParams({
     url: "https://www.reddit.com/r/programming/comments/1x144ok/",
     format: "md",
   });
   const res = await fetch(`https://api.threadapi.dev/v1/reddit/post?${params}`, {
     headers: { Authorization: `Bearer ${process.env.THREADAPI_API_KEY}` },
   });
   console.log(await res.text());
   ```

3. ### Check what it cost

   Every successful response has an `X-Credits-Used` header. A post with up to 500 comments costs 1 credit; `max_comments` defaults to 200. See [pricing](/docs/pricing).

## Endpoints

- [Post](/api/Reddit/getPost/) — A post, its comments nested as on Reddit, and a discussion digest.
- [Subreddit](/api/Reddit/listSubreddit/) — Hot, new, top or rising posts in a subreddit.
- [Search](/api/Reddit/search/) — Posts matching a query, across Reddit or in one subreddit.
- [MCP Server](/docs/mcp) — The same tools for Claude, Cursor, VS Code and Codex.

## For language models

- [llms.txt](/llms.txt) and [llms-full.txt](/llms-full.txt) describe the API in plain text.
- The OpenAPI spec is at [/openapi.json](/openapi.json).

Source: https://staging.threadapi.dev/docs/index.mdx
