Reddit API Stack
EN

REDDIT API STACK · JSON · REST

One Reddit API contract for Python and JavaScript

Take one asyncio search from a Python script to a server-side JavaScript client, then build an application adapter with explicit loading, empty and error states.

  • GET
  • JSON
  • HTTPS
  • UTC
Conceptual illustration, not a screenshot or measured result.

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 --get --fail-with-body 'https://api.redditapistack.com/v1/search' \
  -H "Authorization: Bearer ${REDDIT_API_KEY}" \
  --data-urlencode 'q=asyncio' \
  --data-urlencode 'subreddit=learnpython' \
  --data-urlencode 'limit=3'

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
  }
}

Start with a request you can compare

Build the same small archive reader in Python and server-side JavaScript before adding it to your application. Use https://api.redditapistack.com/v1/search?q=asyncio&subreddit=learnpython&limit=3 for both clients. The task is concrete: retrieve up to three matching historical records, inspect the returned data and decide how your screen should present it. You can review each client against the same request definition instead of debugging language choices and query changes at once.

The useful outcome is a working path from configuration to an HTTP response to an application state. A Python script can establish that path during a prototype; a JavaScript server can place it behind an existing web interface. Neither language is a required SDK. Reddit API Stack supplies an independent historical archive API, not a live or official Reddit service.

Conceptual illustration, not a screenshot or measured result.

Choose the boundary that fits your stack

02 / 05

Keep the real key in your server environment. In Python, the request can read REDDIT_API_KEY from the environment and pass it to requests.get. In a JavaScript server, fetch can read the same configuration name. A visitor’s browser calls your own application route, not code containing your archive key. This keeps the credential boundary explicit when the prototype becomes a shared tool.

Conceptual illustration, not a screenshot or measured result.

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

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.

UseResponse
Available historical recordsSupported read-only routes
Live feed and new activityNot provided
Publishing, editing and votingNot provided
Complete conversation treesNot provided; optional local grouping

Request costs you can account for

$5

Eligible new accounts, once across the network

$1

Per 1,000 successful requests, including empty results

$50

Minimum top-up for 50,000 credits

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.

Conceptual illustration, not a screenshot or measured result.

About the service and its limits

Reddit API Stack 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.

Continue with the reference and implementation guide

Questions before your first request

What is Reddit API Stack?

Reddit API Stack 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 API Stack 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.

What should I freeze before switching programming languages?

Use https://api.redditapistack.com/v1/search?q=asyncio&subreddit=learnpython&limit=3 as the first request in both clients. Keep the host, route and parameters together in a small request definition. Begin with one page. Changing the search while porting the client makes it harder to tell whether different results came from code or from different conditions.

What should the final handover explain?

The handover should show the shared request definition, a redacted sample, the adapter’s states, the request budget and how to replace the secret. Successful retrievals, including empty ones, cost one credit; $50 adds 50000 paid credits at $1 per 1000 requests. Use the key and pricing pages for account and payment steps. /v1/status is uncharged but only reports static scope and HTTP responsiveness, so it cannot replace a feature-level check.

Which filters can I use to search Reddit records?

Use q for analyzed text search and combine it with subreddit, author, kind, from, to or min_score. Multiple search words use AND semantics; this is not a semantic-search or arbitrary-query-DSL endpoint. Dates use YYYY-MM-DD in UTC, with the to date including the whole day. Start with documented parameters in the reference.

Does Reddit API Stack provide live Reddit access?

No. This service reads a historical archive, not a live Reddit feed. It cannot publish posts, vote, send private messages or perform Reddit OAuth actions. The public /v1/status route describes the service scope; it does not prove archive health, complete coverage or current availability of an original Reddit page.

Can I export every record that matches a search?

Not necessarily. A request returns up to 100 records, and page ranges from 1 to 100. Read total together with pagination.relation: exact, lower bound or unknown. Results follow archive order rather than guaranteed chronological or relevance order. Reaching the last accessible page does not prove that a saved sample is exhaustive.

Can I reuse the same key on another domain?

