Command Palette

Search for a command to run...

API

HTTP endpoints exposed by Insites Studio.

Studio's HTTP surface is internal — designed for the editor and the on-ramp flows to call, not for general public consumption. Endpoints live under /api/* in the same Next.js app. Most return JSON; the long-running ones (deploy, AI, migration) stream Server-Sent Events. This page is the canonical inventory.

AI#

POST /api/studio#

The editor's chat backend. Streams Claude's response with structured write_file and edit_file tool calls.

  • Body: { history, message, project, instance, connected, selector, dirtyFiles }
  • Response: SSE — { type: "status" | "text" | "patch" | "error" | "stop" }
  • Pre-call budget gate — returns 402 Payment Required if the workspace is at its monthly AI cap.

See AI Architecture for the full loop.

POST /api/migration#

Streams a migration plan markdown from a captured site fingerprint.

  • Body: { url, notes, fingerprint, palette, fonts, modules }
  • Response: streamed text — sections cover site overview, page inventory, module mapping, brand notes, risks, and next steps.

POST /api/new-project#

Generates the project brief from the new-project on-ramp form.

  • Body: the brief shape from app/project/new/page.tsx.
  • Response: streamed JSON with the scaffold plan.

POST /api/edit-existing#

AI helper for project-settings edits.

Deploy and GitHub#

POST /api/deploy#

Commits dirty files to the connected GitHub repo, then triggers a CloudShell deploy.

  • Body: { files: DeployFile[], instanceUuid?, instanceUrl?, message? }
  • Response: SSE — { type: "status" | "error" | "complete" }. Includes commit SHA and CloudShell deploy job ID.

GET /api/instance/git-status#

Reads recent commits from the project's GitHub repo.

  • Response: { owner, repo, branch, empty, totalRecent, thisMonth, last: { sha, shortSha, message, authorName, authorEmail, when, url } }.

Instance and Files#

GET /api/instance/files#

Returns the file tree or a single file from the connected repo.

  • Query: ?path=<file-path> (optional).
  • Without path: full recursive tree from branch HEAD.
  • With path: { path, sha, content } — content is UTF-8 decoded from base64.

GET /api/instance/context#

Returns schema, metadata, and contextual info for the connected instance — used to seed the AI's project context.

GET /api/instance/styles#

Returns the inferred Tailwind / CSS configuration from the instance, feeding the Styles centre-pane mode in the editor.

Migration on-ramp#

POST /api/migrate/build#

Kicks off the migration build job after the user has reviewed the plan. Returns the new project's state.

POST /api/migrate/export#

Exports the scraped site archive as a downloadable bundle.

Crawler#

GET /api/crawler/pages#

Lists pages crawled from a source URL.

POST /api/crawler/extract#

Extracts the design fingerprint (palette, fonts, sections) from a crawled page.

POST /api/crawler/preview#

Renders a preview of a crawled page, used inside the migrate on-ramp.

Connectors#

POST /api/connectors/<platform>/test#

Tests credentials for an external connector (Shopify, WordPress, Webflow, Wix, Squarespace).

POST /api/connectors/<platform>/import#

Runs the import for a configured connector. Streams progress.

See the per-platform Connectors guides.

Usage and budgeting#

GET /api/usage#

Returns the workspace's AI usage — month-to-date spend, per-model and per-surface breakdowns, 14-day chart data.

Realtime collaboration#

POST /api/liveblocks-auth#

Auth handshake that returns a per-room Liveblocks token, used by the multiplayer editor.

Misc#

GET /api/preview-proxy#

Proxies requests to live instance URLs so the in-browser preview pane can iframe them under Studio's origin.

POST /api/debug-sentry#

Triggers a Sentry error for testing instrumentation.

Authentication#

All endpoints assume a signed-in session. Studio is gated by the workspace SSO; cross-workspace requests are scoped automatically by the session.

Where this lives in code#

Each endpoint above lives at app/api/<path>/route.ts mirroring the URL.