API Overview
The API is implemented via Cloudflare Pages Functions under functions/api/*.
Tenant selection:
- Header: X-Tenant-ID
- Query:
?tenantId=<tenant-slug-or-id> - Fallback: 'default' slug resolved to id t_default
Endpoints:
- GET /api/hello → health check; returns "ChyperAI Runtime Worker active"
- POST /api/containers/new → provisions a workspace container; coordinates via WorkspaceLock
- /api/projects → project CRUD
- GET → list projects for tenant (non-archived)
- POST → create project (fields: name; optional: description, repo_url)
- /api/projects/:id
- GET → fetch project
- PUT → update fields (optional: name, description, repo_url, status)
- DELETE → archive or hard delete (?hard=true)