# 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](/mcp), and nothing to run on your side: no Reddit app, no OAuth with Reddit, no proxies.

<Callout type="info" title="Base URL">
  `https://api.threadapi.dev/v1`
</Callout>

<Steps>
  <Step>
    Get a key [#get-a-key]

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

  <Step>
    Read a thread [#read-a-thread]

    <Tabs items={["cURL", "Python", "TypeScript"]}>
      <Tab value="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"
        ```
      </Tab>

      <Tab value="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"])
        ```
      </Tab>

      <Tab value="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());
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step>
    Check what it cost [#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](/pricing).
  </Step>
</Steps>

Endpoints [#endpoints]

<Cards>
  <Card title="Post" description="A post, its comments nested as on Reddit, and a discussion digest." href="/reddit/post" />

  <Card title="Subreddit" description="Hot, new, top or rising posts in a subreddit." href="/reddit/subreddit" />

  <Card title="Search" description="Posts matching a query, across Reddit or in one subreddit." href="/reddit/search" />

  <Card title="MCP server" description="The same three, as tools for Claude, Cursor, VS Code and Codex." href="/mcp" />
</Cards>

For language models [#for-language-models]

* [llms.txt](https://stage.threadapi.dev/llms.txt) and [llms-full.txt](https://stage.threadapi.dev/llms-full.txt) describe the API in plain text.
* The OpenAPI spec is at [threadapi.dev/openapi.json](https://stage.threadapi.dev/openapi.json).
* Append `.mdx` to any docs URL for the raw page.
