Sand AISand AI MAGI-2MAGI-2 现已上线 SandBase:支持原生音频的 1080p 视频立即试用

Reddit Subreddit Search

API 文档
https://api.sandbase.ai/v1/api/reddit/subreddit-search

Search posts within a single subreddit by query, sort, and timeframe.

价格
起价 $0.00035美元 / 次调用
方法
POST
响应
JSON
参数
1 个必填 · 5 个可选

Playground

输入
Subreddit name without the r/ prefix (e.g. 'Fitness').
Optional sort order: relevance, hot, top, new, comments.
Optional search query to match posts (e.g. 'push ups').
Optional pagination token from a previous response. Include `nextCursor` in requireFields on the first request to make sure a source that supports pagination serves it.
Optional time filter: all, year, month, week, day, hour.
Optional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example `nextCursor` or `selftext`, and it is served only by a source that returns every one of them. Fields you do not name are still returned whenever the serving source has them. This can raise your price: when the cheapest source cannot return a named field, a dearer source serves, and you are quoted and charged its price. Name `nextCursor` only if you will fetch more than the first page: when you leave it out, a cheaper source that cannot paginate may serve the request, and its nextCursor is null, so there is no next page to ask for. A named field can still be absent on a post that genuinely lacks it. Naming a combination that no single source returns together is refused as invalid input, with no charge. On a paginated walk it applies to the first page only; later pages stay with the source that page chose, at the price it was quoted.
输出就绪

您的输出将显示在这里

完成输入,然后点击运行。

API README

Reddit Subreddit Search API

Returns Reddit posts from one subreddit that match a search query. It needs a subreddit name without the r/ prefix, and it accepts an optional query, sort and timeframe.

Use cases

  • Find past discussions of a topic, such as push-ups, inside r/Fitness.
  • Rank the top posts of a subreddit for a keyword by score or numComments to see which threads got the most attention.
  • Collect post titles and text from a community to study how people talk about a topic.
  • Track new posts that mention a brand or term in a subreddit by sorting with new.

Request

curl -X POST "https://api.sandbase.ai/v1/api/reddit/subreddit-search" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "push ups", "subreddit": "Fitness"}'

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
subredditstringYesSubreddit name without the r/ prefix (e.g. 'Fitness').
cursorstringNoOptional pagination token from a previous response. Include nextCursor in requireFields on the first request to make sure a source that supports pagination serves it.
querystringNoOptional search query to match posts (e.g. 'push ups').
requireFieldsarrayNoOptional; omit it and routing is unchanged, with the cheapest source serving. Name the output fields this request must be able to return, for example nextCursor or selftext, and it is served only by a source that ret
sortstringNoOptional sort order: relevance, hot, top, new, comments.
timeframestringNoOptional time filter: all, year, month, week, day, hour.

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "data": {
    "nextCursor": "cur_vSRO4dkJp_Wni4NIHlJvKQ",
    "posts": [
      {
        "author": "Yea_Red",
        "authorId": "j6hq9",
        "createdUtc": 1428859519,
        "id": "32cksu",
        "nsfw": false,
        "numComments": 528,
        "permalink": "/r/Fitness/comments/32cksu/how_much_will_pushups_help_my_chest/",
        "score": 2003,
        "selftext": "I try to do 100 a day. Is this doing anything for me, or should I just focus on …",
        "subreddit": "Fitness",
        "title": "How much will push-ups help my chest?",
        "url": "https://www.reddit.com/r/Fitness/comments/32cksu/how_much_will_pushups_help_my_c…"
      }
    ]
  },
  "found": true
}

Response fields

FieldMeaning
data.posts[].titleTitle of the post.
data.posts[].selftextBody text of the post. Long text may be cut, and link posts may have none.
data.posts[].scoreScore of the post.
data.posts[].numCommentsNumber of comments on the post.
data.posts[].author / data.posts[].authorIdUsername and ID of the post author.
data.posts[].createdUtcCreation time of the post as a Unix timestamp in seconds (UTC).
data.posts[].idShort ID of the post, such as 32cksu.
data.posts[].permalink / data.posts[].urlPath and full URL of the post on Reddit.
data.posts[].nsfwtrue if the post is marked NSFW.
data.nextCursorToken to pass as cursor to get the next page of results.

Notes

For a Python request example that keeps the search and comment parameters separate, follow the community-research tutorial.

  • Pass the subreddit name without the r/ prefix, for example Fitness.
  • For more than the first page, add nextCursor to requireFields on the first request. Then send the returned data.nextCursor as cursor on the next call.
  • Add selftext, isArchived or isLocked to requireFields if you need those fields on every post.
  • To read the comments of a post, call Reddit Post Comments with the post.

Pricing

Billed at the actual cost of each call, about $0.00035 for the request above. Failed calls are not charged.

探索更多

相关 APIs

全部 APIs
API价格响应
Reddit每次调用从 $0.00035 起JSON
Reddit$0.001 每次调用JSON
Reddit$0.001 每次调用JSON
Reddit$0.001 每次调用JSON
Reddit$0.001 每次调用JSON
Reddit$0.001 每次调用JSON

指南:Best Reddit API in 2026: Pricing Compared

问题

常见问题

如何使用 Reddit Subreddit Search API?

向 https://api.sandbase.ai/v1/api/reddit/subreddit-search 发送 POST 请求,在 Authorization 请求头中使用您的 SandBase API key(Bearer),并将参数作为 JSON 请求体传入。您也可以直接在本页的 Playground 中试用,无需编写代码。

Reddit Subreddit Search API 的价格是多少?

起价每次调用 $0.00035,从您的 SandBase 余额中扣费。您只需为实际调用付费;无需订阅。

Reddit Subreddit Search API 接受哪些参数?

必填:subreddit (string)。 可选:sort(relevance, hot, top, new, comments 之一), query (string), cursor (string), timeframe(all, year, month, week, day, hour 之一) 和 requireFields (array)。 Parameters 表和本页的 Playground 列出了每个字段。

Reddit Subreddit Search API 返回什么?

在同一个 HTTP 请求中返回的 JSON 响应(同步)。 本页的 README 包含一个示例响应。

我需要 Reddit 开发者账户或 API key 吗?

不需要。Reddit Subreddit Search 通过 SandBase 运行,因此一个 SandBase API key 即可覆盖此端点以及目录中的其他所有 API 和模型。您无需单独申请 Reddit API 访问权限。

我如何在一个 subreddit 中搜索关键词并限制时间范围?

将社区名称(不带 r/)作为 subreddit 传入,并把搜索词放入 query。此端点接受 sort 和 timeframe;请使用列出的值,而不是 Reddit 官方 API 的参数名。Keyword Search 和应用内 Dynamic Search 端点的请求字段不同。

我如何请求下一页,requireFields 能改变价格吗?

如果需要分页,请在第一次调用时在 requireFields 中请求 nextCursor,并查看其标注价格:字段要求可能会选择更昂贵的数据源。将返回的完整 data.nextCursor 作为下一页的 cursor 传入。后续页面将保持与第一页相同的数据源。若不使用此要求,更便宜的数据源可能不会返回续页。对于真正缺少该字段的帖子,请求字段仍可能不存在。不要复用文档示例中缩短过的 cursor。

搜索结果包含完整帖子及其所有评论吗?

不包含。参考文档允许 selftext 缺失或被截断,而搜索结果只是样本,不是完整讨论存档。需要回复时,请打开所选帖子并使用带有其 URL 的 Post Comments 端点。不要把标题、摘要或评分当作已验证的产品反馈。