No. Accounts, API keys and credit balances are separated by site. Use the key issued for this domain with its own HTTPS API hostname. Keep that key in server-side configuration, not in browser JavaScript, public repositories or shared logs. A key from another site is not a substitute for a local account. Google sign-in is shared across the network; API keys and balances remain separate for each site.

Which request should I try first?

Start with /v1/search, q=python, subreddit=learnpython, limit=3 and page=1. This small request lets you inspect available fields before writing import or interface logic. It still costs one credit when successful, including an empty result. Adjust the topic and community for your task; the example is not a promise of a fixed record count.

How do I start the Python prototype?

For a Python environment with requests installed, the core call is: import os, requests; response = requests.get("https://api.redditapistack.com/v1/search?q=asyncio&subreddit=learnpython&limit=3", headers={"X-API-Key": os.environ["REDDIT_API_KEY"]}, timeout=15); response.raise_for_status(); data = response.json()["data"]. This sends the configured secret in a header and checks HTTP success before consuming the data array. The timeout is a client choice, not a service response-time promise.

How do I run the same request in server-side JavaScript?

In a JavaScript server module supporting fetch and top-level await, the corresponding call is: const response = await fetch("https://api.redditapistack.com/v1/search?q=asyncio&subreddit=learnpython&limit=3", {headers: {"X-API-Key": process.env.REDDIT_API_KEY}}); if (!response.ok) throw new Error("HTTP " + response.status); const {data} = await response.json(); Validate that the configured key is present before calling. Add your own cancellation policy rather than leaving request duration implicit.

What must stay the same for a fair comparison?

Replay one retained response through each local adapter, without another archive call. Check a populated data array, an empty array and an absent optional field. These cases can be local test fixtures; label synthetic fixtures as synthetic. Compare the states your own code produces, not the equality of two separate live searches. Those may see different available archive material.

Which HTTP outcomes need a correction rather than more data?

Centralize request construction, credential loading, HTTP classification and JSON validation. Handle 400 as a parameter problem, 401 as a credential problem, 402 as insufficient balance and 429 as a rate limit. Do not send an endless retry loop from a component. A lost response can still represent a successful charged request, and each successful retry uses another credit.

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.

Use the prototype to answer three practical questions

03 / 05

Can each client send the intended request? Keep q=asyncio, subreddit=learnpython and limit=3 unchanged while checking the URL and HTTP outcome. Redact credentials from diagnostics. A changed query is a different experiment, even if the screen looks similar.

Can your adapter distinguish a successful empty data array from a request failure? Give those states different messages before you spend time on visual polish. “No matching records returned” and “Could not load records” lead a user to different next actions.

Can the view cope with missing context? Render available text without inventing an absent parent. The response is flat, so a link between records is useful when present but does not make a complete conversation. Decide what the interface shows when a field is absent.

Move the reader behind an application route

04 / 05

Once the single request works, collect configuration, HTTP handling and response validation in a small server-side adapter. Have that adapter return a stable result to your own view: records, an empty state or an error category. The implementation is yours; the API does not supply this application layer. The benefit is a place to change handling without scattering archive calls across components.

Before adding pagination, set a request budget and an explicit stop condition. A successful retrieval uses one credit even if empty; a successful retry after a lost response can use another. The API permits up to 100 records per request and 100 pages per query, but iteration is not a complete-export guarantee. Begin with one page and expand only when the interface needs it.

Questions before the first integration run

05 / 05

Do the clients have to return identical records? Use a saved response to compare their handling of identical input. Separate live requests can encounter different available material, so equality of two live responses is not the definition of a correct port.

Do I need to pay before I can save a key? The key appears once at signup before payment. An optional 5,000-credit trial depends on network-wide anti-abuse eligibility. The key and balance belong to this domain; the key page handles the account and pricing explains funding.

What should I have at the end? Two clients with the same request definition, a retained sample without secrets, and an interface that handles success, empty results and failure. That is a reviewable integration prototype, rather than a promise about archive coverage or the current state of Reddit.