RedditapisRedditapis
Write

Post a Reddit Comment Programmatically

Post a comment on any Reddit thread programmatically. Handles reCAPTCHA, CSRF tokens, and rich-text encoding for you, just send post URL and text.

POST/api/reddit/comment$0.012 / call

Post a comment on any Reddit post.

Request Body

Cookies are passed as flat top-level fields.

FieldTypeRequiredDescription
post_urlstringyesAny reddit.com post URL
textstringyesPlain text comment body
reddit_sessionstringyesSession cookie from /api/reddit/login
loidstringyesLong-lived account identifier cookie
token_v2, csrf_token, edgebucket, csv, session_tracker, pcstringnoAny extra Reddit cookies as top-level fields
proxyobject | stringnoSticky IP for this account, {server, username?, password?} or a URL string. Use the same proxy you passed to /login. Omit to use our pool. See Per-account proxies.
locale / timezonestringnoBrowser-context identity, e.g. de-DE and Europe/Berlin. Match these to your proxy's country, or the account acts from your IP while reporting a New York clock. Only applies where a real browser runs. Defaults en-US / America/New_York. See Per-account proxies.
{
  "post_url": "https://www.reddit.com/r/X/comments/.../",
  "text": "your comment text",
  "reddit_session": "...",
  "loid": "...",
  "token_v2": "...",
  "csrf_token": "...",
  "proxy": { "server": "http://host:port", "username": "...", "password": "..." }
}

Success Response

{
  "success": true,
  "author": "your_reddit_username",
  "comment_id": "t1_ohfsdj0",
  "permalink": "https://www.reddit.com/r/X/comments/.../comment/ohfsdj0/",
  "body": "your comment text"
}

Errors

StatusMeaning
400Missing post_url / text or required cookies; or proxy is malformed (INVALID_PROXY), or a proxy-shaped field was sent as a top-level string (INVALID_FIELD), see Per-account proxies
401Missing Bearer token
403Invalid Bearer token
502Could not post
500Unexpected server error

Example

curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{
    "post_url": "https://www.reddit.com/r/test/comments/xxx/title/",
    "text": "hello from api",
    "reddit_session": "eyJhbGc...",
    "loid": "000000...",
    "token_v2": "eyJhbGc...",
    "csrf_token": "689ea9..."
  }' \
  "https://api.redditapis.com/api/reddit/comment"
const response = await fetch("https://api.redditapis.com/api/reddit/comment", {
  method: "POST",
  headers: {
    Authorization: "Bearer TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    post_url: "https://www.reddit.com/r/test/comments/xxx/title/",
    text: "hello from api",
    reddit_session: "eyJhbGc...",
    loid: "000000...",
    token_v2: "eyJhbGc...",
    csrf_token: "689ea9...",
  }),
});
import requests

response = requests.post(
"https://api.redditapis.com/api/reddit/comment",
json={
"post_url": "https://www.reddit.com/r/test/comments/xxx/title/",
"text": "hello from api",
"reddit_session": "eyJhbGc...",
"loid": "000000...",
"token_v2": "eyJhbGc...",
"csrf_token": "689ea9...",
},
headers={"Authorization": "Bearer TOKEN"},
)

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

On this page