Reddit API in JavaScript

One bearer token, the built-in fetch, and six examples that run against endpoints this API actually serves. No package to install for a plain client, and nothing to register with Reddit.

Is there a JavaScript SDK for the Reddit API?

Redditapis publishes one npm package, redditapis-mcp, and it is a Model Context Protocol server for AI agent tools, not a general-purpose JavaScript client. There is no separate JS/TS SDK. The API is plain REST over HTTPS with one bearer token, so a script or a server route calls it with the built-in fetch. Reads cost $0.002 per call and every account starts with $0.50 in free credits.

What we ship, stated plainly

One real npm package exists. It is not what this page is sometimes searched for, so here is the whole inventory.

redditapis-mcp exists, and it is an MCP server

Published on npm. It wraps the read endpoints plus monitor and webhook management as tools for Claude, Cursor and other MCP clients, not as a JS import for your own app.

No general-purpose JS/TS client

There is no separate npm package that wraps fetch for you. The examples on this page are the supported way in from JavaScript and TypeScript.

A stable REST surface

52 endpoints behind one bearer token, with a published OpenAPI document you can point a generator at for typed responses.

Six calls, start to finish

Each block continues from the redditApi helper defined in the first call, written for Node 18+ and any modern browser. Field names are the ones the endpoints return, not a generic shape.

No package to install
// No package to install for a plain script. fetch is global in Node 18+
// and in every browser, so there is zero dependency for the calls below.
export REDDITAPIS_KEY="rk_live_your_key_here"

fetch ships in Node 18+ and every browser. Nothing here registers a Reddit developer app or exchanges an OAuth token.

First call: a subreddit listing
const BASE_URL = "https://api.redditapis.com";

