> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pendpost.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Reddit

> Set up Reddit posting with a script app and a dedicated posting account.

The Reddit lane publishes posts to a subreddit. It publishes only once a Reddit credential is present in your `.env`; until then the lane is live-but-unauthenticated and waits for you to connect it (set `PENDPOST_MODE=mock` to exercise it through the mock driver).

> [!NOTE]
>
> **Beta lane.** Reddit is built but not yet live-verified end to end, so treat it as a preview and do not rely on it for guaranteed delivery. The lane loses this badge once it is live-verified.

You own your Reddit account and are responsible for Reddit's terms of service. pendpost drafts and schedules, but a human approves before anything goes live.

> [!NOTE]
>
> **The free API tier is non-commercial.** Reddit's free Data API is rate limited and licensed for non-commercial use only. High-volume or commercial posting needs an approved Reddit API plan.

## Setup ceremony

A script app authenticates as the Reddit account that owns it, using a password grant for the `submit` and `identity` scopes.

1. **Create a script app.** Sign in to Reddit, open the [apps page](https://www.reddit.com/prefs/apps), and click "create another app". Choose the "script" type, give it a name, and set the redirect uri to `http://localhost:8088` (a script app does not use it, but the field is required). The id shown under the app name is your client id; the "secret" field is your client secret.
2. **Record the client secret.** Copy the secret shown next to the app and store it. Treat it like a password.
3. **Set the posting account credentials.** Set the username and password of the account that owns the app. Use a dedicated posting account, not a shared admin login. The password grant does not support accounts with two-factor login enabled.
4. **Pick the target subreddit.** Set the subreddit you publish to, without the `r/` prefix. The account must have permission to post there, and the subreddit rules must allow the kind of content you send.

Then confirm the connection. It mints a short-lived token with the password grant and reads your identity back:

```bash theme={null}
node scripts/reddit-social.mjs auth
```

## Environment variables

| Variable | Purpose |
| - | - |
| `REDDIT_CLIENT_ID` | Your script app's client id (shown under the app name). |
| `REDDIT_CLIENT_SECRET` | Your script app's client secret. |
| `REDDIT_USERNAME` | The posting account's username. |
| `REDDIT_PASSWORD` | The posting account's password (password grant; the account must not have two-factor enabled). |
| `REDDIT_SUBREDDIT` | The target subreddit, without the `r/` prefix. |

> [!NOTE]
>
> A lane publishes only once its credential is present. If the Reddit variables are blank, the Reddit lane is live-but-unauthenticated and waits for you to connect it. Set `PENDPOST_MODE=mock` to exercise it through the mock driver.

## Validate the lane

A present credential is not the same as a working one. After setup, validate the Reddit lane in the **Setup** tab, or run a live probe with the `health_recheck` tool, to confirm the credential is live and not just configured. The lane is ready when it reports live.

> [!NOTE]
>
> **Over MCP.** Setup and rotation are an interactive human ceremony; secrets are never written through MCP. An agent can still check status (`account_status`), run a live liveness probe (`health_recheck`), and read non-secret config (`config_get`) over MCP without touching credentials.

## Common failures

| Symptom | Cause | Fix |
| - | - | - |
| auth returns "401 Unauthorized". | The client id/secret pair is wrong, or the app is not a "script" type. | Recreate the app as a "script" type and copy the id (under the name) and secret exactly into `REDDIT_CLIENT_ID` / `REDDIT_CLIENT_SECRET`. |
| auth returns "invalid\_grant". | The account username or password is wrong, or the account has two-factor login enabled. | Check `REDDIT_USERNAME` / `REDDIT_PASSWORD`. The password grant does not support 2FA accounts; use a posting account without 2FA. |
| Publishing returns "SUBREDDIT\_NOTALLOWED" or a rules error. | The account cannot post to that subreddit, or the content breaks subreddit rules. | Confirm `REDDIT_SUBREDDIT`, that the account has posting access there, and that the post matches the subreddit rules. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.