$ lanes link connect reddit --profile personal --workspace localReddit is the one account here that needs an app of your own. It takes a couple of minutes, once.
What your agent can do
Reads are granted when you connect. Posting, editing, and voting need the write bundle.
| Capability | What it does |
|---|---|
reddit.list_posts | Posts from one subreddit, in a given order |
reddit.get_post | One post with its comment tree |
reddit.search | Full-text search within a subreddit |
reddit.get_subreddit | Description, subscriber count, and whether posting needs a flair |
reddit.get_rules | What a submission has to satisfy |
reddit.list_flairs | Flair templates and their ids |
reddit.whoami | Which account this connection is |
reddit.list_my_subreddits | The subreddits this account subscribes to |
reddit.submit_post | Create a text or link post |
reddit.add_comment | Comment on a post, or reply to a comment |
reddit.edit_text | Replace the body of something this account wrote |
reddit.vote | Up, down, or clear |
reddit.delete_thing | Permanent. Reddit has no trash reachable from the API |
reddit.save_thing | Add to saved items |
reddit.set_flair | Apply a flair template to your own post |
There is no moderation, no direct messages, and no browsing history. Reddit publishes thirty scopes and this asks for eight, so nothing on the consent screen is a permission no tool can spend.
Before an agent posts anywhere
Writing on Reddit happens publicly, under your username, and cannot be taken back: deleting a post leaves the deletion behind, and anything quoted or replied to in the meantime stays. Two things save most of the trouble:
- Most subreddits require a flair.
reddit.list_flairsreturns the templates and their ids; pass one asflair_id. A submission without one is rejected by the subreddit, not by the API, so the error does not mention flair. - Read the rules first.
reddit.get_rulesis cheap, and most removals are rule violations rather than API errors.
If you want an agent that reads Reddit but never writes to it, deny the write half:
$ lanes link policy deny reddit.submit_post reddit.add_comment reddit.vote --profile personal --workspace localWhy there is no shared client for this one
Google and Slack authorise against a client Lanes operates, so there is no console to visit. Reddit cannot work that way, because of how it meters access: Reddit's rate limit is a hundred queries a minute per OAuth client id, not per user and not per token.
A shared client would pool every install of this program into one bucket. Your limit would be reached by strangers, and the failure would arrive as somebody else's traffic. An app of your own gets its own hundred, which is the whole budget for one person.
Registering the app
-
Open https://www.reddit.com/prefs/apps and choose create another app....
-
Give it a name you will recognise later. The name is how you revoke this one without touching your other apps.
-
Choose web app. The other two do not fit:
scriptonly ever reaches your own account, andinstalled appissues no secret for this to hold. -
Set the redirect uri to exactly:
Codehttp://127.0.0.1:8765/callbackReddit matches this character for character. It is the address
connectlistens on, and a different port, orlocalhostin place of127.0.0.1, is refused after you approve the consent screen rather than before. -
Create the app. The client id is the string just under the app name; the secret is the field labelled
secret.
Then run the connect command above. You are asked for both values once, they go into your credential store, and the browser opens.
Getting API access approved
Creating an app is not the same as being allowed to call the API. Reddit's Responsible Builder Policy says access must be requested and approved, and the create-app page links to that separately.
The quickest way to find out where you stand is to ask for an app-only token:
$ curl -sS -X POST -u "<client_id>:<client_secret>" \
-A "lanes-link/0.3" \
-d "grant_type=client_credentials" \
-w "\nHTTP %{http_code}\n" \
https://www.reddit.com/api/v1/access_token200 means the gate is open. 403, or an HTML page instead of JSON, means the app exists but
access has not been granted yet.
When it stops working
| What you see | What it is |
|---|---|
invalid redirect_uri in the browser | The app's redirect uri is not exactly http://127.0.0.1:8765/callback |
| Connected, then every call fails an hour later | The grant was made without duration=permanent. Reconnect with --replace |
403 or HTML from every call | The app exists but API access has not been approved |
429 | The hundred-per-minute limit for this client id. It is per client, so nothing else is spending it |
Port 8765 is already in use | Something else holds the port. The redirect names it exactly, so free the port |
If you regenerate the secret:
$ lanes link connect reddit --profile personal --workspace local --replaceThe scopes it asks for
Reddit publishes thirty scopes. This asks for eight.
| Scope | What it allows |
|---|---|
identity | read your username and signup date |
read | read posts and comments |
submit | post and comment publicly as you (broad) |
edit | edit and delete your posts and comments (broad) |
vote | vote on posts and comments as you (broad) |
save | save and unsave posts and comments |
flair | set the flair on your posts |
mysubreddits | list the subreddits you belong to |
The three marked broad are broad for a different reason from most: not for how far they reach
into a private space, but for acting publicly under your username. They are the only writes here
that cannot be taken back, so connect stops and asks for an explicit yes.
Not asked for:
privatemessages. It would put the account's DMs in reach of a tool list whose subject is public posting.- The
mod*scopes. They act on other people's content in subreddits this account moderates, which is a different job with a different blast radius.
How to narrow or widen any of this is on Scopes and permissions.
What is recorded
Subreddit, flair id, nsfw, and spoiler are kept. The body is withheld, and so is the title,
and so is a link post's url.
The title looks like metadata and is not. A Reddit title is usually the whole of the post and the body is often empty, so keeping it would defeat withholding the body. See the audit log.
Next: every provider, or Add it to your agent.