Guides · Publish and connect
Build an app (API, OAuth, webhooks)
Max's REST API, sign-in with OAuth, and signed webhooks for developers.
Tokens, refresh and PKCE
OAuth access tokens last an hour. The token response also has a refresh_token: POST it to /api/v1/oauth/token with grant_type=refresh_token for new tokens (each refresh token works once, so store the new one). Apps that can't keep a secret (phone, desktop or browser apps) tick Public app and use PKCE: send code_challenge and code_challenge_method=S256 on the connect link, then code_verifier (and no client_secret) when exchanging the code. Private apps' copied tokens don't expire.
# refresh curl -X POST https://max.chaos.fail/api/v1/oauth/token \ -d grant_type=refresh_token -d client_id=$CLIENT_ID -d client_secret=$CLIENT_SECRET -d refresh_token=$REFRESH
Permissions and pages
- Permissions: read or write pages and databases, database rows, comments and files, and see people's names. Older apps with page permissions keep access to rows and files.
- People can limit an app to the pages they pick (and everything inside them), and change its permissions later without reconnecting. When your app asks for more, existing connections keep what they granted until someone approves the rest.
- Each connection can make 300 calls a minute; past that, calls get HTTP 429 with a retry time.
Developer dashboard
Settings → Connections → Build an app → Dashboard shows connections, active use, API calls and every webhook delivery with its status, attempts and last error. Replay any delivery, or send a signed test.ping to check your endpoint. Max checks the signature for you in the SDK (Max.verifyWebhook).
OpenAPI, SDK and reference
- Every operation, with its permission and arguments: /docs/api-reference (with a Try it box).
- OpenAPI 3.1: /api/v1/openapi.json. Each operation is also POST /api/v1/ops/<op> with the arguments as the body.
- TypeScript SDK with no dependencies: /api/v1/sdk.ts (calls, OAuth with PKCE, refresh, webhook verification).
import { Max } from "./max";
const max = new Max({ token: process.env.MAX_TOKEN! });
const { pages } = await max.call("pages.tree");1. Register your app
In Settings → Connections → Build an app, choose New app: its name, what it does, the permissions it needs, OAuth redirect addresses and, optionally, a webhook address and events. Save the client secret and webhook signing secret: they're shown once.
2. Get a token
Private apps: open Connect on your app and copy the token. Public apps use the OAuth code flow:
- Send people to https://max.chaos.fail/apps/<client_id>?redirect_uri=<registered address>&state=<random>.
- After they approve, Max redirects to your address with ?code=…&state=….
- Your server exchanges the code (valid 10 minutes, once) for the token.
curl -X POST https://max.chaos.fail/api/v1/oauth/token \
-d grant_type=authorization_code -d client_id=… -d client_secret=… -d code=… -d redirect_uri=…
# → { "access_token": "maxi_…", "token_type": "bearer", "workspace": …, "scopes": [...] }3. Call the API
One endpoint runs every operation Max's own interface and assistants use, limited to the permissions granted:
curl https://max.chaos.fail/api/v1/ops \
-H "Authorization: Bearer maxi_…" -H "Content-Type: application/json" \
-d '{"op":"pages.create","args":{"title":"Hello from my app"}}'GET /api/v1/ops lists every operation with its description and the permission it needs. Errors come back as { error: { code, message } } with a matching HTTP status. Up to 300 requests a minute per token.
4. Webhooks
Max POSTs JSON for the events you chose (page.created, page.updated, page.content_updated, page.deleted, record.created, record.updated, comment.created). Payloads carry ids and the event name, never content: fetch what you need with the API. Failed deliveries are retried after 1, 5 and 30 minutes and 2 hours.
Verify each delivery: the Max-Signature header is t=<unix time>,v1=<hex>, an HMAC-SHA256 of "<t>.<raw body>" with your signing secret. Reject old timestamps.
Publish to the marketplace
Choose Submit on your app. Max's team reviews it; you'll see the decision and any notes in Build an app.