Reddit Fetch
EN

Reddit Fetch · GET · JSON

Follow a comment request past await fetch

Conceptual illustration, not a screenshot or measured result.

Questions about this page

Which decisions belong on my backend?

This recipe builds a small historical preview, not a conversation browser.

How is an HTTP response different from a fetch exception?

A network rejection reaches the catch around await fetch; it gives your application no usable HTTP response to classify.

What should I validate before reading individual items?

On the success path, await response.json() can itself fail.

How can the interface show an incomplete fragment honestly?

Map only the fields your preview uses.

When is another page worth requesting?

Save a validated result before advancing local progress, and associate it with the request parameters.

What is Reddit Fetch?

Reddit Fetch 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 Reddit Fetch 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 the boundary before the call

This recipe builds a small historical preview, not a conversation browser. Keep the archive call inside a Node.js backend with fetch available. Read process.env.REDDIT_FETCH_API_KEY there and reject missing configuration before contacting the service. Your application should return selected display data to its users, never the secret that authorized the archive request.

Use the fixed URL https://api.redditfetch.com/v1/comments?subreddit=javascript&limit=3 and a header such as {'X-API-Key': key}. Authorization: Bearer <key> is equally valid. Keep user-provided URLs out of this credential-bearing operation. Any access rules or limits on your own public endpoint are your application’s responsibility, including deciding when a visitor may request a refresh.

A response and an exception mean different things

A network rejection reaches the catch around await fetch; it gives your application no usable HTTP response to classify. By contrast, an HTTP 401 or 402 can arrive through a fulfilled promise. First inspect response.ok. Branch on non-success status before treating any returned body as a successful page of comments.

HTTP 400 calls for correcting parameters, 401 for checking the credential, and 402 for checking credits. For 429, use a bounded delayed retry policy if appropriate. Avoid an automatic loop around every failure. A lost connection may follow billable server success, so a network exception does not establish that the request cost nothing.

Decode JSON, then check what it means

On the success path, await response.json() can itself fail. Keep that decoding failure distinguishable from a transport failure in your internal diagnostics. Then check the expected envelope and that data is an array before reading records. Parsed JSON is a JavaScript value, not proof that every field required by your display exists or has the right type.

Turn fragments into honest display states

Map only the fields your preview uses. Distinguish absent text from an empty string, retain available identifiers for local traceability, and render comment content as text. Returned records are flat fragments. Optional relationship fields do not establish a complete thread, and this three-record request cannot tell you that all replies to a comment have been collected.

Define loading, ready, empty and failed states locally. An empty data array after a successful check means this request supplied no records. If all received records fail your display checks, report that separately in diagnostics instead of silently calling the source empty. A previously saved preview can remain visible with a clear label while a refresh fails.

Choose when the next call is worth making

Save a validated result before advancing local progress, and associate it with the request parameters. Local reuse needs no new retrieval; each successful refresh costs one credit, including an empty response. Archive document order is not chronological ranking. Even later pagination, limited to 100 records per request and 100 pages per query, cannot establish exhaustive coverage.

Use the documentation for response fields and pagination meanings, pricing for credit arithmetic, and the key page for account configuration. /v1/status is a public, uncharged static disclosure; it does not test archive availability. Keep the preview’s historical source visible and avoid promising live updates, stable future results or a complete discussion from these fragments.

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.redditfetch.com/v1/comments' \
  -H "Authorization: Bearer ${REDDIT_API_KEY}" \
  --data-urlencode 'subreddit=javascript' \
  --data-urlencode 'limit=3'

Python

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

params = urlencode({"subreddit":"javascript","limit":"3"})
request = Request(
    "https://api.redditfetch.com/v1/comments?" + 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({"subreddit":"javascript","limit":"3"});
const response = await fetch(
  "https://api.redditfetch.com/v1/comments?" + 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

Authenticate and choose a documented route

Use GET at https://api.redditfetch.com with X-API-Key: <key> or Authorization: Bearer <key>. Both header formats are supported. Your application should supply the actual key from its backend configuration rather than expose it in browser code. The Secure HttpOnly cookie used by the website account panel is separate from these headers; signing in to the site does not authenticate your application’s retrieval request.

/v1/search searches archived posts and comments; /v1/posts and /v1/comments restrict retrieval to their corresponding types. All three accept q, subreddit, author, kind, from, to, min_score, limit and page. kind uses the literal values post and comment, while a type-specific route already constrains its own type. These routes do not accept id, an arbitrary upstream URL or a custom query language.

/v1/item requires id and accepts no other query filters. It looks up one item rather than recursively obtaining an entire thread. /v1/subreddits accepts only prefix and limit for community-name lookup; its aggregation counts are not guaranteed globally exact. Public /v1/status requires neither a key nor credits and returns static service-scope information rather than account details or a search-health result.

Validate records, dates and page metadata

q provides text search, not sentiment analysis or a classification of useful JavaScript answers. subreddit and author narrow matches to the specified community or author. from and to require YYYY-MM-DD dates in UTC and apply to created_utc, not ingestion time. The entire to day is included. Intraday processing belongs in your local code using record timestamps when available.

min_score applies a numeric score threshold without changing order. Results use internal archive document order _doc, not document-ID order, ingestion chronology, publication time, relevance or score rank. limit and page range from 1 to 100. Each request retrieves one page of at most 100 records; one query allows at most 100 pages. Dividing periods can organize work but cannot prove exhaustive or duplicate-free retrieval.

A successful retrieval contains data, pagination and credits. Check data as an array before processing its flat records. Fields can vary or be absent. If parent_id or link_id appears, local grouping is optional; those fields are not search filters and do not guarantee complete ancestry. A client-side mapping should preserve missing context instead of manufacturing a parent or assuming a complete conversation.

Read pagination.total alongside pagination.relation: eq reports an exact query total, gte a lower bound, and unknown no reliable total, possibly null. Unknown is not zero. Even an exact total does not prove every match was downloaded or every historical comment is archived. Preserve returned page indicators with your collected evidence rather than inventing cursor tokens that this API does not provide.

Separate errors, success and accounting

The status endpoint returns a static disclosure proving the HTTP server responds, but it does not check search backend health or record availability. It is public and uncharged. Use it to confirm basic server responsiveness, but inspect your actual account interface for balance details and invoice verification. The status route does not report upstream load conditions or data coverage completeness for your queries.

HTTP 400 means invalid parameters, 401 missing or invalid authentication, 402 insufficient credits and 429 rate limiting. Correct the cause of 400, 401 or 402 rather than repeatedly issuing the same request. Delayed, bounded retries can be appropriate for 429. The network-wide trial eligibility rules are separate from request-rate limits; do not infer trial status from a rate-limit response. Invalid requests do not debit credits; upstream failures refund reserved credits. One successful retrieval, even empty, costs one credit. A client timeout or lost connection can follow billable server success, so a successful repeat costs another credit. Store validated responses before advancing local progress, and keep your own application’s errors separate from the archive’s HTTP outcome.

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