1. Quick start: hand it to an agent
The fastest way to use AtomHouse is not to learn the console first. Install the skill, describe the outcome, and let the agent do the work.
- Install the AtomHouse skill. It teaches the agent how to operate your account.
- Describe the app you want. The agent handles the rest.
Step 1: install the skill
The easiest path is to give the agent this one sentence:
Download https://atomhouse.cloud/api/v1/skill.zip, unzip it into your skills directory, and follow INSTALL.md to install or update. When done, reply briefly: whether you are connected and what I can do next.
With Node.js, you can also install and authorize from the command line:
npx atomhouse-skill add
npx atomhouse-skill login
The three methods — one sentence, npx (optionally with an API base URL), and downloading the package — are documented in full in Install the skill.
verification_uri_complete in your own browser and approve it. Do not “auto-open” it on a server. No account yet? Register from that page.Step 2: describe the outcome
Do not ask “how do I create a table?” Describe the finished app, who uses it, and what must stay private:
Build a reading-club app for my team:
- members can add a book, author and private note
- each member can only see their own notes
- I can see everything and approve new members
- it should work in a browser, and give me a shareable link
Check my account and workspace first; do not guess a slug.
If needed, set up the workspace, app, tables and permissions for me.
What the agent does behind that one request
You see one request and one link. Underneath, the agent performs a sequence of correct steps:
| What you see | What the agent does |
|---|---|
| “Check my account” | Calls bootstrap; confirms the account, workspaces, workspace role and available apps. If there is no account, guides authorization or sign-up. |
| “Build a reading app” | Confirms the workspace; creates it or the app if needed; calls create_app to build the schema, tables, primary keys and seed data in one step. |
| “Each person sees only their own notes” | Designs an owner_id column, calls set_app_role to narrow member, and writes the filter as owner_id = {user_id} instead of leaving the default full access. |
| “Admins approve members” | Configures App Roles, access requests and the review flow; creates a function or trigger when server-side work is needed. |
| “It opens in a browser” | Writes the frontend, calls REST with the right cookies/CSRF, and handles the capability: null ask-for-access state instead of shipping a blank page. |
| “Give me a link” | Uploads the site, calls publish_site, runs site_status to catch missing assets or bad API calls, and returns the URL. |
Or do it manually
You can skip the agent entirely: register in the console → create a workspace → create an app → add tables → configure access → publish a site. The Concepts, REST and Console sections below cover that path. The agent is faster, not the only entrance.
2. Concepts
Workspace
The account, membership and data boundary. One account can join several workspaces. Members have workspace roles.
App
An isolated schema named app_<slug>: tables, views, functions, triggers and App Roles. An app is not a page.
Site
Static files published to AtomHouse and served at /site/<workspace>/<site>/. An app can have several sites.
App Role
The identity inside an app: admin, member, reader, plus custom roles. It controls tables, rows and columns.
Three kinds of credential
| Credential | Belongs to | Use it for | Not for |
|---|---|---|---|
Personal token atomhouse_pat_… | A person | Agents, scripts, attended automation | Bypassing that person's App Role |
App credential atomhouse_app_… | An app | Unattended backends, triggers, external services | Managing the account, workspace, roles or sites |
| Browser session cookie | The signed-in person | The console and a published site's page | Agent scripts; it also needs CSRF |
3. Install the skill
AtomHouse does not just give an agent an API key. It gives it a skill document and a set of MCP tools. The agent starts with bootstrap, then creates apps, reads data, publishes sites and manages access.
Install the skill
The skill is the instruction set and tool catalogue an agent reads. There are three ways to install it; choose one, then authorize the machine once.
Option 1: give the agent one sentence
Paste this into Claude Code, Cursor, WorkBuddy, Codex or another capable agent:
Download https://atomhouse.cloud/api/v1/skill.zip, unzip it into your skills directory, and follow INSTALL.md to install or update. When done, reply briefly: whether you are connected and what I can do next.
For the China service, use https://atomhouse.cn/api/v1/skill.zip. The agent downloads, extracts and reads the install guide; it should then tell you whether it is connected.
Option 2: install with npx, optionally pointing at an API
With Node.js installed, use the npm installer. It defaults to Claude Code; use --target for another runtime:
npx atomhouse-skill add
# Another runtime
npx atomhouse-skill add --target cursor
npx atomhouse-skill add --target codex
npx atomhouse-skill add --target dsh
# Point at a specific API / deployment (Cloud)
npx atomhouse-skill add --base-url https://atomhouse.cloud
npx atomhouse-skill login --base-url https://atomhouse.cloud
--base-url is how npx targets an API. Use the same URL for install and login. Without it, the bundled default is the China service (https://atomhouse.cn); use https://atomhouse.cloud for the international service, or your own HTTPS origin for a self-hosted instance.Option 3: download the package and install it yourself
# International service
curl -fsSL https://atomhouse.cloud/api/v1/skill.zip -o atomhouse-skill.zip
unzip atomhouse-skill.zip
# China service
curl -fsSL https://atomhouse.cn/api/v1/skill.zip -o atomhouse-skill.zip
unzip atomhouse-skill.zip
Put the extracted atomhouse/ folder in your runtime's skills directory and read INSTALL.md. The archive includes SKILL.md, the reference documents and the MCP client; no extra install script is required.
| Method | Best for | Requires |
|---|---|---|
| One sentence to the agent | First use, no command line | An agent that can download files and write its skills directory |
npx atomhouse-skill add | Node.js users who want repeatable installs | Node.js 18+; optional --base-url |
| Download and unzip | Managed distribution, offline, custom directories | Ability to extract files into a skills directory |
4. MCP service
4.1 Configure MCP manually
| Setting | Value |
|---|---|
| Endpoint | https://atomhouse.cloud/api/v1/mcp |
| Auth | Authorization: Bearer <personal token> |
| Protocol | JSON-RPC 2.0 over Streamable HTTP |
| Workspace | The workspace argument on each tools/call |
{
"mcpServers": {
"atomhouse": {
"type": "http",
"url": "https://atomhouse.cloud/api/v1/mcp",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}
4.2 Device approval when there is no token
An agent should never ask for your password. It requests a device code, you approve it in your own browser, and it polls for the result.
# Ask for a code
curl -s -X POST https://atomhouse.cloud/api/v1/auth/device \
-H 'content-type: application/json' \
-d '{"client_name":"my-agent"}'
# Open verification_uri_complete in your browser, then the agent polls:
curl -s -X POST https://atomhouse.cloud/api/v1/auth/device/token \
-H 'content-type: application/json' \
-d '{"device_code":"<device_code>","wait_seconds":25}'
The access token is shown once. Call GET /api/v1/auth/me and confirm user.email belongs to the person before doing real work.
4.3 Tools and examples
The first call is bootstrap, with no arguments:
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
"name": "bootstrap",
"arguments": {}
}}
Every later call names a workspace. A typical create call:
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{
"name": "create_app",
"arguments": {
"workspace": "acme",
"slug": "reading",
"name": "Reading Club",
"tables": [{
"name": "notes",
"columns": [
{"name":"id","type":"BIGINT","nullable":false,"auto_increment":true},
{"name":"owner_id","type":"VARCHAR","nullable":false},
{"name":"title","type":"VARCHAR","nullable":false},
{"name":"body","type":"VARCHAR","nullable":true}
],
"primary_key": ["id"]
}]
}
}}
| Tool | Purpose | Important detail |
|---|---|---|
bootstrap | Account, workspaces, roles and app summaries | No arguments |
create_app | Create a schema, tables and seed rows in one call | Workspace owner/admin only |
list_tables / describe_table | Inspect tables and columns | Filtered by the App Role; describe before writing SQL |
query | DuckDB SQL inside one app | Writes need the app admin role; no cross-app JOIN |
read_rows / insert_rows / update_rows | Row-level reads and writes | Check access before rendering |
create_model | Save a SELECT as a read-only view | Belongs to the current app |
deploy_function / create_trigger | Server-side JavaScript and triggers | App admin required; use a task for long work |
publish_site / upload_site_file | Publish static files | Publishing makes the page public; confirm first |
query_workspace | Read-only SQL across apps | Workspace owner/admin only |
4.4 Queries across apps
MCP query sees one app_<slug> schema. FROM app_other.table fails with there is no schema. A workspace owner/admin can use the read-only query_workspace tool:
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{
"name": "query_workspace",
"arguments": {
"workspace": "acme",
"sql": "SELECT o.id, c.name FROM app_shop.orders o JOIN app_crm.customers c ON c.id = o.customer_id"
}
}}
query for writes.4.5 Getting better results
- Confirm the workspace before creating an app; never let the agent guess a slug.
- If rows are per-person, ask it to narrow
memberwithset_app_rolein the same session. - Ask it to run
site_statusbefore handing over a publish link. - When it says the app is done, verify the Access and Audit pages yourself.
5. REST API
The console and published pages ultimately use REST. The complete endpoint list for an app is its rest.md; this section covers authentication, CSRF and the common resources.
5.1 Authentication and CSRF
| Caller | Authentication | Extra requirement |
|---|---|---|
| Script, agent, server | Authorization: Bearer <token> | The token belongs to the account |
| Browser console | Session cookie | x-csrf-token on every non-GET request |
| Published site | App-scoped site session | Use site SSO; never build a password form |
The CSRF value can be in either atomhouse_csrf__<app> or atomhouse_csrf. Read the scoped cookie first and fall back to the plain one; do not hard-code either name.
function csrfToken() {
const pairs = document.cookie.split('; ').map((c) => {
const at = c.indexOf('=');
return { name: at < 0 ? '' : c.slice(0, at), value: at < 0 ? '' : c.slice(at + 1) };
});
const scoped = pairs.find((c) => c.name.endsWith('atomhouse_csrf__shop'));
const plain = pairs.find((c) => c.name.endsWith('atomhouse_csrf'));
return (scoped || plain || { value: '' }).value;
}
async function api(path, options = {}) {
const method = (options.method || 'GET').toUpperCase();
const headers = { ...(options.headers || {}) };
if (method !== 'GET' && method !== 'HEAD') headers['x-csrf-token'] = csrfToken();
if (options.body) headers['content-type'] ||= 'application/json';
const res = await fetch('/api/v1' + path, {
...options, method, headers, credentials: 'include'
});
if (!res.ok) throw new Error((await res.json().catch(() => ({}))).error?.message || res.status);
return res.json();
}
5.2 Common endpoints
| Action | Method and path |
|---|---|
| Sign in for a token | POST /api/v1/auth/login |
| Current account | GET /api/v1/auth/me |
| Workspaces | GET /api/v1/workspaces |
| Apps | GET|POST /api/v1/workspaces/{ws}/apps |
| SQL in one app | POST /api/v1/workspaces/{ws}/apps/{app}/query |
| Workspace-level SQL | POST /api/v1/workspaces/{ws}/query |
| Rows | GET|POST /api/v1/workspaces/{ws}/apps/{app}/tables/{table}/rows |
| Current access | GET /api/v1/workspaces/{ws}/apps/{app}/access |
| Site status | GET /api/v1/workspaces/{ws}/apps/{app}/sites/{site} |
5.3 Read and write examples
export ATOMHOUSE_URL=https://atomhouse.cloud
export ATOMHOUSE_TOKEN='atomhouse_pat_...'
curl -s "$ATOMHOUSE_URL/api/v1/auth/me" \
-H "Authorization: Bearer $ATOMHOUSE_TOKEN"
curl -s "$ATOMHOUSE_URL/api/v1/workspaces" \
-H "Authorization: Bearer $ATOMHOUSE_TOKEN"
curl -s -X POST \
"$ATOMHOUSE_URL/api/v1/workspaces/acme/apps/shop/query" \
-H "Authorization: Bearer $ATOMHOUSE_TOKEN" \
-H 'content-type: application/json' \
-d '{"sql":"SELECT * FROM app_shop.orders ORDER BY id DESC LIMIT 20"}'
curl -s -X POST \
"$ATOMHOUSE_URL/api/v1/workspaces/acme/apps/shop/tables/orders/rows" \
-H "Authorization: Bearer $ATOMHOUSE_TOKEN" \
-H 'content-type: application/json' \
-d '{"values":{"customer_id":"c_123","amount":99.5,"status":"open"}}'
shop exposes app_shop.orders. The schema field returned by the app list is the name to use.5.4 Using the API from a page
Check access before loading data. A signed-in visitor with no App Role gets HTTP 200 and capability: null, not a 403.
const res = await fetch(
`/api/v1/workspaces/${ws}/apps/${app}/access`,
{ credentials: 'include' }
);
if (res.status === 401) return showSignIn();
const access = await res.json();
if (!access.capability) return showAskForAccess(access.error);
// now render the page and call data endpoints
res.ok as "has access" skips the ask-for-access state. Render that state first.6. Console
Open /app/. The console and MCP/REST use the same data.
6.1 Navigation
- Workspaces: switch or create one; data is isolated per workspace.
- Apps: tables, views, functions and sites.
- Data: browse rows, run SQL, inspect columns — subject to your App Role.
- Members: invite people and assign workspace roles. A workspace role is not an App Role.
- Access: review requests and choose the App Role for each approved person.
- AI: configure the workspace model and see server-side AI tools.
- Settings / Audit: workspace settings, audit history, backups and dangerous actions.
6.2 First app checklist
- Choose a workspace → Apps → New app. Use a meaningful slug such as
reading. - Create the tables with an agent or on the Data page.
- Open Access, confirm you are in
admin, and invite collaborators asmemberorreader. - Open the site tab, upload
index.htmland its assets, then publish and open the returned link. - Test the path with a second account: no access → request → approve → visible.
6.3 Members, roles and invitation codes
Members controls workspace membership; Access controls app roles. A person must be a workspace member and hold an App Role before reading that app's data.
Invitations can address an email, phone number or account id, or create a single-use code with no recipient. Treat a code as a one-time secret.
6.4 Publishing a site
A site is static files served at /site/<workspace>/<site>/. Publishing the page does not publish the data: every request still runs as the visitor and their App Role. External CDNs are usually blocked by CSP; upload assets and reference them relatively.
7. AI in your app
There are two layers: an agent using MCP to operate your account, and your page or function calling a model configured for the workspace.
7.1 Configure the model connection
Model connections are workspace resources. Configure them once under Workspace settings → AI:
- Open Workspace settings → AI.
- Click Add a model.
- Enter a name, protocol (OpenAI-compatible or Anthropic), endpoint, API key and at least one model.
- The connection is shared by the workspace; the key is never returned to the browser.
Then open the app's AI tab and choose the connection/model for this app, plus its built-in tools, external MCP servers and agent step limit. The app references the workspace connection; it does not store another key.
An app admin can configure the same app layer over MCP: call get_app_ai_config for the current selection and the available connections/models (names and model ids only; never a key), then set_app_ai_config with provider, model, builtin_tools, external MCP settings and agent_max_steps. Workspace model connections themselves remain console-only; MCP cannot add, edit, test or delete a key.
The app AI usage card is app-scoped: it shows this app's tokens, calls today and recent calls, not the workspace total or the account quota.
External MCP services support both a static bearer token and OAuth 2.1. For OAuth, click Connect OAuth in the app AI tab; the browser handles approval and returns to the app. Tokens are encrypted for this app only, with Reconnect and Clear authorization controls. An expired grant is shown on the page, and a 401 says OAuth authorization is required. External tools share the builtin_tools allowlist with host tools and can be selected in the app AI tab.
Before building an AI feature, check workspace.ai_configured from bootstrap. If it is false, stop and ask the workspace owner or admin to configure a model.
7.2 Call /ai from a page
const res = await fetch(
`/api/v1/workspaces/${ws}/apps/${app}/ai`,
{
method: 'POST',
credentials: 'include',
headers: {
'content-type': 'application/json',
'x-csrf-token': csrfToken()
},
body: JSON.stringify({
messages: [
{ role: 'system', content: 'You are a concise support assistant.' },
{ role: 'user', content: 'Summarise this feedback: the page is blank after login.' }
],
max_tokens: 800
})
}
);
const data = await res.json();
// data.text, data.usage
/ai returns text, not a schema-constrained object. If you ask for JSON, parse and validate it, retry once on failure, and keep the raw text. Do not write parsed fields into a business table without user confirmation.7.3 Long work belongs in a task
A normal function request has a 2-second default and 5-second maximum. A model can take longer. atomhouse.ai runs only inside a function task; a page waiting for a result should call /ai directly.
export default async function () {
const reply = await atomhouse.ai.chat({
messages: [{ role: 'user', content: 'Summarise this week in three themes.' }],
max_tokens: 1200
});
atomhouse.insert('summaries', { body: reply.text });
}
7.4 AI failures
| Symptom | Cause | Action |
|---|---|---|
503 with a model connection message | No model configured for the workspace | Ask a workspace owner/admin to add one in Workspace settings → AI; do not hide the error. An app admin can select it with MCP set_app_ai_config |
| Task-only error in a function | atomhouse.ai called from a normal request | Use /ai, or run the function as a task |
| Empty model reply | A reasoning model was cut off by max_tokens: 1 | Give it a real token budget |
| JSON parse failure | There is no JSON mode | Validate, retry once, keep the raw reply |
8. Errors and limits
| Error | What it means | Next step |
|---|---|---|
401 | No token, expired or revoked | Sign in or run the device flow; never use another person's token |
403 | No App Role, or workspace role too low | Ask for access, or have an owner/admin grant it |
409 | Slug exists, duplicate request, or conflicting state | Choose another slug; check whether the first request succeeded |
413 | Upload or request body too large | Compress, split, or import in batches |
422 | Invalid SQL, argument or column name | Read the message; call describe_table |
503 | Owning node unavailable, or model not configured | Read the message; do not recreate the workspace on this node |
504 | SQL timeout or busy workspace | Aggregate/narrow the query and retry |
missing x-csrf-token header | Browser write without CSRF | Read atomhouse_csrf__<app> or atomhouse_csrf |
Limits
- Uploads default to 64 MiB per request; compress large assets.
- Row pages default to 500; use
offsetor SQL aggregation. - SQL defaults to a 15-second timeout; deployments may tune it.
- Table capacity depends on the plan; writes are checked at the boundary.
- Responses can be truncated; inspect
truncatedinstead of assuming there are no more rows.
Troubleshooting order
- Read
/healthzand the error message; do not infer from the status code alone. - Call
GET /auth/meto confirm the account. - Call
bootstraporGET .../accessto confirm permissions instead of retrying blindly. - Call
describe_tablebefore guessing a column. Useapp_<slug>as the schema. - For cross-app work, split into per-app queries and merge; do not keep trying multi-schema SQL from a member account.
9. Security
- Keep tokens in a secret store or environment variable, never in SKILL.md, Git, a page, chat or a temp file.
- Never put a machine credential in a page. It bypasses row filters and is a permanent database key.
- Do not give session cookies to an agent. Agents use bearer tokens; browsers use cookies.
- Confirm what publishing makes public. A public page still runs as each visitor; data is not automatically public.
- Use least privilege. Narrow
memberbefore approving requests; do not make everyone an admin. - Do not share accounts. Per-person accounts keep audit and revocation meaningful.
10. FAQ
The agent cannot find my workspace
Ask it to call bootstrap; do not let it guess a slug. Confirm the account has joined the workspace and the token belongs to that account.
The page opens but the data is empty
Call GET .../access. If capability is null, the account has no App Role; show the ask-for-access state.
there is no schema
You probably used the app slug instead of the schema. App shop is app_shop. For cross-app work use query_workspace (owner/admin, read-only) or merge per-app results.
Reads work but writes return 403
The App Role may allow reading but not writing, or a cross-origin request may have dropped the cookie. Check the role and use relative /api/v1/... paths.
How do I update a published site?
Upload the changed files again and run site_status, checking missing_files and invalid_api_calls. Hard-refresh the browser if it shows an older asset.
reference/ folder. Each app's full REST surface is linked from its rest.md.