async function redditApi(path, params = {}) {
  const url = new URL(BASE_URL + path);
  for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.REDDITAPIS_KEY}` },
  });
  if (!res.ok) {
    const body = await res.json().catch(() => ({}));
    throw Object.assign(new Error(body.error || res.statusText), { status: res.status });
  }
  return res.json();
}

const { posts } = await redditApi("/api/reddit/posts", {
  subreddit: "webdev",
  sort: "top",
  t: "week",
  limit: 25,
});
for (const post of posts) console.log(post.upvotes, post.title, post.permalink);

GET /api/reddit/posts returns up to 100 posts for one $0.002 read. The unit is the call, not the row.

Read a subreddit comment stream
// The new-comment stream for one subreddit, the read a keyword monitor polls.
const { comments } = await redditApi("/api/reddit/sub/devops/comments", { limit: 100 });

for (const c of comments) {
  if (c.body.toLowerCase().includes("kubernetes")) {
    console.log(c.author, c.subreddit, c.upvotes, c.url);
  }
}

Comment rows carry body, author, subreddit and upvotes. This is the endpoint a keyword watcher polls.

Errors and retries
// 402 and 403 are terminal: no retry buys credits or fixes a bad key.
// 429 and 503 are transient and safe to retry.
const TERMINAL = new Set([400, 401, 402, 403, 404]);
const RETRYABLE = new Set([429, 500, 502, 503, 504]);

async function callWithRetry(path, params, attempts = 4) {
  let delay = 1000;
  for (let i = 0; i < attempts; i++) {
    const url = new URL(BASE_URL + path);
    for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);
    const res = await fetch(url, {
      headers: { Authorization: `Bearer ${process.env.REDDITAPIS_KEY}` },
    });
    if (res.ok) return res.json();
    const body = await res.json().catch(() => ({}));
    if (TERMINAL.has(res.status) || !RETRYABLE.has(res.status)) {
      throw Object.assign(new Error(body.error || res.statusText), { status: res.status });
    }
    // The 429 carries Retry-After in seconds. Honour it before backing off.
    const retryAfter = Number(res.headers.get("Retry-After")) || delay / 1000;
    await new Promise((r) => setTimeout(r, retryAfter * 1000));
    delay *= 2;
  }
  throw new Error(`gave up after ${attempts} attempts`);
}

Split terminal from transient before you write a retry loop. Retrying a 402 just burns wall-clock.

Watch the balance
// GET /account/me is free and never consumes credits. Poll it from a
// scheduled job so a long run never dies halfway through on an empty balance.
const account = await redditApi("/account/me");
console.log(account.credits_remaining, "left");
console.log(account.credits_used, "spent over", account.total_requests, "requests");

// Every billed response also carries the balance in a header, so a worker
// can watch it without a second request.
const res = await fetch(new URL(BASE_URL + "/api/reddit/posts?subreddit=node&limit=5"), {
  headers: { Authorization: `Bearer ${process.env.REDDITAPIS_KEY}` },
});
console.log(res.headers.get("X-Credits-Remaining"));

The account endpoint is free. The header rides along on calls you were making anyway.

Every status code you will see

Errors come back as JSON with a single error key. The body text below is what the API sends, not a paraphrase.

StatusResponse bodyWhat it meansRetry
400{"error": "q is required"}A required parameter is missing, or sort, t or a numeric filter carries a value the endpoint does not accept. The message names the field and lists the allowed values.No. Fix the request.
401{"error": "Missing Bearer token"}No Authorization header, or the header did not start with Bearer.No.
402{"error": "Insufficient credits"}The key is valid but the balance does not cover this call.No. Top up first.
403{"error": "Invalid token"}The key was not recognised.No.
503{"error": "upstream_unavailable"}The request could not be completed and never reached Reddit. Returned instead of a 404 so a temporary problem on our side is never reported as your content being missing.Yes, with backoff. Not billed.
429{"error": "rate_limited"}Sent with a Retry-After header. On this API the enforced burst limiter counts requests that match no route, so a 429 usually means a client is hammering a URL that does not exist.Yes, after Retry-After seconds. Not billed.

Limits and what a call costs

There is no queries-per-minute gate on the data endpoints. What bounds a Node job is the credit balance, so the useful habit is watching that rather than counting requests.

TierPer callWhat is in it
Reads$0.00252 endpoints total, most of them reads. One call returns up to 100 rows.
Deep comment search$0.02GET /api/reddit/search/comments/deep, the one read that fans out into many upstream reads.
Votes$0.005POST /api/reddit/vote.
Writes$0.012Comments, login and the profile endpoints.
Direct messages$0.025Sending a DM and reading threads or messages.
Account readsFreeGET /account/me and GET /account/payments never consume credits.

Reddit throttling is handled server side

Proxy rotation, upstream retries and per-account cooldowns run on our side. A Node script deals with HTTP status codes, not a shared quota.

The 429 you can actually trigger

The enforced burst limiter counts requests that match no route, 60 per minute per key. It returns Retry-After and is not billed, so a URL typo in a loop costs nothing.

Never ship the key to the browser

The API is CORS-reachable, but a key embedded in client-side JS is readable in devtools. Call it from a server route or an edge function.

If you want managed keyword alerts instead of your own polling loop, the monitoring endpoints deliver webhooks on a fixed cadence. Post-level monitors are available from the Starter plan; comment-level monitors start at Growth. Full rates are on the pricing page and the Python version of this guide is at Reddit API in Python.

By the numbers

JavaScript access to Reddit data, by the numbers

Every Redditapis figure resolves to our published per-call rates; every external figure is a primary source.

  • Redditapis bills reads at $0.002 per call, deep comment search at $0.02, votes at $0.005, writes at $0.012, and DMs at $0.025, with no minimum spend. (Redditapis pricing, 2026)

  • Every new account starts with $0.50 in free credits and no card on file, roughly 250 reads before any charge. (Redditapis, 2026)

  • redditapis-mcp is the one Redditapis package published on npm, and it ships as a Model Context Protocol server, not a JavaScript client library. (npm, 2026)

  • Reddit's free Data API tier is capped at 100 queries per minute per OAuth client, and 10 queries per minute without OAuth. (Reddit Data API Wiki, 2026)

  • Reddit's own commercial Data API is priced at $0.24 per 1,000 API calls, the rate that ended third-party apps like Apollo in 2023. (The Verge, 2023)

Frequently asked questions

There is one published npm package, redditapis-mcp, and it is a Model Context Protocol server that exposes read endpoints as tools for Claude, Cursor and other MCP clients. It is not a general-purpose JS/TS client library. For a plain script or a server route, fetch with a bearer token is the client, and that is what this page shows.

Set one header. Authorization: Bearer YOUR_API_KEY on every request to api.redditapis.com. There is no client id and secret pair, no token exchange, no refresh rotation, and no Reddit developer app to register. Read the key from an environment variable server side; never ship it to a browser bundle.

Technically yes, since it is CORS-reachable REST, but do not put your API key in client-side JavaScript. Anyone who opens devtools can read it and spend your balance. Call the API from a server route or an edge function and let the browser talk to that instead.

Yes, plain fetch is fully typed by lib.dom.d.ts, and the published OpenAPI document at api.redditapis.com describes every response shape, so you can generate types with openapi-typescript or a similar tool if you want typed responses without a maintained SDK.

A read is $0.002 per call regardless of how many rows come back, so a 100-post page and a 3-post page cost the same. Deep comment search is $0.02. Every new account starts with $0.50 in free credits, about 250 reads before any charge.

No. Proxy rotation, upstream retries and per-account cooldowns run on the server side, so a Node script deals with ordinary HTTP status codes rather than a shared quota budget. Handle 429 by honouring Retry-After, and handle 503 upstream_unavailable with a backoff, because neither is billed.

Yes, if the caller is an AI agent. redditapis-mcp exposes the read endpoints, plus monitor and webhook management, as MCP tools that Claude, Cursor and other MCP clients call directly, using the same bearer token. For a regular application, call the REST endpoints as shown on this page.

Keep reading.

Continue exploring related pages.

Reddit API documentation

The complete 2026 reference: auth, all 52 endpoints, and code.

Get a Reddit API key

Instant bearer token, no waitlist and no enterprise contract.

Reddit Responsible Builder Policy

Why Reddit denies API applications, and the managed REST bypass.

Reddit API use cases

14 use cases from AI training to brand monitoring and DMs.

Reddit Search API

Search posts, comments, users, and communities over one REST endpoint.

Reddit MCP server

Wrap the REST API as MCP tools for Claude, Cursor, and any MCP client.

Reddit API for AI agents

Live Reddit context for tool calls, MCP servers, and RAG pipelines.

Redditapis pricing

Endpoint-level costs and quick monthly totals - reads from $0.002 / call.

Reddit API cost calculator

Estimate monthly spend using your request volume.

Reddit API guides and tutorials

Tutorials, walkthroughs, and API deep-dives for developers.

Reddit API alternatives

Evaluate alternatives by cost model, limits, and integration fit.

Cheap Reddit API

The cheapest way to get Reddit data: $0.002 per call, no contract, no minimum.

Official Reddit API vs Redditapis

Access, setup, rate limits, and pricing, side by side.

PRAW alternative

A hosted Reddit REST API for any language, no app registration or OAuth.

Reddapi alternative

A maintained Reddit REST API with published pricing and write endpoints.

Reddit comment scraper alternative

The raw comment API: search and filter comments, historical and live, clean JSON.

Reddit scraper API

Hosted scraper API vs building your own: managed proxies, clean JSON.

RapidAPI Reddit alternative

A direct, maintained Reddit API with published pricing and write endpoints.

Bright Data Reddit alternative

A purpose-built Reddit API vs a general scraping platform: structured JSON, plus writes.

ScraperAPI Reddit alternative

A Reddit-native API vs a generic HTML fetcher: auth and pagination handled, typed JSON.

TikHub alternative

TikHub's Reddit surface is read-only; get comment, vote, and DM endpoints too.

EnsembleData alternative

No $100/month floor: pay per call from $0.002, plus write, vote, and DM endpoints.

Scrape Creators alternative

7 read-only Reddit endpoints vs a dedicated API with real write, vote, and DM paths.

FetchLayer alternative

Posts, comments, and search only; add vote, comment, and DM over the same REST auth.

Reddit monitoring API

Build your own keyword and brand-mention monitor: search, comment search, and subreddit streams over REST.

F5Bot vs Redditapis

F5Bot's Slack and Discord delivery needs its $49.99/mo Gold tier; Redditapis includes it from $19/mo.

Syften vs Redditapis

Syften caps you at 100 to 500 results a day; Redditapis allows 10,000 a day per monitor at the entry plan.

Octolens vs Redditapis

Octolens meters by mention with overage fees; Redditapis is flat-priced by subreddit slot from $19/mo.

Affiliate program

Earn 20% lifetime commissions - capped at $5,000/yr.

Reddit Vote API tutorial

Upvote and downvote a post programmatically via the REST API.

Reddit Data API: REST, no PRAW

REST endpoints for Reddit data with no PRAW and no OAuth dance.

Reddit scraping benchmarks

Real throughput, error rates, and cost benchmarks for Reddit scraping.

Reddit API answers

Direct answers on cost, access, rate limits, endpoints, and auth.

How much the Reddit API costs

Per-call pricing from $0.002 a read, with $0.50 in free credits.

Reddit API in Python

One requests call with a bearer token, no PRAW and no OAuth flow.

Reddit shadowban checker

Check if a Reddit account is shadowbanned in seconds, free and no login.

Paste the first snippet and run it.

$0.50 in free credits, no card required. The key is issued the moment you sign up.