Provision Flow API
The provision flow creates a tenant record and triggers fleet provisioning. This is the sequence that runs when the onboarding wizard's Deploy step fires — it creates the tenant in Supabase, queues provisioning, and returns the tenant record. From there, provisioning runs asynchronously and the Fleet API reflects status as steps complete.
POST /api/tenants
Creates a new tenant and starts the provisioning pipeline. Admin-only — requires M2M platform auth. Called by the onboarding wizard; not intended for direct use by fleet users.
Request
POST /api/tenants
X-Platform-Token: <token>
Content-Type: application/json
{
"tenantId": "tenant_acme_01",
"name": "Acme Fleet",
"plan": "pro",
"clerkOrgId": "org_abc123",
"templateId": "standard-7-agent"
}Fields
| Field | Required | Description |
|---|---|---|
tenantId | Yes | Unique tenant identifier. Snake-case, globally unique. |
name | Yes | Human-readable tenant name shown in dashboard. |
plan | No | Billing plan. Defaults to free. |
clerkOrgId | No | Clerk organisation ID for org-scoped access. Omit for personal tenants. |
templateId | No | Fleet template to provision. Defaults to standard-7-agent. |
Response — 200
{
"ok": true,
"tenant": {
"tenant_id": "tenant_acme_01",
"name": "Acme Fleet",
"plan": "pro",
"status": "pending",
"template_id": "standard-7-agent",
"clerk_org_id": "org_abc123",
"repos": [],
"agent_specs": [],
"created_at": "2026-03-18T09:00:00.000Z",
"updated_at": "2026-03-18T09:00:00.000Z"
}
}GET /api/tenants
Lists tenants. Admin-only. Supports filtering by status, plan, andclerkOrgId. Used by the platform admin dashboard — not exposed to fleet users.
Provisioning pipeline
After the tenant record is created with status: "pending", the provisioning pipeline picks it up and executes these steps in order:
- vm_create — spin up GCP VM in the target zone (e2-standard-2,
europe-west2-b) - workspace_bootstrap — create agent workspace directories, clone repos, install dependencies
- agent_config — write AGENTS.md, SOUL.md, IDENTITY.md, and workspace files for each agent from the template
- gateway_start — start the OpenClaw gateway process, verify it's listening
- connectivity_check — verify Discord channel connections and Mission Control reachability
- complete — update tenant status to
active, writedashboardUrl
Each step writes to the provisioning_log table with status, message, and duration. Poll GET /api/fleet to watch progress in real time — the onboarding wizard streams this.
Error handling
If any provisioning step fails, the tenant status moves to errorand the failing step appears in the provisioning log withstatus: "failed" and an error message. Provisioning does not automatically retry — a failed provision requires manual intervention or re-running the wizard.
See also
- Fleet API — polling provisioning progress and reading fleet state
- Provisioning Pipeline — the full architecture behind these steps
- Onboarding Wizard — the user-facing flow that calls this API