Subreddit API
EN

Subreddit API · GET · JSON

A field notebook for comparing soil discussions

Conceptual illustration, not a screenshot or measured result.

Questions about this page

Which research question should come before the search?

Ask how authors explain a soil problem and justify a proposed remedy, rather than which community gives the “best” advice.

What should I save alongside the retrieved records?

On a local card, keep its source community, available identifier, supporting quotation and your interpretation in separate places.

How do I set rules for comparing two selections?

Record q, kind, dates and any min_score threshold before collecting comparison sets.

What if readers disagree about a passage?

Allow overlapping labels and an unresolved category.

Which conclusions can the text actually support?

Present selected quotations beside the local categories and counts, stating exactly which received texts were included.

What is Subreddit API?

Subreddit API is an independent read-only service for retrieving available archived Reddit posts and comments as JSON. Authenticate with the key for this site and choose a documented search or lookup route. It is not official Reddit, live access or a complete export of a community.

How much does Subreddit API cost?

The price is $1 per 1,000 successful requests. The minimum top-up is $50 for 50,000 credits. Each successful request uses one credit, even when it returns no matching records. Invalid requests are not charged; upstream failures trigger a refund, which can require reconciliation. A timeout alone does not establish the final billing outcome.

How do I get an API key?

Create an account with email and password, or continue with Google in a popup. Eligible new accounts receive $5 (5,000 credits) once across this site network. Your API key is available at the top of the account after sign-in and is stored encrypted. Keep it on your server.

Set a reading question

Ask how authors explain a soil problem and justify a proposed remedy, rather than which community gives the “best” advice. Begin with https://api.subredditapi.com/v1/search?q=soil&subreddit=gardening&limit=3. The term searches title and text. Read the response before deciding which passages address cultivation; a keyword alone does not settle relevance. Save the actual input, including an empty success.

Give each passage a context card

On a local card, keep its source community, available identifier, supporting quotation and your interpretation in separate places. Note only conditions stated in the text. Container growing, drainage and compost are possible prompts for the reading exercise, not asserted contents of the response. Distinguish a firsthand account from a question, a quotation or an unsupported recommendation. Missing text should be marked, not reconstructed.

Write the comparison rules before counting

Record q, kind, dates and any min_score threshold before collecting comparison sets. Use post or comment for kind; avoid comparing posts in one group with comments in another without explaining that choice. from and to are YYYY-MM-DD dates in UTC, with to inclusive. These filters control retrieval conditions; matching them does not eliminate unequal archive coverage, missing context or truncation from the page limit.

Dates filter content creation through created_utc, not your collection time, and the entire final to day is included. Choose a second community explicitly and request it separately. A shared rule set improves transparency without removing unequal coverage or making either selection representative.

Let difficult passages change the notebook

Allow overlapping labels and an unresolved category. When two readings disagree, return to the passage and record why; do not force certainty to simplify a chart. If suitable identifiers exist, track repeated records and authors so several posts do not silently become several independent people. Retain excluded passages and their reasons. Optional relationship fields can join what you received, but cannot supply missing ancestors.

Write a finding that a reader can check

Present selected quotations beside the local categories and counts, stating exactly which received texts were included. Counts describe that selection, not all gardening discussion or all community members. The service is an independent, nonofficial historical archive, without live coverage, exhaustive collection or immutable responses. Save responses and versions of the reading rules for local reanalysis.

Retrieval follows _doc order, not relevance or chronology, and is capped at 100 records per request and 100 pages per query. Do not infer completeness from a total or page boundary. Documentation explains these mechanics; Pricing covers successful requests, empty results and retries. The deliverable is an inspectable comparison of language, not an automated sentiment score or gardening recommendation.

Make your first authenticated request

Create an account, copy the key shown at the top of the account page, and put it in a server environment variable. The three examples below request the same small page. Inspect the HTTP status before using the JSON; keep credentials out of browser bundles, shared notebooks and request logs.

cURL

curl --get --fail-with-body 'https://api.subredditapi.com/v1/search' \
  -H "Authorization: Bearer ${REDDIT_API_KEY}" \
  --data-urlencode 'q=soil' \
  --data-urlencode 'subreddit=gardening' \
  --data-urlencode 'limit=3'

Python

import json
import os
from urllib.parse import urlencode
from urllib.request import Request, urlopen

params = urlencode({"q":"soil","subreddit":"gardening","limit":"3"})
request = Request(
    "https://api.subredditapi.com/v1/search?" + params,
    headers={"Authorization": "Bearer " + os.environ["REDDIT_API_KEY"]},
)
with urlopen(request, timeout=20) as response:
    payload = json.load(response)

