# Search Reddit

> Search all of Reddit for posts matching a keyword.

- **Request:** `GET https://api.lurkapi.com/v1/reddit/search`
- **Auth:** `x-api-key` header ([get a free key](https://lurkapi.com/login?next=/dashboard))
- **Cost:** 1 credit per call. Validation errors, `401`/`402`/`429` rejections and `5xx` failures are free; `not_found` is charged ([how charging works](https://lurkapi.com/docs.md#credits)).
- **MCP tool:** `reddit_search` on `https://api.lurkapi.com/mcp`
- **Freshness:** responses are cached for up to 1 minute
- **Try it live:** https://lurkapi.com/docs/reddit/search#try (no signup)
- **Platform:** [Reddit](https://lurkapi.com/docs/reddit.md) (reddit.com)
- **Web page:** https://lurkapi.com/docs/reddit/search

## When to use this

Use it for brand monitoring and finding where a topic is discussed. Results have no body text or link; pass https://www.reddit.com + `permalink` as `url` to post comments (reddit_post_comments) for the full post. Posts only, no comment search.

Site-wide post search, like reddit.com/search: title, author, subreddit, score, comment count and date.

**Pagination.** Pass the response's `after` back as `after`; it's null at the end.

## Parameters

All parameters go in the query string.

| Name | Type | Required | Default | Allowed values | Description | Example |
| --- | --- | --- | --- | --- | --- | --- |
| `query` | string | yes |  |  | Keywords, e.g. `claude mcp`. | `claude mcp` |
| `filter` | string | no | `posts` | `posts` | What to search. Only `posts` for now; comment search isn't supported yet. |  |
| `sort` | string | no | `relevance` | `relevance`, `new`, `top`, `comment_count` | Result order. |  |
| `timeframe` | string | no | `all` | `all`, `hour`, `day`, `week`, `month`, `year` | Only posts from the last hour, day, week, month, year, or all time. |  |
| `after` | string | no |  |  | The `after` from the previous response, to get the next page. |  |
| `trim` | boolean | no | `false` | `true`, `false` | Has no effect here: search results have no HTML body to drop. |  |

## Example request

Replace `YOUR_API_KEY` with your key, or set `LURKAPI_KEY` for the code. [Get a free key](https://lurkapi.com/login?next=/dashboard).

curl:

```bash
curl "https://api.lurkapi.com/v1/reddit/search?query=claude+mcp" \
  -H "x-api-key: YOUR_API_KEY"
```

JavaScript:

```js
const params = new URLSearchParams({
  query: "claude mcp",
});
const res = await fetch(`https://api.lurkapi.com/v1/reddit/search?${params}`, {
  headers: { "x-api-key": process.env.LURKAPI_KEY },
});
const data = await res.json();
if (!data.success) throw new Error(`${data.code}: ${data.error}`);
console.log(data.posts);
```

Python:

```python
import os
import requests

res = requests.get(
    "https://api.lurkapi.com/v1/reddit/search",
    params={
        "query": "claude mcp",
    },
    headers={"x-api-key": os.environ["LURKAPI_KEY"]},
    timeout=60,
)
data = res.json()
if not data["success"]:
    raise RuntimeError(f"{data['code']}: {data['error']}")
print(data["posts"])
```

## Example response

A real response from this endpoint, captured from the live API and trimmed to a couple of items. Strings over 96 characters (mostly signed media URLs) are cut short and end in `…`.

200 OK (application/json):

```json
{
  "success": true,
  "credits_remaining": 992,
  "credits_charged": 1,
  "posts": [
    {
      "id": "1v9n747",
      "name": "t3_1v9n747",
      "title": "Are people actually using MCP? For what?",
      "author": "ksyp21",
      "author_fullname": "t2_2rjo8r0b",
      "subreddit": "mcp",
      "subreddit_id": "t5_2s5cc",
      "subreddit_name_prefixed": "r/mcp",
      "quarantine": false,
      "permalink": "/r/mcp/comments/1v9n747/are_people_actually_using_mcp_for_what/",
      "score": 93,
      "ups": 93,
      "num_comments": 275,
      "created": 1785304145,
      "created_utc": 1785304145,
      "created_at_iso": "2026-07-29T05:49:05.000Z",
      "over_18": false,
      "spoiler": false,
      "thumbnail": null
    },
    {
      "id": "1w2grux",
      "name": "t3_1w2grux",
      "title": "What’s a good useful MCP you connected to that brings you real value?",
      "author": "Dense-Map-406",
      "author_fullname": "t2_zbqg0zcxt",
      "subreddit": "ClaudeAI",
      "subreddit_id": "t5_7t8hvt",
      "subreddit_name_prefixed": "r/ClaudeAI",
      "quarantine": false,
      "permalink": "/r/ClaudeAI/comments/1w2grux/whats_a_good_useful_mcp_you_connected_to_that/",
      "score": 412,
      "ups": 412,
      "num_comments": 249,
      "created": 1788094320,
      "created_utc": 1788094320,
      "created_at_iso": "2026-08-30T12:52:00.000Z",
      "over_18": false,
      "spoiler": false,
      "thumbnail": null
    }
  ],
  "after": "eyJjYW5kaWRhdGVzX3JldHVybmVkIjoie1wic2VjdGlvbl8xX3BpcGVsaW5lXzBfZ2xvYmFs…"
}
```

## Response fields

Every field of a successful response. `[]` marks a list: `a[].b` is the `b` of each item in `a`. **nullable** fields can be `null`; **optional** fields can be missing.

| Field | Type | Description |
| --- | --- | --- |
| `success` | `true` | Always true here; errors have `success: false`. |
| `credits_remaining` | `number` | Your balance after this call. On anonymous playground calls: free tries left today. |
| `credits_charged` | `number` | Credits this call cost; 0 on free endpoints. On anonymous playground calls: tries used (1). |
| `posts` | `object[]` | Matching posts, in `sort` order. |
| `posts[].id` | `string` | Post id. Pass the post's URL to post comments for the full post. |
| `posts[].name` | `string` | Fullname, `t3_` + id. |
| `posts[].title` | `string` | Post title. |
| `posts[].author` | `string`, nullable | Username, without u/; null if unknown. |
| `posts[].author_fullname` | `string`, nullable | Author's account fullname, `t2_` + id. |
| `posts[].subreddit` | `string` | Subreddit name without r/. |
| `posts[].subreddit_id` | `string`, nullable | Subreddit fullname, `t5_` + id. |
| `posts[].subreddit_name_prefixed` | `string` | e.g. `r/ClaudeAI`. |
| `posts[].quarantine` | `boolean` | The subreddit is quarantined. |
| `posts[].permalink` | `string`, nullable | Path on reddit.com; prepend https://www.reddit.com. |
| `posts[].score` | `number` | Upvotes minus downvotes. |
| `posts[].ups` | `number` | Same as score. |
| `posts[].num_comments` | `number` | Comment count when fetched. |
| `posts[].created` | `number` | Posted at, Unix seconds. |
| `posts[].created_utc` | `number` | Posted at, Unix seconds. |
| `posts[].created_at_iso` | `string` | Posted at, ISO 8601. |
| `posts[].over_18` | `boolean` | Marked NSFW. |
| `posts[].spoiler` | `boolean` | Marked as a spoiler. |
| `posts[].thumbnail` | `string`, nullable | Preview image URL; null for posts without media. |
| `after` | `string`, nullable | Pass as `after` for the next page. null on the last page. |

## Pagination

Pass the response's `after` back as `after`, with the other parameters unchanged, for the next page. It's `null` on the last page. Each page costs 1 credit.

The first five pages, in JavaScript:

```js
let after = null;
for (let page = 1; page <= 5; page++) {
  const params = new URLSearchParams({ query: "claude mcp" });
  if (after) params.set("after", after);
  const res = await fetch(`https://api.lurkapi.com/v1/reddit/search?${params}`, {
    headers: { "x-api-key": process.env.LURKAPI_KEY },
  });
  const data = await res.json();
  if (!data.success) throw new Error(`${data.code}: ${data.error}`);
  console.log(data.posts);
  after = data.after;
  if (!after) break; // last page
}
```

## Caching and freshness

Responses are cached for up to 1 minute, so a repeat call within that window can return the same data. It still costs 1 credit.

## Errors

Errors return `{ success: false, error, code, docs }` with the HTTP status below. Validation errors, `401`/`402`/`429` rejections and `5xx` failures are free; `not_found` is charged ([how charging works](https://lurkapi.com/docs.md#credits)). [All error codes](https://lurkapi.com/docs.md#errors).

| Status | Code | Meaning |
| --- | --- | --- |
| 401 | `missing_api_key` | No API key. Send it in the `x-api-key` header. |
| 401 | `invalid_api_key` | The key is unknown or was revoked. |
| 402 | `insufficient_credits` | Not enough credits for this call. Buy a pack or wait for tomorrow's top-up. |
| 405 | `method_not_allowed` | Endpoints take GET with query params. |
| 429 | `rate_limited` | Too many calls at once. Wait for the `retry-after` seconds, then retry. |
| 500 | `internal_error` | Something broke on our side. Retry; 5xx errors are free. |
| 502 | `upstream_error` | The platform didn't give a usable answer. Retry; 5xx errors are free. |
| 503 | `upstream_busy` | All our connections to the platform are busy. Retry in a few seconds; 5xx errors are free. |
| 504 | `upstream_timeout` | The platform took over 30 seconds to answer. Retry; timeouts are free. |

## Use it in Claude

Once LurkAPI is [connected to Claude](https://lurkapi.com/docs.md#claude), this endpoint is the `reddit_search` tool. Ask in plain English, for example:

Ask Claude:

```text
Use LurkAPI's reddit_search with query "claude mcp" and summarize what you find.
```

Claude calls `reddit_search` with arguments like these, and each call costs 1 credit:

Tool arguments:

```json
{
  "query": "claude mcp"
}
```

Tool results skip nulls and empty lists to save tokens, and `trim` defaults to `true`.

---

Previous: [Subreddit search](https://lurkapi.com/docs/reddit/subreddit-search.md) · Next: [Post comments](https://lurkapi.com/docs/reddit/post-comments.md)
