Cloud World Model API Key Self-Service API
Bootstrap and self-service path for obtaining API keys without direct database access. ## Onboarding Flow for External Clients (e.g. Canvas Cloud AI) 1. **Platform operator** runs the bootstrap script once: ``` npx tsx scripts/bootstrap-admin-key.ts ``` This prints a one-time admin key. Store it as a secret immediately. 2. **Admin** mints a scoped, time-limited registration token for the external client: ```http POST /register-tokens Authorization: Bearer Content-Type: application/json { "name": "canvas-cloud-ai", "scopes": ["read","write"], "expiresAt": "2026-06-01T00:00:00Z" } ``` 3. **External client** exchanges the token once (manually or via a one-off script): ```http POST /keys/register Content-Type: application/json { "token": "", "name": "canvas-cloud-ai-prod" } ``` The response contains a permanent API key. Store it as an environment secret. 4. The token is **burned on use** and can never be reused. All subsequent API calls use the permanent key directly.