Reddit Gateway · GET · JSON
Follow one database search across the access boundary

Questions about this page
Why can status succeed while a search fails?
Imagine an internal analyst opens your console, sees that /v1/status responded and requests archived database discussions.
Which decisions belong on my backend?
Define a narrow operation such as searching the backend community.
How do I build only the supported read request?
For the allowed case, construct GET https://api.redditgateway.com/v1/search?q=database&subreddit=backend&limit=3 on the server.
How can I separate retrieval from local processing?
Consider using a message queue system to decouple data fetching from data processing.
How do I decide whether a failed request may be retried?
Now suppose the socket closes before your handler saves a response.
What is Reddit Gateway?
Reddit Gateway 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 Gateway 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.
Incident: status responds, but a colleague cannot search
Imagine an internal analyst opens your console, sees that /v1/status responded and requests archived database discussions. That public response grants no right to spend the account's credits. First identify the caller and the operation in your own application. If your policy refuses the request, show that local decision without calling the archive or describing it as an archive failure.
Begin with two separate decisions: whether an internal caller may request data, and whether your server may spend a credit on that caller's behalf. Reddit Gateway authenticates the archive account through a key. That key does not encode your application's users, roles or project budgets. Define those controls in your own backend before calling a protected retrieval route.
Authorize the action before attaching the key
Define a narrow operation such as searching the backend community. Your handler can keep the host and route fixed, accept only permitted fields and set a small page limit before attaching the secret. A caller who can view a status indicator need not be allowed to start this operation. These are controls you implement; Reddit Gateway does not issue per-employee permissions through its account key.
Do not send Reddit OAuth tokens, consent scopes or session cookies to this service. Retrieval accepts X-API-Key: <key> or Authorization: Bearer <key>; Bearer carries this archive's key. The account panel's Secure HttpOnly session is separate. A public GET /v1/status needs neither credential nor credit, and tells you only that the HTTP application responded with its static scope disclosure.
Construct the permitted request
For the allowed case, construct GET https://api.redditgateway.com/v1/search?q=database&subreddit=backend&limit=3 on the server. Keep the local operation identifier with the parameters, but exclude authentication headers from logs. q searches title and text; multiple terms use operator and within a matching field. Do not treat terms split across fields as a guaranteed match or claim that the first three records are the best answers.
Validate data as an array before mapping flat records. Missing parent_id or link_id remains missing; present references can support local grouping without a complete conversation. Preserve raw responses before downstream processing. A local mapping or storage failure after remote success does not refund the retrieval. Separate your application's processing outcome from the archive's HTTP and billing outcome.
Keep returned data separate from local processing
Consider using a message queue system to decouple data fetching from data processing. Your own backend can centralize rate limits and quota accounting for internal services and background jobs. Queue work, cap concurrent requests and set a retry budget that includes successful repeats. These choices can organize demand; they do not create an SLA or guarantee upstream availability. A locally rejected operation should stop before the archive request if your policy denies spending.
Use documented filters only: q, subreddit, author, kind, from, to, min_score, limit and page on content searches. kind is post or comment, dates are YYYY-MM-DD in UTC with the whole final to day included, and min_score filters without sorting. _doc is internal order, not chronology or relevance. /v1/item requires id; /v1/subreddits accepts prefix and limit, without live community monitoring.
Each page returns up to 100 records and page cannot exceed 100. Interpret eq as an exact query count, gte as a lower bound and unknown as unreliable or null. None proves complete ingestion. Narrowing intervals or deduplicating locally does not prove exhaustive retrieval. Your controls should retain these limitations with the received dataset, rather than presenting a completed queue as a complete Reddit archive.
Make the ambiguous timeout a deliberate decision
Now suppose the socket closes before your handler saves a response. Mark the outcome as unknown locally, rather than failed and free. The server may already have completed a charged retrieval; another successful attempt costs another credit. Check whether your application retained the response, apply your own retry budget, and preserve the distinction between upstream reservation refunds and a lost client response.
Handle 400, 401, 402 and 429 according to their causes. Invalid requests do not debit and upstream failures refund reservations, but a lost response may conceal a charged success. Every successful retry costs another credit. Consult pricing and the key page before funding work: $1 per 1000 successful requests and a $50 minimum paid top-up. Password-confirmed regeneration immediately invalidates the old key, so coordinate your own configuration update.
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.redditgateway.com/v1/search' \
-H "Authorization: Bearer ${REDDIT_API_KEY}" \
--data-urlencode 'q=database' \
--data-urlencode 'subreddit=backend' \
--data-urlencode 'limit=3'Python
import json
import os
from urllib.parse import urlencode
from urllib.request import Request, urlopen
params = urlencode({"q":"database","subreddit":"backend","limit":"3"})
request = Request(
"https://api.redditgateway.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":"database","subreddit":"backend","limit":"3"});
const response = await fetch(
"https://api.redditgateway.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.
| Method | API | Use |
|---|---|---|
GET | /v1/search | Search posts and comments |
GET | /v1/posts | Posts only |
GET | /v1/comments | Comments only |
GET | /v1/item | One known record id |
GET | /v1/subreddits | Community names by prefix |
GET | /v1/status | Service 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.
| Parameter | Meaning |
|---|---|
q | Text in title and text |
subreddit | Exact community spelling |
author | Exact author value |
kind | post or comment |
from / to | YYYY-MM-DD, UTC; end day included |
min_score | Minimum score, not sorting |
limit / page | Both range from 1 to 100 |
prefix / id | Route-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.
| Parameter | Meaning |
|---|---|
id | Keep the source identifier |
kind | Inspect the record kind |
subreddit | Preserve the returned community name |
title / text | Treat missing, null and empty separately |
created_utc / score | Check numeric values before conversion |
parent_id / link_id | Optional links; group locally if present |
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 access control
Protected retrieval uses GET under https://api.redditgateway.com with X-API-Key: <key> or Authorization: Bearer <key>. Either header is valid. Authentication relies on API keys rather than Reddit OAuth. Store the key in protected server configuration, such as an environment variable or secret manager, and keep it out of frontend bundles and diagnostic logs. The account panel's Secure HttpOnly session cookie is separate from retrieval authentication.
/v1/status is the public exception: no key is required and no credit is charged. It returns a static service-scope disclosure and establishes only that the HTTP application responds. It does not test the search backend, inspect record availability or show balance. Keep this observation separate from your own measurements of authenticated requests; never infer search readiness from a status response.
HTTP 400 means invalid parameters, 401 a missing or invalid key, 402 insufficient credits and 429 a request-frequency limit. Handle each cause separately. Inspect configuration after 401, pause paid work after 402 and bound delayed retries after 429. A successful empty retrieval is not an authentication error. Do not repeatedly rotate keys merely because a search has no matches.
Core routes and filtering logic
/v1/search searches posts and comments. /v1/posts and /v1/comments additionally constrain the record kind. They accept q, subreddit, author, kind, from, to, min_score, limit and page, but not id. kind accepts the literal values post or comment; omit it to search both kinds through search. q performs text search, without arbitrary query DSL, sentiment classification or server-side custom analytics.
/v1/item?id=... requires id and looks for one record. It does not walk replies or ancestors. /v1/subreddits accepts only prefix and limit for community-name discovery; prefix is not a content-route filter. Aggregation counts are not guaranteed globally exact. None of these routes accepts an arbitrary Reddit URL to crawl or forwards Reddit OAuth permissions.
from and to require YYYY-MM-DD dates in UTC and filter created_utc, not archive ingestion time. The final day to is fully inclusive. min_score is a numeric score threshold, not a quality classifier or ordering option. Responses contain data, pagination and credits. Document fields can vary; preserve missing text and unresolved references instead of manufacturing values required by a downstream schema.
Pagination totals and archive behavior
limit and page range from 1 to 100, with one page per request. Internal _doc order does not mean insertion time, chronology, relevance or score order. Local sorting only reorders received records. Smaller date windows can organize work but cannot establish full coverage or unique results. The archive does not guarantee fixed coverage dates, repeat-query stability, immutability or permanent availability.
Read pagination.total with pagination.relation: eq means an exact query total, gte a lower bound and unknown no reliable total, possibly null. An exact count does not establish that all matches were downloaded or that Reddit history is fully represented. Preserve has_more and window_exhausted as returned boundary signals. Flat records with present parent_id or link_id can be grouped locally; neither field is a query filter or a completeness guarantee.
A successful retrieval costs one credit, including an empty response. Invalid requests do not debit; upstream failures return reservations. A client timeout or disconnected socket may happen after a billable success. A successful retry is charged again, and failure in your own database does not turn the remote success into a refund. Persist a received response before advancing local progress.
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.