RedditapisRedditapis

Read Private and Member-Only Subreddits With Your Own Session

Send your Reddit session as headers on any read endpoint to see private, restricted and member-only subreddits, plus your own feed. Optional, additive, and existing calls are unchanged.

Reads on this API are anonymous by default. They are served from our pool of logged-in accounts, which is why you send no cookies for them and why they work with nothing but your API key.

That default cannot answer everything. A private subreddit, a restricted one, a member-only community, or your own front page are all invisible to an account that is not yours. Send your own Reddit session on the request and the same endpoint fetches the same thing as you.

Nothing changes unless you opt in

This is additive. If you send no session headers, every read behaves exactly as it did before: same pool, same response, same billing. Existing integrations need no change and were not affected by this feature shipping.

Send the session as headers

Get the values from POST /api/reddit/login, which returns your cookie jar. Send them as headers:

HeaderCookieRequired
x-reddit-sessionreddit_sessionYes, whenever you authenticate
x-reddit-loidloidYes, whenever you authenticate
x-reddit-token-v2token_v2No
x-reddit-csrf-tokencsrf_tokenNo
x-reddit-edgebucketedgebucketNo
x-reddit-csvcsvNo
x-reddit-session-trackersession_trackerNo
x-reddit-pcpcNo
curl "https://api.redditapis.com/api/reddit/posts?subreddit=your_private_sub" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "x-reddit-session: YOUR_REDDIT_SESSION" \
  -H "x-reddit-loid: YOUR_LOID"

Headers, not query parameters. A Reddit session cookie grants full control of that account, and anything in a query string is written into access logs, proxy logs and browser history along the way. Headers are not.

Send both or neither

x-reddit-session without x-reddit-loid (or the reverse) is a 400 with code: "INCOMPLETE_SESSION", naming the header you left out.

It would be easy to fall back to an anonymous read there instead. That is exactly what makes it a bad idea: a private subreddit read anonymously comes back empty, and an empty listing is indistinguishable from a quiet one. You would get a plausible answer to a question you did not ask.

Reading through your own proxy

Add x-reddit-proxy to make the read leave from an IP you control, so it reaches Reddit from where that account normally acts:

-H "x-reddit-proxy: http://user:pass@host:port"

Same forms and the same behaviour as the write endpoints, including that your proxy is pinned for every retry, so a retry cannot move your account onto a different IP. Full detail on Proxies.

Without it, an authenticated read egresses through our shared pool. That egress is pinned for the request too, so your account is never presented to Reddit from several addresses in one call, but the address is ours rather than yours. Fine for most reads, and the wrong choice for an account with a strong geographic history.

A proxy sent without a session is a 400, not a silently anonymous read. There would be no account to act as, so the read would come from our egress while you believed it came from yours.

Which endpoints accept a session

The four user/:name/* listings have always required a session and have always taken it as query parameters. They now accept the header form too, and the query form keeps working. If you send both, the headers win, so a stale query parameter you forgot to delete cannot quietly serve you.

Errors

StatuscodeMeaning
400INCOMPLETE_SESSIONOne required session header was sent without the other.
400SESSION_REQUIREDThe endpoint needs a session and none was sent.
400PROXY_WITHOUT_SESSIONx-reddit-proxy was sent with no session, so there is no account to read as.
400INVALID_PROXYThe proxy address could not be parsed. The message names what is wrong with it.
400PROXY_AS_COOKIEA query field named like a proxy (proxy, server, username, password, socks5, …) was sent to an endpoint that forwards unknown query fields as cookies. Use the x-reddit-proxy header instead; sending it as a query field would ship your proxy credentials to Reddit.
401REAUTH_REQUIREDReddit rejected the session. Log in again.
403PERMISSION_DENIEDThe account cannot see this: private, restricted, not a member, or suspended.
404NOT_FOUNDIt does not exist, or is unavailable to this account.
429HTTP_429Reddit rate-limited your account. Retry-After says how long to wait.
502PROXY_ERROR and othersYour proxy could not complete the read. The response names it, because it is the one part you can fix.
503upstream_unavailableOur egress could not complete the read. Retryable, Retry-After is set, and not billed.

A rejected or expired session is always one of these, never a 200 with an empty list.

The 502 / 503 split is deliberate: a failure of your proxy is described so you can act on it, and a failure of ours is our problem to absorb rather than yours to pay for.

One thing this does not detect

If Reddit accepts your cookie but treats the request as logged out, a read of a public subreddit still returns real data and nothing marks it. For a private subreddit it surfaces correctly as 403, and for the feed as 403, so the gap is limited to public content, where the answer is at least not wrong. If you need certainty that a session is live, call GET /api/reddit/feed: it cannot be served without one.

Independent third-party API for developers and researchers. Not affiliated with, endorsed by, or sponsored by Reddit, Inc.

On this page