RedditAPIRedditAPIs
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
{
  "post_url": "https://www.reddit.com/r/X/comments/.../",
  "text": "your comment text",
  "reddit_session": "...",
  "loid": "...",
  "token_v2": "...",
  "csrf_token": "..."
}

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
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"},
)

On this page