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.00035USD / вызов
Метод
POST
Ответ
JSON
Параметры
1 обязательных · 5 необязательных

Песочница

Ввод
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.
ВыходГотово

Ваш результат появится здесь

Заполните входные данные, затем нажмите «Запустить».

README по API

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

Вопросы

FAQ

Как использовать API Reddit Subreddit Search?

Отправьте POST-запрос на https://api.sandbase.ai/v1/api/reddit/subreddit-search, указав ключ SandBase API в заголовке Authorization (Bearer), а параметры — в теле JSON. Вы также можете попробовать это в Playground на этой странице без написания кода.

Сколько стоит API Reddit Subreddit Search?

От $0.00035 за вызов, списывается с баланса SandBase. Оплата взимается только за сделанные вызовы; подписка не требуется.

Какие параметры принимает API Reddit Subreddit Search?

Обязательные: subreddit (string). Необязательные: sort (один из relevance, hot, top, new, comments), query (string), cursor (string), timeframe (один из all, year, month, week, day, hour) и requireFields (array). В таблице Parameters и в Playground на этой странице перечислены все поля.

Что возвращает API Reddit Subreddit Search?

JSON-ответ, возвращаемый в том же HTTP-запросе (синхронно). В README на этой странице приведен пример ответа.

Нужен ли мне аккаунт разработчика Reddit или API key?

Нет. Reddit Subreddit Search работает через SandBase, поэтому один API key SandBase покрывает этот endpoint и все остальные API и модели в каталоге. Вам не нужно отдельно запрашивать доступ к API Reddit.

Как выполнить поиск по одному subreddit по ключевому слову и ограничить временной диапазон?

Передайте имя сообщества без r/ в subreddit, а поисковую фразу — в query. Этот endpoint принимает sort и timeframe; используйте перечисленные значения, а не имена параметров официального Reddit API. В endpoint Keyword Search и app Dynamic Search поля запроса отличаются.

Как запросить следующую страницу, и может ли requireFields изменить цену?

Если нужна пагинация, запросите nextCursor в requireFields на первом вызове и проверьте его цену в кавычках: требование поля может выбрать более дорогой источник. Передайте полный возвращенный data.nextCursor как cursor для следующей страницы. Последующие страницы остаются на источнике, выбранном для первой страницы. Без этого требования более дешевый источник может вернуть без продолжения. Запрошенное поле все равно может отсутствовать у поста, если у него его действительно нет. Не переиспользуйте сокращенный cursor из примера в документации.

Содержит ли результат поиска полный пост и все его комментарии?

Нет. В справке selftext может отсутствовать или быть сокращенным, а результаты поиска — это выборка, а не полный архив обсуждений. Откройте выбранный пост и используйте endpoint Post Comments с его URL, когда нужны ответы. Не считайте заголовок, фрагмент или score подтвержденной обратной связью о продукте.