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.001JSON
Reddit每次呼叫 $0.001JSON
Reddit每次呼叫 $0.001JSON
Reddit每次呼叫 $0.001JSON
Reddit每次呼叫 $0.001JSON

指南:Best Reddit API in 2026: Pricing Compared

問題

常見問題

我要如何使用 Reddit Subreddit Search API?

使用 POST 請求將您的 SandBase API 金鑰放在 Authorization 標頭(Bearer)中,並以 JSON 主體傳入參數,即可呼叫 https://api.sandbase.ai/v1/api/reddit/subreddit-search。您也可以直接在本頁的 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 金鑰嗎?

不需要。Reddit Subreddit Search 是透過 SandBase 運作,因此一組 SandBase API 金鑰即可使用此端點以及目錄中的其他所有 API 和模型。您不需要另外申請 Reddit API 存取權。

我要如何搜尋單一 subreddit 的關鍵字並限制時間範圍?

將社群名稱不含 r/ 的部分填入 subreddit,並把搜尋詞放在 query。這個端點接受 sort 和 timeframe;請使用列出的值,而不是 Reddit 官方 API 的參數名稱。Keyword Search 與 app Dynamic Search 端點的請求欄位不同。

我要如何請求下一頁,requireFields 會改變價格嗎?

如果需要分頁,請在第一次呼叫時於 requireFields 中請求 nextCursor,並查看其標示價格:欄位需求可能會選到更昂貴的資料來源。請將回傳的完整 data.nextCursor 作為下一頁的 cursor。後續頁面會沿用第一頁所選的資料來源。若沒有這個需求,較便宜的來源可能不會回傳接續內容。即使貼文確實沒有某欄位,請求的欄位仍可能缺少。不要重複使用文件範例中縮短過的 cursor。

搜尋結果會包含完整貼文與所有留言嗎?

不會。參考文件允許 selftext 不存在或被截短,而且搜尋結果只是樣本,不是完整的討論封存。當您需要回覆時,請開啟選定的貼文,並使用 Post Comments 端點及其 URL。不要把標題、摘要或分數當成已驗證的產品回饋。