Multi-Tenancy
Availability: Live
Every account belongs to exactly one workspace (in the API, a tenant). This page covers what that boundary guarantees and how to build on it when you serve several customers of your own, as a reseller, a system integrator or a product that embeds Wetel for more than one client.
What a workspace isolates
Section titled “What a workspace isolates”- Everything is scoped to one workspace: agents, workflows, knowledge bases, custom actions, connectors, sessions, users and API keys. Each request is scoped to the workspace of its credential, and every read and write filters by it.
- No cross-workspace access: a credential for one workspace cannot read or change another’s data, whatever ids it sends.
- One API for everyone: every workspace calls the same operations (
sdkStart,createAgent,createMcpConnectorand so on); only the data behind them differs.
API keys belong to one workspace
Section titled “API keys belong to one workspace”An API key is bound to the workspace of the signed-in user who created it, and only reaches that workspace’s agents and workflows. Create one key per consumer with createNamedApiKey:
mutation CreateKey($name: String!) { createNamedApiKey(name: $name) { id key warning }}{ "name": "customer-gateway" }key is returned once; store it in your backend. Key kinds, rotation and revocation are on Authentication.
The gateway pattern for system integrators
Section titled “The gateway pattern for system integrators”When you serve several customers, give each customer its own Wetel workspace and keep every customer’s API key in your own backend. Your backend is the gateway: it holds the keys and calls Wetel on each customer’s behalf.
sequenceDiagram participant CF as Customer's frontend participant SI as Your backend (gateway) participant W as Wetel
CF->>SI: start chat for customer 123 SI->>SI: look up customer 123's API key SI->>W: sdkStart(input: { agentId }) with X-Api-Key and x-huat-platform W-->>SI: sessionId, avatarToken SI-->>CF: sessionId, avatarToken Note over CF,W: from here the flow is a normal single-workspace integrationThe diagram shows a customer’s frontend asking your backend to start a chat; your backend calls sdkStart with that customer’s key and returns only the session id and session token.
- Each customer has its own workspace and its own API key, created by the customer or by you on its behalf.
- Your backend stores each key in your database or secrets manager, keyed by your own customer id.
- The customer’s frontend calls your backend, never Wetel, to start a chat.
- Your backend calls
sdkStartwith that customer’s key and that customer’s agent. - Wetel returns
sessionIdand a short-livedavatarToken, both scoped to the customer’s workspace. - Your backend hands those two values to the frontend. From here the integration is the standard one in Core API Flow.
What you get: one backend serving every customer, no workspace logic in any frontend (Wetel enforces the boundary), and no long-lived key in any browser.
Do not:
- Pass a customer’s API key to that customer’s frontend. Whoever holds the key can start conversations, run workflow tasks and make model and embedding calls for that workspace until the key is revoked. It cannot create or change agents or workflows, which need a dashboard login, but treat it like a database password.
- Share one key across customers. With a workspace and a key per customer, a leaked key or a bug in one integration cannot reach another customer’s data.
Next steps
Section titled “Next steps”- Authentication: API keys, session tokens and the required header.
- Core API Flow: the
sdkStart,sdkSendMessage,sdkEndSessionflow your gateway proxies. - Configuring an Agent: the agent each customer’s key starts sessions with.