public:write
Start public threads and reply in public threads.
App Connect lets people connect your app to their Treechat account. They sign in on Treechat and approve what your app may do. Your app then posts, replies, uploads and reads for them through a JSON REST API. Nobody shares a password with you.
https://api.treechat.com/api/apps/v1
Standard OAuth 2.0 with PKCE. Register your app at api.treechat.com/mcp/oauth/apps. The step-by-step guide with every field is at api.treechat.com/developers/apps.
Sign in at
api.treechat.com/mcp/oauth/apps
and give your app a name, a homepage and the exact redirect URIs
you'll use (https, or http://localhost while you
build). Pick only the permissions you need. You get a client ID and
a client secret. The secret is shown once; keep it on your server.
The app works for anyone as soon as it is registered.
Authorization code flow with PKCE (S256 is required). Redirect the browser to:
https://api.treechat.com/mcp/oauth/authorize
?response_type=code
&client_id=YOUR_CLIENT_ID
&redirect_uri=https://yourapp.com/auth/treechat/callback
&scope=public:write%20channels%20uploads:write%20treechat:read
&state=RANDOM_STATE
&code_challenge=BASE64URL_SHA256_OF_VERIFIER
&code_challenge_method=S256
&resource=https://api.treechat.com/mcp
Treechat shows the person your app's name, homepage and your username, and lets them pick which channels your app may use.
curl -X POST https://api.treechat.com/mcp/oauth/token \
-u YOUR_CLIENT_ID:YOUR_CLIENT_SECRET \
-d grant_type=authorization_code \
-d code=CODE_FROM_REDIRECT \
-d redirect_uri=https://yourapp.com/auth/treechat/callback \
-d code_verifier=YOUR_VERIFIER \
-d resource=https://api.treechat.com/mcp
Access tokens last 15 minutes. Get a new pair with
grant_type=refresh_token; each refresh token works
once, so save the new one every time.
curl -X POST https://api.treechat.com/api/apps/v1/posts \
-H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: episode-1" \
-d '{"content":"Episode 1 is up","public":true,"files":["SIGNED_ID"]}'
201 returns post_id and
thread_id. To reply, send thread_id
(and reply_to_post_id for a specific post). To post in
a channel, send channel_id instead of
public. To upload, POST /uploads first,
then PUT the bytes and post with the signed_id.
Ask only for what your app needs. The person sees each one on the approval page.
public:writeStart public threads and reply in public threads.
channelsPost in, and get webhooks from, the channels the person picked for your app. They can change the list later on Connected apps.
uploads:writeUpload images, audio and video to attach to posts.
treechat:readRead threads and posts the person can see, and list a user's threads or the public feed.
account:readRead the connected person's ID and username (GET /me).
Apps can't post in private threads or DMs, create channels, invite people or spend the person's money. Posts show “via your app name”.
Idempotency-Key header with every post and
reuse it when you retry, so nothing is posted twice.
202 means the post is still being saved. Check
GET /api/apps/v1/operations/OPERATION_ID; don't retry
with a new key.
"public": true or a
channel_id. Without either it would be private, and
apps can't post privately, so the request is refused.
401 means refresh.
Each refresh token works once. A connection unused for 30 days has
to be approved again.
upload.url with
exactly the returned upload.headers. Don't add your
access token.
{"error":{"code":"…","message":"…"}}. A
403 with app_suspended means Treechat
suspended your app.
30 a minute per connected person, and 60 an hour per person across all apps.
300 a minute per access token.
Up to 2 GB per file and 10 GB a day per person.
Get a signed post.created call for new posts in the
channels the person picked, instead of polling. Up to 10 per
person.
People see and remove the apps they connected at api.treechat.com/mcp/oauth/connections.
Building with a coding agent? Paste this in:
Add "Connect with Treechat" to this app.
1. Read https://treechat.com/apps.md and https://docs.treechat.com/llms.txt.
2. Use the OpenAPI file https://api.treechat.com/api/apps/v1/openapi.json
for request and response shapes.
3. OAuth 2.0 authorization code + PKCE (S256) against api.treechat.com,
with resource=https://api.treechat.com/mcp. Keep the client secret on
the server. I will register the app and give you the client ID.
4. Store the refresh token and replace it after every refresh.
5. Send an Idempotency-Key on every post and "public": true (or a
channel_id) on new threads.
https://api.treechat.com/api/apps/v1.
OpenAPI 3.1:
api.treechat.com/api/apps/v1/openapi.json.
/mcp/oauth/authorize, tokens at
/mcp/oauth/token. Send
resource=https://api.treechat.com/mcp on both.
public:write,
channels, uploads:write,
treechat:read, account:read.
treechat:write is not available to third-party apps.
https://api.treechat.com/mcp. Connecting your own
assistant instead of connecting an app? See /mcp.
Every request, field, error and the webhook signature check.
Quickstart, endpoints and examples on docs.treechat.com.
The REST API as OpenAPI 3.1 JSON, for code generators.
An index of the docs, with a Markdown link for every page.