Reddit Keyword Search
Searches Reddit posts by keyword with an optional continuation token. Use it to discover topic-related discussions or continue through additional search-result pages.
/v1/reddit/search_v1
$0.02
- Price
- $0.02 per successful call, Failed calls are free
- Endpoint ID
reddit.search_v1
Parameters
-
keywordstring RequiredSearch query keywords.
Example
咖啡 -
afterstring OptionalPagination token to retrieve the next set of results.
Code samples
curl -G "https://api.mofa-ai.com/v1/reddit/search_v1" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'keyword=咖啡'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/reddit/search_v1",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"keyword": "咖啡",
},
timeout=60,
)
body = resp.json()
if body["success"]:
print(body["cost_usd"], body["data"])
else:
print(body["error"], body["message"])
const url = new URL("https://api.mofa-ai.com/v1/reddit/search_v1");
url.search = new URLSearchParams({
keyword: "咖啡",
});
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.MOFA_API_KEY}` },
});
const body = await resp.json();
if (body.success) console.log(body.cost_usd, body.data);
else console.error(body.error, body.message);
Example response
Request parameters {"keyword": "咖啡"}
{
"success": true,
"code": 0,
"message": "success",
"request_id": "req_5f1c2a9be04d7c3a81f6e2d0",
"endpoint": "reddit.search_v1",
"cost_usd": 0.02,
"data": {
"code": 0,
"data": {
"search": {
"dynamic": {
"components": {
"top": {
"filterBar": [
{
"behaviors": [
{
"id": "relevance",
"pane": "posts",
"query": "咖啡",
"filters": [
{
"key": "sort",
"value": "RELEVANCE"
}
],
"options": [],
"telemetry": {
"events": [
{
"noun": "…",
"action": "…",
"source": "…",
"trigger": "…",
"triggerConfiguration": "…"
}
],
"__typename": "SearchElementTelemetry",
"trackingContext": {
"post": null,
"search": {
"sort": "…",
"query": "…",
"range": "…",
"scope": "…",
"isNsfw": "…",
"queryID": "…",
"snippet": "…",
"snippetId": "…",
"safeSearch": "…"
},
"answers": null,
"profile": null,
"subreddit": null,
"__typename": "SearchTelemetryTrackingContext",
"actionInfo": {
"type": "…",
"reason": "…",
"paneName": "…",
"position": "…",
"relativePosition": "…"
},
"metaSearch": null
}
},
"__typename": "SearchFilterBehavior",
"isAppliedFiltersRemoved": false,
"isAppliedOptionsRemoved": false
},
"… +4"
],
"__typename": "SearchDropdown",
"presentation": {
"id": "post_sort",
"title": "Sort by",
"options": [
{
"text": "Relevance",
"isSelected": true,
"secondaryText": null
},
"… +4"
],
"__typename": "SearchFilterOptionListPresentation",
"buttonText": "Relevance"
}
},
"… +1"
],
"navigation": {
"behaviors": [
{
"id": "all",
"pane": "all",
"query": "咖啡",
"filters": [
{
"key": "safe_search",
"value": "unset"
}
],
"options": [
{
"key": "mode",
"value": "search"
}
],
"telemetry": {
"events": [
{
"noun": "tab",
"action": "click",
"source": "search",
"trigger": "CLICK",
"triggerConfiguration": null
}
],
"__typename": "SearchElementTelemetry",
"trackingContext": {
"post": null,
"search": {
"sort": null,
"query": "咖啡",
"range": null,
"scope": {
"id": "…",
"name": "…",
"path": "…",
"type": "…"
},
"isNsfw": false,
"queryID": "694825bb-bcca-4be3-9a76-7e6c5b67b674",
"snippet": null,
"snippetId": null,
"safeSearch": "UNAVAILABLE"
},
"answers": null,
"profile": null,
"subreddit": null,
"__typename": "SearchTelemetryTrackingContext",
"actionInfo": {
"type": "all",
"reason": null,
"paneName": "posts",
"position": null,
"relativePosition": null
},
"metaSearch": null
}
},
"__typename": "SearchFilterBehavior",
"isAppliedFiltersRemoved": true,
"isAppliedOptionsRemoved": false
},
"… +5"
],
"__typename": "SearchNavigationList",
"listPresentation": {
"items": [
{
"id": "all",
"text": "All",
"isSelected": false
},
"… +5"
]
}
},
"filterModal": null
},
"main": {
"edges": [
{
"node": {
"id": "section_2_pipeline_5_nsfw_banner",
"behaviors": {
"cta": {
"telemetry": {
"events": [
"…"
],
"__typename": "SearchElementTelemetry",
"trackingContext": {
"post": "…",
"search": "…",
"answers": "…",
"profile": "…",
"subreddit": "…",
"__typename": "…",
…
Truncated for display; the full response is longer.
Try it
Sign in to call this endpoint from this page. Successful calls are billed to your balance, failed calls are free, and new accounts get $0.50 of trial credit.
More Reddit endpoints
-
Post Details
$0.02Retrieves details for a Reddit post identified by its full post ID. Use it to look up a known post before discussion review, content analysis, or subsequent…
/v1/reddit/get_post_detail_v1
-
Post Comments
$0.02Retrieves comments for a Reddit post with pagination-token support. Use it to review a thread's discussion or continue through additional comment results for…
/v1/reddit/get_post_comments_v1