Reddit Keyword Search API (V1)
Searches Reddit posts by keyword with an optional continuation token. Use it to discover topic-related discussions or continue through additional search-result pages.
Parameters
| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
token | query | string | Yes | - | Access token for this API service. |
keyword | query | string | Yes | - | Search query keywords. |
after | query | string | No | | Pagination token to retrieve the next set of results. |
Code Samples
curl --max-time 120 -X GET 'https://api.justoneapi.com/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE'I want to use the "Keyword Search (V1)" API from JustOneAPI.
Base URL: https://api.justoneapi.com.
API Path: /api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE
API Endpoint: BASE_URL + /api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE
HTTP Method: GET
Authentication: Append the "token" query parameter to the URL.
OpenAPI Definition: https://docs.justoneapi.com/openapi/reddit/keyword-search-v1-en.json
Parameters:
- token (query): Access token for this API service. (Required)
- keyword (query): Search query keywords. (Required)
- after (query): Pagination token to retrieve the next set of results.
Return format: safely handle JSON or text according to the actual Content-Type.
Response Handling & Error Codes:
1. Business results should be determined by the "code" field in the response body (code 0 means success).
2. Timeout Recommendation: Set the request timeout to 120 seconds. If 120 seconds is too long for your use case, use at least 60 seconds, but a small number of requests may time out before receiving a result.
3. Business Code Reference:
- 0: Success
- 100: Invalid or Inactive Token
- 301: Collection Failed. Please Retry.
- 302: Rate Limit Exceeded
- 303: Daily Quota Exceeded
- 400: Invalid Parameters
- 500: Internal Server Error
- 600: Permission Denied
- 601: Insufficient Balance
- 602: Token Budget Exceeded
4. Code 601 means the shared account balance is insufficient. Code 602 means the current API token's own cumulative budget limit has been reached. Token budget limits do not transfer funds out of the shared account balance.
Please help me write a script in my preferred programming language to call this API and handle the response.import requests
BASE_URL = "https://api.justoneapi.com" # Provided by OpenAPI servers
url = BASE_URL + "/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE"
response = requests.get(url, timeout=120)
print(response.status_code)
if response.content:
content_type = response.headers.get("content-type", "").lower()
if "json" in content_type:
try:
print(response.json())
except ValueError:
print(response.text)
elif content_type.startswith("text/") or "xml" in content_type or content_type.split(";", 1)[0].strip() in {"application/javascript", "application/x-www-form-urlencoded", "application/graphql"}:
print(response.text)
else:
with open("response.bin", "wb") as output:
output.write(response.content)
print(f"Saved {len(response.content)} bytes to response.bin")const BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
const url = BASE_URL + "/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE";
const response = await fetch(url, {
method: "GET",
signal: AbortSignal.timeout(120000)
});
console.log(response.status);
const responseBytes = await response.arrayBuffer();
if (responseBytes.byteLength) {
const contentType = (response.headers.get("content-type") || "").toLowerCase();
const mediaType = contentType.split(";", 1)[0].trim();
const textual = contentType.startsWith("text/") || contentType.includes("json") || contentType.includes("xml") || ["application/javascript", "application/x-www-form-urlencoded", "application/graphql"].includes(mediaType);
if (textual) {
const responseText = new TextDecoder().decode(responseBytes);
let data = responseText;
if (contentType.includes("json")) {
try { data = JSON.parse(responseText); } catch { /* Keep the raw body. */ }
}
console.log(data);
} else {
console.log(`Received ${responseBytes.byteLength} binary bytes`);
}
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) throws Exception {
final String BASE_URL = "https://api.justoneapi.com"; // Provided by OpenAPI servers
final String url = BASE_URL + "/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE";
HttpClient client = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(120)).build();
HttpRequest.Builder builder = HttpRequest.newBuilder()
.uri(URI.create(url))
.timeout(Duration.ofSeconds(120))
.method("GET", HttpRequest.BodyPublishers.noBody());
HttpRequest request = builder.build();
HttpResponse<byte[]> response = client.send(request, HttpResponse.BodyHandlers.ofByteArray());
System.out.println(response.statusCode());
String contentType = response.headers().firstValue("content-type").orElse("").toLowerCase();
String mediaType = contentType.split(";", 2)[0].trim();
if (contentType.startsWith("text/") || contentType.contains("json") || contentType.contains("xml") || mediaType.equals("application/javascript") || mediaType.equals("application/x-www-form-urlencoded") || mediaType.equals("application/graphql")) {
System.out.println(new String(response.body(), StandardCharsets.UTF_8));
} else {
Files.write(Path.of("response.bin"), response.body());
System.out.println("Saved " + response.body().length + " bytes to response.bin");
}
}
}package main
import (
"fmt"
"io"
"os"
"strings"
"net/http"
"time"
)
const BASE_URL = "https://api.justoneapi.com" // Provided by OpenAPI servers
func main() {
client := &http.Client{Timeout: 120 * time.Second}
url := BASE_URL + "/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE"
req, _ := http.NewRequest("GET", url, nil)
resp, _ := client.Do(req)
defer resp.Body.Close()
fmt.Println(resp.StatusCode)
bodyBytes, _ := io.ReadAll(resp.Body)
contentType := strings.ToLower(resp.Header.Get("Content-Type"))
mediaType := strings.TrimSpace(strings.SplitN(contentType, ";", 2)[0])
if strings.HasPrefix(contentType, "text/") || strings.Contains(contentType, "json") || strings.Contains(contentType, "xml") || mediaType == "application/javascript" || mediaType == "application/x-www-form-urlencoded" || mediaType == "application/graphql" {
fmt.Println(string(bodyBytes))
} else {
os.WriteFile("response.bin", bodyBytes, 0600)
fmt.Printf("Saved %d bytes to response.bin\n", len(bodyBytes))
}
}<?php
$BASE_URL = 'https://api.justoneapi.com'; // Provided by OpenAPI servers
$url = $BASE_URL . '/api/reddit/search/v1?token=YOUR_API_KEY&keyword=VALUE';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 120);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
$contentType = strtolower((string) curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
curl_close($ch);
echo $status . PHP_EOL;
$mediaType = trim(explode(';', $contentType, 2)[0]);
if (str_starts_with($contentType, 'text/') || str_contains($contentType, 'json') || str_contains($contentType, 'xml') || in_array($mediaType, ['application/javascript', 'application/x-www-form-urlencoded', 'application/graphql'], true)) {
echo $response;
} else {
file_put_contents('response.bin', $response);
echo 'Saved ' . strlen($response) . ' bytes to response.bin' . PHP_EOL;
}Response Fields
Key fields in a successful response (code = 0).
Pagination4 fields
data.search.dynamic.components.main.pageInfo
Pagination information for the current search page.
| Field | Type | Description |
|---|---|---|
endCursor | string | Pass this cursor unchanged as after with the same keyword to request the next page when hasNextPage is true. |
hasNextPage | boolean | Whether Reddit reports that a subsequent page is available. |
hasPreviousPage | boolean | Whether Reddit reports that an earlier page is available. |
startCursor | string | Cursor reported at the start of the current page. |
Search response structure5 fields
data
Reddit search results and pagination information.
| Field | Type | Description |
|---|---|---|
search | object | Search result data. |
search.dynamic | object | Dynamic result data returned for the search. |
search.dynamic.components | object | Components returned for the search results. |
search.dynamic.components.__typename | string | GraphQL type name of the search components object. |
search.dynamic.components.main | object | Main result connection, containing result edges and page information. |
Search result components8 fields
data.search.dynamic.components.main
| Field | Type | Description |
|---|---|---|
edges | array | Result edges on the page. An edge can contain a list, a row, or another search component. |
edges[] | object | One result edge. |
edges[].cursor | string | Cursor reported for this result edge. |
edges[].node | object | Search component on this edge. Some component types contain post results. |
edges[].node.__typename | string | GraphQL type identifying the search component. |
edges[].node.children | array | Child results of the component, when present. |
edges[].node.children[] | object | One child result. Post results include a post object. |
edges[].node.children[].__typename | string | GraphQL type identifying the child result. |
Search filters6 fields
data.search.dynamic.components
| Field | Type | Description |
|---|---|---|
appliedState | object | Search filters and result pane reported for this response. |
appliedState.filters | array | Filters reported as applied to the search results. |
appliedState.filters[] | object | One reported search filter. |
appliedState.filters[].key | string | Name of the reported filter. |
appliedState.filters[].value | string | Value of the reported filter. |
appliedState.pane | string | Result pane reported for the search. |
Post information15 fields
data.search.dynamic.components.main.edges[].node.children[].post
Post information for a post result, when present.
| Field | Type | Description |
|---|---|---|
__typename | string | GraphQL type name of the post object. |
createdAt | string | Post creation timestamp as text. Reddit can return the time-zone offset without a colon. |
domain | string | Domain label Reddit reports for the post. |
editedAt | string | null | Post edit timestamp when available. |
id | string | Reddit full post ID, including its t3_ prefix. |
languageCode | string | null | Language code reported for the post. |
permalink | string | Relative Reddit permalink path for this post. |
postHint | string | null | Post presentation hint reported by Reddit when available. |
postTitle | string | Title reported for the post. |
thumbnail | object | null | Post thumbnail when included. |
thumbnail.dimensions | object | Image or player dimensions in pixels. |
thumbnail.dimensions.height | integer | Height in pixels. |
thumbnail.dimensions.width | integer | Width in pixels. |
thumbnail.url | string | Thumbnail image URL. |
url | string | URL associated with the post. |
Post body12 fields
data.search.dynamic.components.main.edges[].node.children[].post.content
Post body when Reddit supplies it. The value can be null.
| Field | Type | Description |
|---|---|---|
html | string | HTML representation of the post body when supplied. |
markdown | string | Post body in Markdown as returned by Reddit. |
preview | string | Body preview when supplied. |
richtext | string | Serialized Reddit rich text as a string when available. |
richtextMedia | array | Media items referenced in the post body rich text. |
richtextMedia[] | object | One media item referenced in the post body. |
richtextMedia[].height | integer | Height of this media item, in pixels. |
richtextMedia[].id | string | Media ID in the post body. |
richtextMedia[].mimetype | string | MIME type of the media item in the post body. |
richtextMedia[].status | string | Status reported for the media item in the post body. |
richtextMedia[].url | string | URL for this media item in the post body. |
richtextMedia[].width | integer | Width of this media item, in pixels. |
Author profile and flair25 fields
data.search.dynamic.components.main.edges[].node.children[].post
| Field | Type | Description |
|---|---|---|
authorFlair | object | null | Author flair in this community, when available. |
authorFlair.richtext | string | null | Serialized rich text of the author flair, when provided. |
authorFlair.text | string | Display text of the author flair. |
authorInfo | object | Public information for the post author. |
authorInfo.accountType | string | Account type reported for the author. |
authorInfo.iconSmall | object | Small author icon image. |
authorInfo.iconSmall.dimensions | object | Image dimensions in pixels. |
authorInfo.iconSmall.dimensions.height | integer | Height in pixels. |
authorInfo.iconSmall.dimensions.width | integer | Width in pixels. |
authorInfo.iconSmall.url | string | Image URL. |
authorInfo.id | string | Reddit full ID of the post author. |
authorInfo.isCakeDayNow | boolean | Whether Reddit marks it as the author's account anniversary. |
authorInfo.name | string | Public Reddit username of the author. |
authorInfo.newIcon | object | Author icon image returned in the new icon field. |
authorInfo.newIcon.dimensions | object | Image dimensions in pixels. |
authorInfo.newIcon.dimensions.height | integer | Height in pixels. |
authorInfo.newIcon.dimensions.width | integer | Width in pixels. |
authorInfo.newIcon.url | string | Image URL. |
authorInfo.profile | object | Public Reddit profile information associated with the author. |
authorInfo.profile.isNsfw | boolean | Whether Reddit marks the author's profile as NSFW. |
authorInfo.snoovatarIcon | object | null | Snoovatar image for the author, when available. |
authorInfo.snoovatarIcon.dimensions | object | Image dimensions in pixels. |
authorInfo.snoovatarIcon.dimensions.height | integer | Height in pixels. |
authorInfo.snoovatarIcon.dimensions.width | integer | Width in pixels. |
authorInfo.snoovatarIcon.url | string | Image URL. |
Subreddit information8 fields
data.search.dynamic.components.main.edges[].node.children[].post.subreddit
Community associated with the post when this section is returned.
| Field | Type | Description |
|---|---|---|
id | string | Reddit community identifier. |
isNsfw | boolean | Whether Reddit marks the community as NSFW. |
isQuarantined | boolean | Whether Reddit marks the community as quarantined. |
name | string | Community name. |
prefixedName | string | Community name with its Reddit prefix. |
subscribersCount | integer | Subscriber count reported for the community. |
title | string | Community display title. |
type | string | Community type reported by Reddit. |
Post flags and permissions17 fields
data.search.dynamic.components.main.edges[].node.children[].post
| Field | Type | Description |
|---|---|---|
flair | object | null | Post flair when available. |
flair.richtext | string | null | Serialized rich text of the post flair, when provided. |
flair.text | string | Display text of the post flair. |
flair.type | string | Post-flair type reported by Reddit. |
isArchived | boolean | Whether Reddit marks the post as archived. |
isCommercialCommunication | boolean | Whether Reddit marks the post as a commercial communication. |
isContestMode | boolean | Whether Reddit marks the post as being in contest mode. |
isCrosspostable | boolean | Whether Reddit marks the post as eligible for crossposting. |
isLocked | boolean | Whether Reddit marks the post as locked. |
isNsfw | boolean | Whether Reddit marks the post as not safe for work. |
isPollIncluded | boolean | Whether Reddit indicates that the post contains a poll. |
isScoreHidden | boolean | Whether Reddit flags the score as hidden. |
isSelfPost | boolean | Whether Reddit marks this as a self post. |
isSpoiler | boolean | Whether Reddit marks the post as a spoiler. |
isStickied | boolean | Whether Reddit marks the post as pinned. |
isTranslatable | boolean | Whether Reddit marks the post as translatable. |
isTranslated | boolean | Whether Reddit marks the returned post as translated. |
Engagement10 fields
data.search.dynamic.components.main.edges[].node.children[].post
| Field | Type | Description |
|---|---|---|
awardings | array | Award records returned for the post. |
awardings[] | object | One award type and its count. |
awardings[].award | object | Public details for the award type. |
awardings[].award.id | string | Reddit award identifier. |
awardings[].award.name | string | Award display name. |
awardings[].total | integer | Count of this award reported for the post. |
commentCount | integer | Comment count reported for the post. |
score | integer | Post score reported by Reddit. |
suggestedCommentSort | string | null | Suggested display ordering for comments when available. |
upvoteRatio | number | Post upvote ratio reported as a fraction from 0 to 1. |
Post images35 fields
data.search.dynamic.components.main.edges[].node.children[].post.media.still
Still images for the post, including a source and resized renditions.
| Field | Type | Description |
|---|---|---|
large | object | null | Large image rendition. |
large.dimensions | object | Image or player dimensions in pixels. |
large.dimensions.height | integer | Height in pixels. |
large.dimensions.width | integer | Width in pixels. |
large.url | string | Still image URL. |
medium | object | null | Medium image rendition. |
medium.dimensions | object | Image or player dimensions in pixels. |
medium.dimensions.height | integer | Height in pixels. |
medium.dimensions.width | integer | Width in pixels. |
medium.url | string | Still image URL. |
small | object | null | Small image rendition. |
small.dimensions | object | Image or player dimensions in pixels. |
small.dimensions.height | integer | Height in pixels. |
small.dimensions.width | integer | Width in pixels. |
small.url | string | Still image URL. |
source | object | Source still image. |
source.dimensions | object | Image or player dimensions in pixels. |
source.dimensions.height | integer | Height in pixels. |
source.dimensions.width | integer | Width in pixels. |
source.url | string | Still image URL. |
xlarge | object | null | Extra-large image rendition. |
xlarge.dimensions | object | Image or player dimensions in pixels. |
xlarge.dimensions.height | integer | Height in pixels. |
xlarge.dimensions.width | integer | Width in pixels. |
xlarge.url | string | Still image URL. |
xxlarge | object | null | Double extra-large image rendition. |
xxlarge.dimensions | object | Image or player dimensions in pixels. |
xxlarge.dimensions.height | integer | Height in pixels. |
xxlarge.dimensions.width | integer | Width in pixels. |
xxlarge.url | string | Still image URL. |
xxxlarge | object | null | Triple extra-large image rendition. |
xxxlarge.dimensions | object | Image or player dimensions in pixels. |
xxxlarge.dimensions.height | integer | Height in pixels. |
xxxlarge.dimensions.width | integer | Width in pixels. |
xxxlarge.url | string | Still image URL. |
Video playback and downloads23 fields
data.search.dynamic.components.main.edges[].node.children[].post.media
Media included with the post, when present. Gallery media also has its own section.
| Field | Type | Description |
|---|---|---|
download | object | null | Download metadata when Reddit supplies it. |
download.url | string | Media download URL returned by Reddit. |
packagedMedia | object | null | Packaged media when Reddit supplies it. |
packagedMedia.muxedMp4s | object | null | Packaged MP4 renditions grouped by quality. |
packagedMedia.muxedMp4s.high | object | High-quality MP4 rendition. |
packagedMedia.muxedMp4s.high.url | string | Packaged MP4 URL. |
packagedMedia.muxedMp4s.highest | object | Highest-quality MP4 rendition returned in this collection. |
packagedMedia.muxedMp4s.highest.url | string | Packaged MP4 URL. |
packagedMedia.muxedMp4s.low | object | Low-quality MP4 rendition. |
packagedMedia.muxedMp4s.low.url | string | Packaged MP4 URL. |
packagedMedia.muxedMp4s.medium | object | Medium-quality MP4 rendition. |
packagedMedia.muxedMp4s.medium.url | string | Packaged MP4 URL. |
packagedMedia.muxedMp4s.recommended | object | MP4 rendition recommended by Reddit. |
packagedMedia.muxedMp4s.recommended.url | string | Packaged MP4 URL. |
streaming | object | null | Stream metadata when Reddit supplies it. |
streaming.dashUrl | string | DASH stream manifest URL. |
streaming.dimensions | object | Image or player dimensions in pixels. |
streaming.dimensions.height | integer | Height in pixels. |
streaming.dimensions.width | integer | Width in pixels. |
streaming.duration | integer | Duration value Reddit reports for the stream. |
streaming.hlsUrl | string | HLS stream manifest URL. |
streaming.isGif | boolean | Whether Reddit marks the stream as a GIF-style animation. |
typeHint | string | null | Media type hint reported by Reddit when available. |
Post gallery39 fields
data.search.dynamic.components.main.edges[].node.children[].post.gallery
Gallery included with the post, when present.
| Field | Type | Description |
|---|---|---|
items | array | Media entries in the gallery. |
items[] | object | One gallery entry. |
items[].id | string | Identifier of the gallery entry. |
items[].media | object | Media for this gallery entry. |
items[].media.height | integer | Gallery media height in pixels. |
items[].media.id | string | Reddit identifier for the gallery media. |
items[].media.large | object | Large image rendition. |
items[].media.large.dimensions | object | Image or player dimensions in pixels. |
items[].media.large.dimensions.height | integer | Height in pixels. |
items[].media.large.dimensions.width | integer | Width in pixels. |
items[].media.large.url | string | Still image URL. |
items[].media.medium | object | Medium image rendition. |
items[].media.medium.dimensions | object | Image or player dimensions in pixels. |
items[].media.medium.dimensions.height | integer | Height in pixels. |
items[].media.medium.dimensions.width | integer | Width in pixels. |
items[].media.medium.url | string | Still image URL. |
items[].media.mimetype | string | MIME type of the gallery media. |
items[].media.small | object | Small image rendition. |
items[].media.small.dimensions | object | Image or player dimensions in pixels. |
items[].media.small.dimensions.height | integer | Height in pixels. |
items[].media.small.dimensions.width | integer | Width in pixels. |
items[].media.small.url | string | Still image URL. |
items[].media.url | string | URL returned for the gallery media. |
items[].media.width | integer | Gallery media width in pixels. |
items[].media.xlarge | object | Extra-large image rendition. |
items[].media.xlarge.dimensions | object | Image or player dimensions in pixels. |
items[].media.xlarge.dimensions.height | integer | Height in pixels. |
items[].media.xlarge.dimensions.width | integer | Width in pixels. |
items[].media.xlarge.url | string | Still image URL. |
items[].media.xxlarge | object | null | Double extra-large image rendition. |
items[].media.xxlarge.dimensions | object | Image or player dimensions in pixels. |
items[].media.xxlarge.dimensions.height | integer | Height in pixels. |
items[].media.xxlarge.dimensions.width | integer | Width in pixels. |
items[].media.xxlarge.url | string | Still image URL. |
items[].media.xxxlarge | object | null | Triple extra-large image rendition. |
items[].media.xxxlarge.dimensions | object | Image or player dimensions in pixels. |
items[].media.xxxlarge.dimensions.height | integer | Height in pixels. |
items[].media.xxxlarge.dimensions.width | integer | Width in pixels. |
items[].media.xxxlarge.url | string | Still image URL. |