print(payload["pagination"])
print(payload["data"])

Node.js 18+

// Node.js 18+ · example.mjs
const parameters = new URLSearchParams({"q":"soil","subreddit":"gardening","limit":"3"});
const response = await fetch(
  "https://api.subredditapi.com/v1/search?" + parameters,
  {headers: {Authorization: "Bearer " + process.env.REDDIT_API_KEY}}
);
if (!response.ok) throw new Error("HTTP " + response.status);
const payload = await response.json();
console.log(payload.pagination);
console.log(payload.data);

Read the response before building a table

This is an illustrative empty successful response, not a live query result. An empty page still costs one credit. Read data, pagination and credits separately; a total must always be interpreted with relation. The balance shown is an example after one eligible trial request.

{
  "data": [],
  "pagination": {
    "page": 1,
    "limit": 3,
    "total": 0,
    "relation": "eq",
    "has_more": false,
    "window_exhausted": false,
    "truncated": false
  },
  "credits": {
    "cost": 1,
    "balance": 4999
  }
}

Response

Inspect the actual objects before assuming a column exists. Keep omitted values, null and empty strings distinct. Relationship fields, when returned, may help with local grouping; they do not establish a complete thread. Preserve the raw response so a revised mapping can be tested without paying to fetch it again.

Combine ordinary text with an exact community and a UTC date window. Keep the nonsecret query parameters with the saved response. Limit controls the page size, page selects a bounded offset, and min_score is a filter rather than a sorting option. A page order is not a chronological or relevance ranking.

Six routes, one read-only API contract

Choose the route for the object you need. Search selects posts and comments; posts and comments constrain the record kind. Item looks up a known id. Subreddits returns matching community names rather than a complete community dataset. Status is an uncharged service-scope response and does not test search availability.

MethodAPIUse
GET/v1/searchSearch posts and comments
GET/v1/postsPosts only
GET/v1/commentsComments only
GET/v1/itemOne known record id
GET/v1/subredditsCommunity names by prefix
GET/v1/statusService scope; no charge

Set the boundaries of a collection job

Combine ordinary text with an exact community and a UTC date window. Keep the nonsecret query parameters with the saved response. Limit controls the page size, page selects a bounded offset, and min_score is a filter rather than a sorting option. A page order is not a chronological or relevance ranking.

ParameterMeaning
qText in title and text
subredditExact community spelling
authorExact author value
kindpost or comment
from / toYYYY-MM-DD, UTC; end day included
min_scoreMinimum score, not sorting
limit / pageBoth range from 1 to 100
prefix / idRoute-specific name prefix or known id

Map observed fields deliberately

Inspect the actual objects before assuming a column exists. Keep omitted values, null and empty strings distinct. Relationship fields, when returned, may help with local grouping; they do not establish a complete thread. Preserve the raw response so a revised mapping can be tested without paying to fetch it again.

ParameterMeaning
idKeep the source identifier
kindInspect the record kind
subredditPreserve the returned community name
title / textTreat missing, null and empty separately
created_utc / scoreCheck numeric values before conversion
parent_id / link_idOptional links; group locally if present
Conceptual illustration, not a screenshot or measured result.

Where this archive API fits

Use this service when your task starts with reading available historical records. A live feed, posting, editing, voting or a server-built thread requires a different integration. Direct page scraping and official Reddit access have their own behaviour and requirements; this endpoint does not impersonate either interface or promise their coverage.

How do search, posts and comments differ?

Use /v1/search for the supported search across record kinds. /v1/posts and /v1/comments add a post or comment constraint. They share the documented search filters; /v1/item is the separate route for a known id. None of these routes creates, edits or deletes Reddit content.

How is this different from scraping Reddit pages?

You request structured historical records through the documented routes instead of downloading current HTML and extracting page elements. This avoids making your loader depend on page markup. It does not provide a live proxy, browser session, official OAuth compatibility or a promise of complete historical coverage.

Documentation

Authentication and request outcomes

Send authenticated GET requests to https://api.subredditapi.com with X-API-Key: <key> or Authorization: Bearer <key>. Both headers are supported. Keep the key in your server configuration, outside published datasets and diagnostic logs. The account panel uses a separate Secure HttpOnly session cookie. Signing into that panel does not replace the API-key header used to retrieve archived records.

