Skip to main content
Routes let other services call your app: a CI system reporting a deployment, Stripe sending a webhook, a cron job asking for a refresh. A route is a standalone piece, like a block or an event handler.
src/routes/deployWebhook.ts
Add it with .addRoute(DeployWebhook). Routes are app-wide, not tied to an install, so they have no install config. Use reintersect.forInstall(installId) to act for a workspace your app knows; store the install id when your app is installed, and put it in the URL or the payload you give the other service. Using Effect? See Routes in the Effect guide.

Where routes are served

reintersect.app never carries Reintersect cookies, so the hosted origin is safe to hand to third parties. Requests to it carry no Reintersect signature: verify them with the sending service’s own scheme. The Next.js template mounts the app at src/app/api/[[...path]]/route.ts, so deliveries go to /api/reintersect, routes to /api/<path> and an MCP server to /api/mcp. The Hono template mounts it under /api, and the Effect template mounts the delivery path, every route and /mcp on the router through ReintersectApp.layer.

Options

Handler context

forInstall works on both hostings. Self-hosted, the SDK mints a one-hour install token with REINTERSECT_APP_CLIENT_ID and REINTERSECT_APP_CLIENT_SECRET. Hosted, it asks Reintersect’s gateway, which checks that the install belongs to your app, is active and runs the version making the call (a preview counts only on a development install), then adds a token with the install’s scopes. Your code never holds it.

Paths

Paths start with /, have no trailing slash, query, hash, braces, spaces or regex groups, and may not use /reintersect or /mcp, which the app uses for deliveries and MCP. Paths must be string literals so the types can check them; mistakes are type errors such as "*" is only allowed as the final path segment. When several routes match, the most specific wins: literals beat parameters, and parameters beat a rest segment. A path that matches with the wrong method gets 405 with an Allow header; no match is 404. If the handler throws, the app answers 500 and logs the error.

Test a route

Routes are plain fetch handling, so call app.fetch in a test: