Skip to content

API Reference

The SAM API runs on a Cloudflare Worker at api.{domain}. All authenticated endpoints require a valid BetterAuth session cookie.

Start GitHub OAuth flow. Redirects to GitHub for authorization.

End the current session.

Returns the current authenticated session and user info.

Create a new workspace.

Body:

{
"installationId": "12345",
"repository": "owner/repo",
"branch": "main",
"vmSize": "medium",
"displayName": "My Workspace"
}

List all workspaces for the authenticated user.

Get workspace details including status, node info, and URLs.

Stop a running workspace. Powers off the VM if no other workspaces are using the node.

Restart a stopped or errored workspace. Provisions a new VM and recreates the container.

Permanently delete a workspace and clean up all associated resources.

Get the provisioning progress log for a workspace.

Create a new Claude Code agent session in a workspace.

List active agent sessions for a workspace.

POST /api/workspaces/:id/agent-sessions/:sessionId/stop

Section titled “POST /api/workspaces/:id/agent-sessions/:sessionId/stop”

Stop a running agent session.

List all nodes for the authenticated user.

Get node details including health status and hosted workspaces.

Stop a running node. All workspaces on the node must be stopped first.

Delete a node and clean up DNS records and Hetzner resources.

Add or update a credential (cloud provider token or agent API key).

Body:

{
"provider": "hetzner",
"credentialType": "cloud-provider",
"token": "your-api-token"
}

List all credentials for the authenticated user (tokens are not returned).

Delete a stored credential.

List GitHub App installations for the authenticated user.

List repositories accessible through a GitHub App installation.

Post-installation redirect handler. Records the installation and redirects to Settings.

List all projects for the authenticated user.

Create a new project linked to a GitHub repository.

Get project details.

Submit a task for autonomous execution.

Body:

{
"message": "Fix the login button on the settings page"
}

Generate a short-lived JWT for WebSocket terminal access.

Body:

{
"workspaceId": "ws-abc123"
}

Response:

{
"token": "eyJhbG...",
"workspaceUrl": "wss://ws-abc123.example.com"
}

Health check endpoint. Returns status and version info.

JSON Web Key Set for JWT verification by VM Agents.

Download the VM Agent binary. Query params: os (linux), arch (amd64, arm64).