HTTP 400 means an invalid request, 401 a missing or invalid key, 402 insufficient credit and 429 a rate limit. Correct parameters before retrying 400 and check the credential for 401. For 402, pause the collection or decide whether to top up. For 429, wait and bound your retries. Check the status before treating the response body as a successful sample.

Each successful retrieval consumes one credit, even if empty. Invalid requests do not debit the balance and upstream failures refund the reservation. A client may lose its connection after a successful, billable server retrieval. A successful repeat costs another credit. Keep attempt outcomes separately from the number of records you accepted into your research dataset; local rejection does not reverse an API charge.

Endpoint structure and filtering

The available routes are /v1/search, /v1/posts, /v1/comments, /v1/item, /v1/subreddits and /v1/status. Use search for supported text queries, posts for posts and comments for comments. Only /v1/item requires id for a known record; id is not a posts or comments filter. /v1/subreddits accepts prefix and limit for community discovery, without guaranteeing globally exact aggregation counts.

Search parameters are q, subreddit, author, kind, from, to, min_score, limit and page. kind accepts post or comment. Dates use YYYY-MM-DD in UTC and to includes the specified day. min_score sets a numeric threshold and does not sort. No arbitrary query DSL, server-side sentiment analysis, posting, voting or private messaging is provided by this independent historical service.

Pagination is controlled by limit and page parameters, both bounded between 1 and 100. The archive returns up to 100 records per request, ensuring manageable data payloads. Use page to iterate through results sequentially. Remember that iterating through pages does not guarantee full coverage or exhaustive export, as the archive structure may have gaps or ordering variations.

For the soil example, q=soil and subreddit=gardening restrict the search while limit=3 requests at most three records. Compare another community through a separate query, recording any changed parameter. The API returns flat records. Local grouping is possible when parent_id or link_id is present, but neither field is an exposed filter and a complete conversation tree is not guaranteed.

Pagination and interpretation

Pagination totals indicate the number of results but carry specific semantic relations. An exact total means the count is precise, while a greater-than-or-equal bound indicates a lower limit. An unknown total suggests the system cannot reliably determine the full count. These distinctions are vital for understanding the completeness of your query results without assuming exhaustive coverage.

Read relation with total: eq denotes an exact query total, gte a lower bound and unknown no reliable total, which may be null. Results use internal document order _doc, not chronological, relevance or score sorting. One request fetches one page of at most 100 records, with page limited to 1 through 100. Reaching the last permitted page does not establish exhaustive collection.

Preserve the actual responses, query parameters and retrieval time locally. These artifacts help you explain a selection or repeat its local processing. Repeating the remote query does not guarantee identical records. /v1/status is public and uncharged; it returns static historical-scope information and shows that the HTTP app responds. It does not probe the search backend, archive completeness, capacity or retrieval latency.

Keeping and replacing your key

API key

Your API key is stored encrypted and is available after sign-in. Keep it private.

Keep the key on your server. Regeneration immediately disables the previous key. Your credits and account remain available.

Recovering account access

Save this one-time code privately. You need your email and this code to reset a forgotten password. A new code replaces the previous one.

Continue with Google

An existing account can be linked when Google establishes authoritative ownership of the email. Other email addresses require confirmation with the existing account password.

Request records and local copies

Request activity · last 30 days

Detailed request records, including client IP and user agent, are kept for 30 days.

Summaries cover the selected period. IP, response and latency details are available only for logged requests and expire after 30 days. Older records may lack these fields.

Requests

The export contains the currently displayed page and filters. Times use your browser timezone; chart days use UTC.

Reddit Data API is an independent historical archive service, not an official Reddit product or a live mirror. Availability of a record, time range or optional field is not guaranteed. Record the scope and retrieval time of your own batch, review the terms and privacy information, and avoid presenting a bounded archive sample as all activity on Reddit. The account exposes request costs, statuses and available client details; older requests may lack IP or latency fields.

Request costs you can account for

$1 / 1,000

A successful retrieval costs one credit, including an empty result: $1 per 1,000 successes. Eligible new accounts receive $5 = 5,000 credits once across the network. The minimum paid top-up is $50 = 50,000 credits. Invalid requests are not charged; upstream failures refund the reservation, sometimes after reconciliation. A successful retry is a new paid retrieval, so rerun local transformations from saved inputs first.

$5 / 5,000

Welcome credit: $5 · 5,000 credits

$50 / 50,000

Create an invoice before sending. Send exactly the displayed amount using the displayed token and network. Credit is added only after blockchain confirmation.

Conceptual illustration, not a screenshot or measured result.

Continue with the related reference