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.
/api/reddit/comment$0.012 / callPost a comment on any Reddit post.
Request Body
Cookies are passed as flat top-level fields.
| Field | Type | Required | Description |
|---|---|---|---|
post_url | string | yes | Any reddit.com post URL |
text | string | yes | Plain text comment body |
reddit_session | string | yes | Session cookie from /api/reddit/login |
loid | string | yes | Long-lived account identifier cookie |
token_v2, csrf_token, edgebucket, csv, session_tracker, pc | string | no | Any extra Reddit cookies as top-level fields |
proxy | object | string | no | Sticky 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 / timezone | string | no | Browser-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
| Status | Meaning |
|---|---|
400 | Missing 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 |
401 | Missing Bearer token |
403 | Invalid Bearer token |
502 | Could not post |
500 | Unexpected 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.
Authenticated reads
Send your Reddit session as headers on the twelve read endpoints that accept one, to see private, restricted and member-only subreddits, plus your own feed, saved, hidden and upvoted. Five of the twelve need a session and cannot be served without one. Optional, additive, and existing calls are unchanged.
Comment v2New
Post Reddit comments ~2x faster than v1 with the v2 endpoint. Same request shape, same response, just lower latency for higher-volume use cases.
