Building on Totalum's API from your app
For apps whose own users create apps: the key, where it lives, and who pays.
Published · Updated
An app that builds apps for its own users (an app builder, a white-label site builder, or an agency tool) calls the Totalum App Builder API from its own server with an account key of its own, stored in the project secret TOTALUM_VCAAS_API_KEY. Everything it does through that key, every project it creates and every prompt it sends, is billed to the account's credits. Each generated app is owned by the end user it was built for, set through ownerEmail, and that end user never needs a Totalum account of their own.
Some apps are themselves app builders: their users describe an app and the app creates it. Such an app calls this API from its own server, with a Totalum API key of its own.
#Where the key comes from
- In the Totalum app: on the first prompt of a new project, when that prompt asks for an app that creates or hosts apps for its own users, Totalum adds the key for you, but only if you may manage the account's API keys (owner, admin, or a member allowed to manage API keys). It creates an account API key named
App builder — <project name>and stores it in the project as the secretTOTALUM_VCAAS_API_KEY. A card in the chat tells you it was added. Later prompts are never checked, and nothing is added for anyone who may not manage API keys. - Through this API or the MCP: nothing is ever added automatically, whatever the prompt says. Create a key on your account and pass it yourself as the project secret
TOTALUM_VCAAS_API_KEY(environmentboth): in thesecretsof Launch Project, or with Create Secret before the prompt that needs it.
#Rules for the key
- It is an account key (
tlm_sk_…): everything the app does with it (every project it creates and every prompt it sends) is billed to your account and counts against your plan's limits. - It lives only in the project secret
TOTALUM_VCAAS_API_KEY, read on the server. Never put it in source code, a committed.env, or aNEXT_PUBLIC_*variable, and never call this API from browser code. - You can revoke it at any time from your API keys, like any other key.
#What the app calls
The same endpoints as any other client: Launch Project, Get Agent Status, Run AI Agent, Get Project Details, Deploy to Production, List Versions and Delete Project. The whole reference is at https://www.totalum.app/totalum-api.md.
#Your user owns the app they build
A generated app's admin is its owner's e-mail. Without ownerEmail the first person who signs up in the app becomes its admin, which may not be your user: send your user's e-mail as ownerEmail in Launch Project (or later with Set App Owner). The user then signs up in their app with that address, enters the 8-digit code e-mailed to them (the app asks for it right after sign-up), and then has the admin and staff pages. Accounts made in the preview stay in the preview: after publishing, users sign up again in the published app.
#How Totalum generates the backend and the database
Every project is a Next.js application (App Router, React, TypeScript) styled with Tailwind CSS, with sign-in by better-auth (/llms.txt, API overview).
Each project has its own SQL database (SQLite on Cloudflare D1, used through Drizzle ORM), one for development and preview and another for the published site, never shared with another project (/llms.txt). Schema changes are migrations: the agent applies them to the development database, and publishing applies them to the live one; a change that would delete or overwrite live data runs only after confirmation (/llms.txt, API overview). The database can be read and written through the API, and downloaded at any time as a standard SQLite SQL dump (/llms.txt).
The app itself runs on Cloudflare Workers (/llms.txt, API overview), and the source code is real: the account can see it on every plan, and export it or sync it to GitHub on paid plans (API overview, Build your own AI app builder).
#Integration checklist
- API integration: the endpoints listed above, authenticated with the
api-keyheader and atlm_sk_…key, available on every plan including Free as long as the account keeps at least 1 credit (API overview). - Tenant ownership: one project per end-user app, with
ownerEmailor Set App Owner naming who owns it; every project belongs to your account, under your brand, with per-project monthly credit caps and live spend analytics per project (/en/whitelabel). - Credential protection: the key lives only in the server-side secret
TOTALUM_VCAAS_API_KEY, never in source code, a committed.env, or aNEXT_PUBLIC_*variable, and it is never called from browser code; revoke it at any time from your API keys, and each project keeps its own secret. - Production checks: preview first, then Deploy to Production; a custom domain per project is available on paid plans (Custom Domains); and the generated code can be synced to GitHub or exported on paid plans (API overview, /en/whitelabel).
To see this pattern already wired up, clone the open-source reference builder github.com/totalumlabs/ai-app-builder-open (MIT license; its only required environment variable is TOTALUM_VCAAS_API_KEY).
