RedditapisRedditapis
Write

Create a Reddit Post Programmatically

Create a Reddit text or link post through a REST call. Handles session cookies, CSRF tokens and subreddit rule rejections, and refuses unsupported post kinds by name instead of silently downgrading them.

POST/api/reddit/submit$0.012 / call

Create a post in a subreddit as the authenticated caller. Serves text (self) and link posts.

Not yet verified end to end. The route is unit-tested and its request shape is derived from the live router, but no post has been created through it against a real Reddit account. A write that fails does so under your account, in a real subreddit. Talk to support before you build on this, and we will verify it with you.

Request Body

Cookies are passed as flat top-level fields.

FieldTypeRequiredDescription
subredditstringyesTarget subreddit name, without the r/ prefix
kindstringyesself for a text post, link for a URL post
titlestringyesPost title
textstringnoBody text. Used when kind is self.
urlstringnoTarget URL. Used when kind is link.
nsfwbooleannoMark the post NSFW
spoilerbooleannoMark the post a spoiler
sendrepliesbooleannoSend reply notifications to the author inbox
flair_idstringnoSubreddit flair template id
flair_textstringnoFlair text, where the subreddit allows it
reddit_sessionstringyesSession cookie from /api/reddit/login
loidstringyesLong-lived account identifier cookie

Which kinds are served

self and link are served. Poll, image and video are refused by name with a 400, never silently downgraded to a text post. A caller who asked for a poll and quietly received a text post would have no way to discover that until a human looked at the subreddit, so the refusal is deliberate and explicit.

Those three need a different upstream path: polls use Reddit's own poll endpoint, and image and video require a media lease and an upload before the post is created, with the result delivered asynchronously.

Errors

StatusMeaning
400subreddit, kind or title missing, a kind this endpoint does not serve (UNSUPPORTED_POST_KIND), or a malformed field
401Missing Bearer token
402Insufficient credits
403Invalid Bearer token
429Rate limited
502Reddit refused the post: a subreddit rule (NOT_ALLOWED_IN_SUBREDDIT), Reddit's own rate limit (REDDIT_RATELIMIT), a generic refusal (REDDIT_REFUSED), or a captcha demand (CAPTCHA_REQUIRED)
503No session could be acquired from the pool before the timeout
500Unexpected server error

A subreddit rejection is a 502, not a 403. 403 means this API rejected your Bearer token and never reached Reddit at all. That distinction matters when you write the handler: a 502 carrying NOT_ALLOWED_IN_SUBREDDIT is Reddit's final answer about this post, so retrying it reproduces the same refusal, while a 503 is our pool and is worth retrying. Treating the subreddit refusal as a generic transport failure is the one mistake that costs a real account a repeated rejected post.

A rule rejection carries Reddit's own machine-readable error in reddit_errors, so a karma requirement, an account-age gate or a banned link domain is distinguishable from a transport failure rather than collapsing into one opaque error. CAPTCHA_REQUIRED is terminal for this endpoint by design: it does not solve captchas, so retrying the same way will not help.

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

On this page