Consume the REST API from a self-hosted server

When you run @superinterface/server yourself, all REST endpoints are mounted under /api/**. Substitute your deployed hostname for the base URL—for example https://api.example.com/api/messages.
Superinterface Cloud exposes the same endpoints under /api/cloud/**. The only difference for self-hosting is the missing /cloud path segment.

Base URL

https://<your-server>/api
Combine this base with the REST API reference to find the route you need. For instance, the messages APIs live at /api/messages, workspaces at /api/workspaces, files at /api/files, and so on.

Authentication

All protected routes expect the organization API key you created during setup:
curl https://api.example.com/api/workspaces \ -H "Authorization: Bearer <organization-api-key>"
If you use public API keys (for read-only access), pass them in the publicApiKey query parameter exactly like the Cloud API.

Using the React package

@superinterface/react accepts a custom base URL so it can talk to your deployment:
import { SuperinterfaceProvider, ThreadDialog } from '@superinterface/react' export function App() { return ( <SuperinterfaceProvider baseUrl="https://api.example.com/api" variables={{ publicApiKey: 'pk_live_123', assistantId: 'asst_123', }} > <ThreadDialog /> </SuperinterfaceProvider> ) }
Every hook and component in the package reuses that base URL when fetching data.
Pass the organization API key to your backend services, and issue public API keys to client-side experiences through the variables.publicApiKey field as shown above.

Calling the API from server code

If you integrate the handlers directly into another Next.js app (see Add routes to Next.js), export them from /api/... inside your project. This keeps the relative paths identical between the packaged server and your customized build.