Get started
Deploy a site (SaaS)
Sites are full, isolated web apps — frontend, server, database, storage, and a live URL. An agent usually builds and ships them for you; this is the API underneath, which you can also call directly.
The model
Each site is its own isolated cloud app served at <slug>.commandagi.app. You ship a server module (an ES module whose default export is { fetch(request, env, ctx) } — SSR, API routes, anything dynamic) and/or static files. Env vars, a managed SQL database, blob/KV storage, and custom domains attach on demand and are wired into the app automatically.
1. Create a site
# Create a site → it gets a slug and a live URL.
curl https://api.commandagi.com/sites \
-H "Authorization: Bearer $COMMANDAGI_API_KEY" \
-H "content-type: application/json" \
-d '{ "name": "My app", "slug": "my-app" }'
# → { "site": { "id": "…", "slug": "my-app", "url": "https://my-app.commandagi.app" } }2. Deploy a build
Build your app in a machine (an agent does this for you with the deploy_site tool), then push the bundled server module and assets. Every deploy ships in seconds and is recorded in the site's history.
# Deploy a build: a server module (SSR / API routes) and/or static files.
curl https://api.commandagi.com/sites/$SITE_ID/deploy \
-H "Authorization: Bearer $COMMANDAGI_API_KEY" \
-H "content-type: application/json" \
-d '{
"entry": "export default { async fetch(req, env){ return new Response(\"hi from \" + env.GREETING) } }",
"files": [{ "path": "index.html", "content": "<h1>Hello</h1>" }],
"spaFallback": true
}'3. Env vars & secrets
Persisted across deploys; secrets are encrypted at rest and write-only. Redeploy to apply.
# Persistent env vars + secrets (read via env.KEY in the server module).
curl -X PUT https://api.commandagi.com/sites/$SITE_ID/env \
-H "Authorization: Bearer $COMMANDAGI_API_KEY" \
-H "content-type: application/json" \
-d '{ "key": "STRIPE_KEY", "value": "sk_live_…", "secret": true }'4. Database, storage & domains
Provision a managed resource and it's bound into the app — a D1 SQL database as env.DB, an R2 bucket as env.BLOB, or a KV store as env.KV. Link a custom domain (with automatic TLS) via POST /sites/$SITE_ID/domains.
# Attach a managed database (env.DB), blob bucket (env.BLOB), or KV store (env.KV).
curl https://api.commandagi.com/sites/$SITE_ID/resources \
-H "Authorization: Bearer $COMMANDAGI_API_KEY" \
-H "content-type: application/json" \
-d '{ "kind": "d1" }' # d1 | r2 | kvOr just ask an agent
The whole flow is available to agents as tools — create_site, deploy_site, set_site_env, add_site_resource, add_site_domain. The simplest path is to tell an agent what to build: it writes the app, provisions what it needs, and deploys.