Reddit API Labs
EN

REDDIT API LABS · JSON · REST

Reddit archive queries for documented experiments

Explore replication in r/science through a documented archive pilot. Separate the search rule, the records received and your interpretation.

  • 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.redditapilabs.com/v1/search' \
  -H "Authorization: Bearer ${REDDIT_API_KEY}" \
  --data-urlencode 'q=replication' \
  --data-urlencode 'subreddit=science' \
  --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
  }
}

A word match is the start of the experiment

For research engineers studying discussion of scientific replication, the first decision is linguistic: does a record concern repeating a study, DNA replication, or something unclear? Reddit API Labs reads an independent historical Reddit archive, without official affiliation or live updates. It supplies material for that decision; it does not make the scientific classification. Start the notebook with the question you can answer from the records actually received.

Give each collection attempt a local run identifier and record the route, filters, page size, page number and retrieval time in your own notes. The identifier is yours, not an archive-issued snapshot token. Keep the actual response separately from cleaned text, exclusions and annotations. A list of parameters describes an attempted selection; it cannot substitute for the received records when explaining the input to an analysis.

A corpus-linguistics study needs a definition of the language it will compare, not merely an API connection. Specify the communities, the textual unit and the reason a passage enters the corpus. Keep an author’s wording separate from the interpretation your research team assigns to it; API retrieval does not validate that interpretation.

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

The first page is a pilot specimen

02 / 03

Use GET https://api.redditapilabs.com/v1/search?q=replication&subreddit=science&limit=3. q=replication supplies a text search, subreddit=science restricts the community and limit=3 requests at most three records. It does not identify scientifically valid studies or run a replication test. Without kind, search can return posts and comments; the default page is one. Authenticate server-side with X-API-Key: <key> or Authorization: Bearer <key>; both accept this domain's archive key.

q searches title and text. With several terms, operator and requires the terms within a matching field; distributing them between title and text does not necessarily match. Changing replication to replication crisis changes the selection. Record that change as a separate pilot, rather than treating the narrower wording as proof that irrelevant meanings have disappeared.

Synthetic response excerpt for demonstration only: {"data":[],"pagination":{"page":1,"limit":3,"total":0,"relation":"eq"},"credits":{"cost":1,"balance":99}}. No real request produced this example and the balance is fictional. An empty first page can have an exact query total of zero and still costs one credit. It does not prove that replication was never discussed in science or that the archive contains all relevant records.

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.

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 Labs 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 Labs?

Reddit API Labs 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 Labs 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 my annotation rule decide?

Write the initial question as a decision you can inspect: among the received r/science records matching replication, which discuss repeating a study? Define the observation as a record and choose post, comment or both deliberately. The search selects candidate text; your local reading determines the category. Do not present a word match as evidence that an experiment was successfully replicated.

How should I budget additional requests?

Each successful retrieval, including empty or repeated responses, costs one credit: $1 per 1000 requests. Invalid requests do not debit; upstream failures refund reservations. A client timeout can conceal a charged success, and another successful attempt costs another credit. A failed local transformation does not reverse that charge. Record remote attempts separately from successful local processing and keep secrets out of research logs. Continue locally if the next task is to annotate the saved text. Open the guide to write inclusion decisions; use the documentation to check parameters. If another retrieval is necessary, the key page handles access and the pricing page explains credits. Neither more calls nor a longer notebook turns an incomplete archive selection into a representative population.

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 Labs 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=machine learning, subreddit=learnmachinelearning, 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.

Which request starts this worked example?

Start with https://api.redditapilabs.com/v1/search?q=replication&subreddit=science&limit=3, the homepage example. q performs text search, subreddit restricts the community and limit caps the page at three records. Send X-API-Key: <key> or Authorization: Bearer <key> from your server. The key page explains signup before payment; never include a live key in the protocol you share.

How do I keep my annotations separate from the source?

Create a local annotation table with the record identifier when available, a category and a reason. Useful provisional categories are study replication, biological replication and unclear context. They are your labels, not API fields. Preserve ambiguous records for review instead of forcing a category, and keep the original text beside the version used for analysis.

What must stay the same for a fair comparison?

First rerun your analysis on the saved input with the recorded code and environment, checking your own exclusions and outputs. A matching file hash only confirms that the compared bytes match. It does not verify the truth of a post, the quality of your interpretation or reproducibility of every computational step. Describe the checks you actually performed instead of announcing that the archive certifies the experiment.

What should the final handover explain?

End with a short run note: requested parameters, pages received, records retained, exclusions and unresolved meanings. State why collection stopped and which version of the coding rule produced the counts. Restrict conclusions to this material; an unknown total, missing context or an archive gap must not become a claim about silence in the community.

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.

Keep a record of what entered the analysis

03 / 03

Save your actual response before transforming fields and note whether collection succeeded, failed or had an uncertain outcome. Flat records may omit fields; present parent_id and link_id allow local grouping without guaranteed complete conversations. Keep missing values distinct from zero or empty text. Your protocol should describe the transformations your code performs, rather than attribute local cleaning, sentiment classification or statistical testing to the API.

Reprocessing saved responses locally and collecting them again remotely are different experiments. The first uses the copy you retained with your code and dependencies; the second is a new archive request with no guaranteed equality, similarity or bound on differences. Neither a matching local file hash nor a detailed notebook proves full coverage or representative sampling. They help identify the particular material and decisions behind your own result.

Set a stopping rule before enlarging the pilot: for example, inspect one page, revise the coding rule, then decide whether collection is justified. Retrieval permits at most 100 records per request and 100 pages per query. _doc order is neither chronological, relevance nor score order; the first three records are not the most important three.