API Reference
Projects
Get Project
- API Name: Get Project by ID
- API Route:
GET /api/v1/projects/[id] - Request:
- Params:
id(string) — Project ID - Auth: Session required, permission:
project.view
- Params:
- What it does: Fetches a single project by its ID. Validates that the authenticated user has
project.viewpermission for that project. Also captures a PostHog analytics event. - Returns: The project object (
{ id, projectName, cloudProviderId, description, ... }) on success.404if not found.
Update Project
- API Name: Update Project
- API Route:
PATCH /api/v1/projects/[id] - Request:
- Params:
id(string) — Project ID - Body:
- Params:
json
{
"project_name": "string (optional)",
"cloud_provider_id": "number (optional)",
"description": "string (optional)"
}- What it does: Updates the name, cloud provider, or description of an existing project. Validates the body against
UpdateProjectSchema. Logs the update to the activity stream and captures a PostHog event. - Returns: The updated project object on success.
404if not found.400if validation fails.
Delete Project
- API Name: Delete Project
- API Route:
DELETE /api/v1/projects/[id] - Request:
- Params:
id(string) — Project ID - Auth: Session required, permission:
project.delete
- Params:
- What it does: Permanently deletes a project. Validates that the project exists and that the user has
project.deletepermission. Logs the deletion to the activity stream and captures a PostHog event. - Returns: The deleted project object on success.
404if not found.
List Workspaces
- API Name: List Workspaces for Project
- API Route:
GET /api/v1/projects/[id]/workspaces - Request:
- Params:
id(string) — Project ID - Auth: Session required. Admins (
super_user,admin) see all workspaces; regular users see only their accessible workspaces.
- Params:
- What it does: Lists all workspaces belonging to a specific project. Applies role-based filtering: admins see everything, regular users see only workspaces they have access to.
- Returns: Array of workspace objects.
Create Workspace
- API Name: Create Workspace
- API Route:
POST /api/v1/projects/[id]/workspaces - Request:
- Params:
id(string) — Project ID - Body:
- Params:
json
{
"workspace_name": "string (required)"
}- What it does: Creates a new workspace under the specified project. Assigns the creator's global role to the workspace. Logs to the activity stream and captures a PostHog event.
- Returns:
201with the created workspace object.400if validation fails.403if user has no role assigned.
Get Workspace
- API Name: Get Workspace by ID
- API Route:
GET /api/v1/projects/[id]/workspaces/[workspace_id] - Request:
- Params:
id(string) — Project ID,workspace_id(string) — Workspace ID
- Params:
- What it does: Fetches a single workspace by its ID within a project. No authentication required for this endpoint.
- Returns: The workspace object on success.
404if not found.
Update Workspace
- API Name: Update Workspace
- API Route:
PATCH /api/v1/projects/[id]/workspaces/[workspace_id] - Request:
- Params:
id(string) — Project ID,workspace_id(string) — Workspace ID - Body:
- Params:
json
{
"workspace_name": "string (optional)",
"iacTool": "terraform | opentofu (optional)"
}- What it does: Updates the name or IaC tool of an existing workspace. Validates the body against
UpdateWorkspaceSchema. Logs the update to the activity stream. - Returns: The updated workspace object.
404if not found.400if validation fails.
Delete Workspace
- API Name: Delete Workspace
- API Route:
DELETE /api/v1/projects/[id]/workspaces/[workspace_id] - Request:
- Params:
id(string) — Project ID,workspace_id(string) — Workspace ID - Auth: Session required, permission:
workspace.delete
- Params:
- What it does: Permanently deletes a workspace. Validates existence and user permission before deleting. Logs the deletion to the activity stream.
- Returns: The deleted workspace object.
404if not found.