### Verify Lapdev CLI Installation Source: https://github.com/lapce/lapdev/blob/main/docs/how-to-guides/local-development-with-devbox.md Checks if the Lapdev CLI is installed and ready for use by displaying its version. ```bash lapdev --version ``` -------------------------------- ### Install Lapdev CLI on Linux or macOS Source: https://github.com/lapce/lapdev/blob/main/docs/how-to-guides/local-development-with-devbox.md Installs the Lapdev CLI by downloading a script. Re-run to upgrade or use --version to pin a specific build. ```bash curl -fsSL https://get.lap.dev/lapdev-cli.sh | bash ``` -------------------------------- ### Install Lapdev CLI Source: https://context7.com/lapce/lapdev/llms.txt Installs the CLI tool for Linux, macOS, or Windows to enable local development and traffic interception. ```bash # Linux or macOS curl -fsSL https://get.lap.dev/lapdev-cli.sh | bash # Windows PowerShell (elevated) irm https://get.lap.dev/lapdev-cli.ps1 | iex # Verify installation lapdev --version ``` -------------------------------- ### Get Available Machine Types Source: https://context7.com/lapce/lapdev/llms.txt Fetch a list of all available machine types that can be provisioned for workspaces, including their specifications. ```bash # Get available machine types curl -X GET "https://app.lap.dev/api/v1/machine_types" \ -b cookies.txt ``` -------------------------------- ### Get Project Details Source: https://context7.com/lapce/lapdev/llms.txt Fetch detailed information about a specific project using its unique project ID. ```bash # Get project details curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}" \ -b cookies.txt ``` -------------------------------- ### Install Lapdev Kube Manager Source: https://context7.com/lapce/lapdev/llms.txt Deploys the operator to your Kubernetes cluster using a unique token. Verify the installation by checking the status of the pods in the lapdev namespace. ```bash # Install using the generated cluster token from Lapdev dashboard kubectl apply -f "https://get.lap.dev/install/lapdev-kube-manager.yaml?token=" # Verify the installation kubectl get pods -n lapdev # Expected output: # NAME READY STATUS RESTARTS AGE # lapdev-kube-manager-xxxxx-xxxxx 1/1 Running 0 30s ``` -------------------------------- ### Install Lapdev CLI on Windows PowerShell Source: https://github.com/lapce/lapdev/blob/main/docs/how-to-guides/local-development-with-devbox.md Installs the Lapdev CLI using PowerShell. Run in an elevated window if needed. Restart your shell for the PATH changes to take effect. ```powershell irm https://get.lap.dev/lapdev-cli.ps1 | iex ``` -------------------------------- ### Get Project Prebuilds Source: https://context7.com/lapce/lapdev/llms.txt Retrieve a list of prebuilds associated with a specific project. Prebuilds are cached workspace images for faster startup. ```bash # Get project prebuilds curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}/prebuilds" \ -b cookies.txt ``` ```json # Response: # [ # { # "id": "prebuild-uuid", # "project_id": "project-uuid", # "created_at": "2024-01-15T10:30:00Z", # "branch": "main", # "commit": "abc123def456", # "status": "Ready" # } # ] ``` -------------------------------- ### Install Lapdev Kube Manager Source: https://github.com/lapce/lapdev/blob/main/docs/how-to-guides/connect-your-kubernetes-cluster.md Applies the required manifests to the cluster to enable Lapdev management. Replace the token placeholder with the specific cluster token provided in the dashboard. ```bash kubectl apply -f "https://get.lap.dev/install/lapdev-kube-manager.yaml?token=" ``` -------------------------------- ### Get Authentication Providers Source: https://context7.com/lapce/lapdev/llms.txt List the available authentication providers that can be used for user authentication within the LapDev platform. ```bash # Get available authentication providers curl -X GET "https://app.lap.dev/api/v1/auth_providers" ``` -------------------------------- ### Get Project Branches Source: https://context7.com/lapce/lapdev/llms.txt Retrieve a list of available branches for a given project directly from the Git provider. ```bash # Get project branches (from Git provider) curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}/branches" \ -b cookies.txt ``` -------------------------------- ### Get Configured Hostnames Source: https://context7.com/lapce/lapdev/llms.txt Retrieve the list of hostnames configured for accessing the LapDev service across different regions. ```bash # Get configured hostnames curl -X GET "https://app.lap.dev/api/v1/hostnames" \ -b cookies.txt ``` -------------------------------- ### Get Project Environment Variables Source: https://context7.com/lapce/lapdev/llms.txt Retrieve the environment variables configured for a project. These variables are available within the workspace environment. ```bash # Get project environment variables curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}/env" \ -b cookies.txt ``` ```json # Response: [["NODE_ENV", "development"], ["DEBUG", "true"]] ``` -------------------------------- ### Get Cluster Info Source: https://context7.com/lapce/lapdev/llms.txt Retrieve general information about the LapDev cluster, such as its status and configuration details. ```bash # Get cluster info curl -X GET "https://app.lap.dev/api/v1/cluster_info" \ -b cookies.txt ``` -------------------------------- ### GET /api/private/session Source: https://context7.com/lapce/lapdev/llms.txt Initiates a new session for browser-based clients, returning a session cookie. ```APIDOC ## GET /api/private/session ### Description Initiates a new session for browser-based clients. ### Method GET ### Endpoint https://app.lap.dev/api/private/session ### Response #### Success Response (200) - **cookie** (string) - Session cookie for subsequent requests. ``` -------------------------------- ### Get Devbox Session Information Source: https://context7.com/lapce/lapdev/llms.txt Retrieves current session details using Bearer token authentication. ```bash curl -X GET "https://app.lap.dev/api/v1/devbox/whoami" \ -H "Authorization: Bearer v4.local.your-cli-token" ``` -------------------------------- ### Admin: Get Workspace Hosts Source: https://context7.com/lapce/lapdev/llms.txt Retrieve a list of all workspace hosts currently registered within the cluster. This is an administrative endpoint. ```bash # Admin: Get workspace hosts curl -X GET "https://app.lap.dev/api/v1/admin/workspace_hosts" \ -b cookies.txt ``` -------------------------------- ### Get Workspace Ports Source: https://context7.com/lapce/lapdev/llms.txt Retrieve a list of ports configured for a specific workspace, including their shared and public visibility status. ```bash # Get workspace ports curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces/{workspace_name}/ports" \ -b cookies.txt ``` ```json # Response: # [ # { # "port": 3000, # "shared": false, # "public": false, # "label": "Frontend" # }, # { # "port": 8080, # "shared": true, # "public": false, # "label": "API Server" # } # ] ``` -------------------------------- ### Forwarding Tracestate Headers in JavaScript Source: https://github.com/lapce/lapdev/blob/main/docs/core-concepts/architecture/branch-environment-architecture.md Example of passing incoming request headers to downstream HTTP calls using Axios to ensure tracestate propagation. ```javascript // Forward all incoming headers to downstream services const response = await axios.get('http://other-service:8080/api', { headers: request.headers // This includes the tracestate header }); ``` -------------------------------- ### Create New Project Source: https://context7.com/lapce/lapdev/llms.txt Create a new project by providing its name, repository URL, and the desired machine type ID. This defines the configuration for creating workspaces. ```bash # Create a new project curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/projects" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "name": "My Application", "repo_url": "https://github.com/myorg/myapp", "machine_type_id": "machine-type-uuid" }' ``` -------------------------------- ### Create New Prebuild Source: https://context7.com/lapce/lapdev/llms.txt Initiate the creation of a new prebuild for a specified branch of a project. This process compiles and caches the workspace image. ```bash # Create a new prebuild curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}/prebuilds" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{"branch": "main"}' ``` -------------------------------- ### Build and push all images via helper script Source: https://github.com/lapce/lapdev/blob/main/pkg/kube-container/README.md Execute the build script to automate building, tagging, and pushing images based on hard-coded references in the API source. ```bash ./pkg/kube-container/build_and_push.sh # optional overrides: # --owner lapdev # must match the repo constants # --registry ghcr.io # must match the repo constants ``` -------------------------------- ### Build Lapdev service images with Podman Source: https://github.com/lapce/lapdev/blob/main/pkg/kube-container/README.md Use the --target flag to select specific service binaries from the shared Dockerfile. ```bash # Lapdev API podman build \ -f pkg/kube-container/Dockerfile \ --target lapdev-api \ -t ghcr.io/lapdev/lapdev-api:0.1.0 \ . # Kube manager podman build \ -f pkg/kube-container/Dockerfile \ --target kube-manager \ -t ghcr.io/lapdev/lapdev-kube-manager:0.1.0 \ . # Sidecar proxy podman build \ -f pkg/kube-container/Dockerfile \ --target kube-sidecar-proxy \ -t ghcr.io/lapdev/lapdev-kube-sidecar-proxy:0.1.0 \ . ``` -------------------------------- ### GET /api/private/me Source: https://context7.com/lapce/lapdev/llms.txt Retrieves information about the currently authenticated user. ```APIDOC ## GET /api/private/me ### Description Retrieves the profile information of the currently authenticated user. ### Method GET ### Endpoint https://app.lap.dev/api/private/me ### Response #### Success Response (200) - **id** (string) - User UUID - **email** (string) - User email address - **name** (string) - User full name - **current_organization** (string) - Organization UUID - **avatar_url** (string) - URL to user avatar ``` -------------------------------- ### Conceptual Resource Comparison Source: https://github.com/lapce/lapdev/blob/main/docs/core-concepts/architecture/branch-environment-architecture.md Comparison of pod counts between standard environments and branch environments. ```text 10 developers × 100 services each = 1000 pods total Every developer runs a complete copy of all services ``` ```text Shared environment: 100 services (shared by everyone) + 10 developers × 2 modified services each = 20 branched services Total: 120 pods ``` -------------------------------- ### GET /api/private/session/authorize Source: https://context7.com/lapce/lapdev/llms.txt Authorizes a session using an OAuth callback code and state token. ```APIDOC ## GET /api/private/session/authorize ### Description Authorizes a session using an OAuth callback. ### Method GET ### Endpoint https://app.lap.dev/api/private/session/authorize ### Parameters #### Query Parameters - **code** (string) - Required - OAuth authorization code - **state** (string) - Required - State token for CSRF protection ``` -------------------------------- ### Prebuild Management Source: https://context7.com/lapce/lapdev/llms.txt Endpoints for managing workspace prebuilds to optimize creation time. ```APIDOC ## POST /organizations/{org_id}/projects/{project_id}/prebuilds ### Description Creates a new prebuild for a specific branch. ### Method POST ### Endpoint https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}/prebuilds ### Parameters #### Request Body - **branch** (string) - Required - The branch name to prebuild ``` -------------------------------- ### List All Projects Source: https://context7.com/lapce/lapdev/llms.txt Retrieve a list of all projects within a specified organization. The response includes project details such as ID, name, repository URL, and creation timestamp. ```bash # List all projects in organization curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/projects" \ -b cookies.txt ``` ```json # Response: # [ # { # "id": "project-uuid", # "name": "My Application", # "repo_url": "https://github.com/myorg/myapp", # "repo_name": "myapp", # "machine_type": "machine-type-uuid", # "created_at": "2024-01-15T10:30:00Z" # } # ] ``` -------------------------------- ### PortMappingOverride Struct Source: https://context7.com/lapce/lapdev/llms.txt Defines an override for port mappings when starting a workload intercept. If `local_port` is `None`, the `workload_port` is used. ```rust pub struct PortMappingOverride { pub workload_port: u16, pub local_port: Option, // Uses workload_port if None } ``` -------------------------------- ### Manage Workspaces Source: https://context7.com/lapce/lapdev/llms.txt Endpoints for creating, listing, and controlling the lifecycle of development workspaces. ```bash curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "project_id": "project-uuid", "branch": "feature/my-feature", "machine_type_id": "machine-type-uuid" }' ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces" \ -b cookies.txt ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces/{workspace_name}" \ -b cookies.txt ``` ```bash curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces/{workspace_name}/start" \ -b cookies.txt ``` ```bash curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces/{workspace_name}/stop" \ -b cookies.txt ``` ```bash curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces/{workspace_name}/rebuild" \ -b cookies.txt ``` ```bash curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces/{workspace_name}/pin" \ -b cookies.txt ``` ```bash curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/workspaces/{workspace_name}/unpin" \ -b cookies.txt ``` -------------------------------- ### Create Machine Type (Admin) Source: https://context7.com/lapce/lapdev/llms.txt Registers a new machine type configuration for the platform. ```bash curl -X POST "https://app.lap.dev/api/v1/admin/machine_types" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "name": "Large", "cpu": 4, "memory": 8192 }' ``` -------------------------------- ### Visualize App Catalog Workflow Source: https://github.com/lapce/lapdev/blob/main/docs/core-concepts/app-catalog.md A diagram representing the flow from the source cluster to the App Catalog and subsequent environments. ```text Source Cluster (Production/Staging) ↓ App Catalog (Blueprint) ↓ Multiple Environments (Personal/Shared/Branch) ``` -------------------------------- ### Connect Devbox CLI to Lapdev Source: https://github.com/lapce/lapdev/blob/main/docs/how-to-guides/local-development-with-devbox.md Establishes a secure connection between your local machine and Lapdev using the Devbox CLI. ```bash lapdev devbox connect ``` -------------------------------- ### Manage Organizations Source: https://context7.com/lapce/lapdev/llms.txt Endpoints for creating, updating, and managing organization members and settings. ```bash curl -X POST "https://app.lap.dev/api/v1/organizations" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{"name": "My Development Team"}' ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/members" \ -b cookies.txt ``` ```bash curl -X PUT "https://app.lap.dev/api/v1/organizations/{org_id}/name" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{"name": "Renamed Team"}' ``` ```bash curl -X PUT "https://app.lap.dev/api/v1/organizations/{org_id}/auto_start_stop" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "auto_start": true, "auto_stop": true, "allow_workspace_change_auto_start": false, "allow_workspace_change_auto_stop": false }' ``` ```bash curl -X POST "https://app.lap.dev/api/v1/organizations/{org_id}/invitations" \ -b cookies.txt ``` ```bash curl -X PUT "https://app.lap.dev/api/v1/join/{invitation_id}" \ -b cookies.txt ``` ```bash curl -X PUT "https://app.lap.dev/api/v1/organizations/{org_id}/members/{user_id}" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{"role": "Admin"}' ``` ```bash curl -X DELETE "https://app.lap.dev/api/v1/organizations/{org_id}/members/{user_id}" \ -b cookies.txt ``` ```bash curl -X DELETE "https://app.lap.dev/api/v1/organizations/{org_id}" \ -b cookies.txt ``` -------------------------------- ### DevboxInterceptRpc Interface Definition Source: https://context7.com/lapce/lapdev/llms.txt Defines the RPC methods for managing workload traffic interception. It allows starting and stopping intercepts for specific workloads. ```rust // DevboxInterceptRpc trait - Control intercepts #[tarpc::service] pub trait DevboxInterceptRpc { /// Start intercepting traffic for a workload async fn start_workload_intercept( workload_id: Uuid, port_mappings: Vec, ) -> Result; /// Stop an active intercept async fn stop_workload_intercept(intercept_id: Uuid) -> Result<(), String>; } ``` -------------------------------- ### Connect to Devbox Source: https://context7.com/lapce/lapdev/llms.txt Establishes a persistent connection to the cluster for traffic interception and DNS resolution. Running with sudo is recommended for automatic hosts file updates. ```bash # Connect to Lapdev devbox (auto-login if needed) lapdev devbox connect # Connect with custom API host lapdev devbox connect --api-host app.lap.dev # Run with sudo for automatic hosts file updates (recommended) sudo -E lapdev devbox connect # Expected connection output: # Connecting to Lapdev devbox... # WebSocket connection established # Connected as developer@example.com (macbook-pro) # Session expires: 2024-02-15 14:30:00 UTC # Connected and ready # Press Ctrl+C to disconnect ``` -------------------------------- ### Connect to Devbox RPC Source: https://context7.com/lapce/lapdev/llms.txt Establishes a WebSocket connection for bidirectional RPC communication between the CLI and the server. ```javascript // WebSocket connection to Devbox RPC endpoint const ws = new WebSocket('wss://app.lap.dev/api/v1/kube/devbox/rpc'); // Add authentication header ws.headers = { 'Authorization': 'Bearer v4.local.your-cli-token' }; ``` -------------------------------- ### Admin: Create Workspace Host Source: https://context7.com/lapce/lapdev/llms.txt Register a new workspace host within the cluster. Requires specifying the host's network address and its associated region. This is an administrative endpoint. ```bash # Admin: Create workspace host curl -X POST "https://app.lap.dev/api/v1/admin/workspace_hosts" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "host": "worker-1.cluster.local", "region": "us-west-2" }' ``` -------------------------------- ### Authenticate Lapdev CLI Source: https://context7.com/lapce/lapdev/llms.txt Handles OAuth authentication and manages session credentials. Credentials are stored in the system keychain. ```bash # Login to Lapdev (opens browser for authentication) lapdev login --api-host app.lap.dev # Optionally specify a custom device name lapdev login --device-name "macbook-pro-work" # Check current session info lapdev whoami # Expected output: # User ID: 550e8400-e29b-41d4-a716-446655440000 # Email: developer@example.com # Organization: my-org # Device: macbook-pro-work # Logout and remove stored credentials lapdev logout ``` -------------------------------- ### ServiceInfo Struct Source: https://context7.com/lapce/lapdev/llms.txt Represents service discovery information, including the service name, namespace, and a list of its ports. ```rust // Service discovery pub struct ServiceInfo { pub name: String, pub namespace: String, pub ports: Vec, } ``` -------------------------------- ### Manage Usage and Audit Logs Source: https://context7.com/lapce/lapdev/llms.txt Retrieves organization-level usage statistics, audit logs, and quota settings. Requires enterprise licensing. ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/usage?start=2024-01-01&end=2024-01-31&page_size=50&page=1" \ -b cookies.txt ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/audit_logs?start=2024-01-01&end=2024-01-31&page_size=50&page=1" \ -b cookies.txt ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/quota" \ -b cookies.txt ``` ```bash curl -X PUT "https://app.lap.dev/api/v1/organizations/{org_id}/quota" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "kind": "running_workspaces", "org_quota": 100, "default_user_quota": 10 }' ``` -------------------------------- ### DevboxEnvironmentInfo Struct Source: https://context7.com/lapce/lapdev/llms.txt Contains details about a Devbox environment, such as its ID, name, associated cluster, and namespace. ```rust // Environment info pub struct DevboxEnvironmentInfo { pub environment_id: Uuid, pub environment_name: String, pub cluster_name: String, pub namespace: String, } ``` -------------------------------- ### Workspace Management API Source: https://context7.com/lapce/lapdev/llms.txt APIs for creating, managing, and controlling development workspaces within Kubernetes environments. ```APIDOC ## REST API - Workspace Management ### POST /api/v1/organizations/{org_id}/workspaces #### Description Creates a new development workspace. #### Method POST #### Endpoint /api/v1/organizations/{org_id}/workspaces #### Path Parameters - **org_id** (string) - Required - The ID of the organization. #### Request Body - **project_id** (string) - Required - The ID of the project. - **branch** (string) - Required - The branch of the repository to use. - **machine_type_id** (string) - Required - The ID of the machine type to use for the workspace. #### Request Example ```json { "project_id": "project-uuid", "branch": "feature/my-feature", "machine_type_id": "machine-type-uuid" } ``` ### GET /api/v1/organizations/{org_id}/workspaces #### Description Lists all workspaces within an organization. #### Method GET #### Endpoint /api/v1/organizations/{org_id}/workspaces #### Path Parameters - **org_id** (string) - Required - The ID of the organization. #### Response (200) - **name** (string) - The name of the workspace. - **repo_url** (string) - The URL of the repository. - **repo_name** (string) - The name of the repository. - **branch** (string) - The branch of the repository. - **commit** (string) - The commit hash. - **status** (string) - The current status of the workspace (e.g., "Running"). - **machine_type** (string) - The ID of the machine type used. - **services** (array) - A list of services running in the workspace. - **created_at** (string) - The timestamp when the workspace was created. - **hostname** (string) - The hostname of the workspace. - **pinned** (boolean) - Indicates if the workspace is pinned (prevents auto-stop). #### Response Example ```json [ { "name": "workspace-abc123", "repo_url": "https://github.com/org/repo", "repo_name": "my-repo", "branch": "main", "commit": "abc123def456", "status": "Running", "machine_type": "machine-type-uuid", "services": [], "created_at": "2024-01-15T10:30:00Z", "hostname": "app.lap.dev", "pinned": false } ] ``` ### GET /api/v1/organizations/{org_id}/workspaces/{workspace_name} #### Description Retrieves details for a specific workspace. #### Method GET #### Endpoint /api/v1/organizations/{org_id}/workspaces/{workspace_name} #### Path Parameters - **org_id** (string) - Required - The ID of the organization. - **workspace_name** (string) - Required - The name of the workspace. ### POST /api/v1/organizations/{org_id}/workspaces/{workspace_name}/start #### Description Starts a stopped workspace. #### Method POST #### Endpoint /api/v1/organizations/{org_id}/workspaces/{workspace_name}/start #### Path Parameters - **org_id** (string) - Required - The ID of the organization. - **workspace_name** (string) - Required - The name of the workspace to start. ### POST /api/v1/organizations/{org_id}/workspaces/{workspace_name}/stop #### Description Stops a running workspace. #### Method POST #### Endpoint /api/v1/organizations/{org_id}/workspaces/{workspace_name}/stop #### Path Parameters - **org_id** (string) - Required - The ID of the organization. - **workspace_name** (string) - Required - The name of the workspace to stop. ### POST /api/v1/organizations/{org_id}/workspaces/{workspace_name}/rebuild #### Description Rebuilds a workspace from the latest commit. #### Method POST #### Endpoint /api/v1/organizations/{org_id}/workspaces/{workspace_name}/rebuild #### Path Parameters - **org_id** (string) - Required - The ID of the organization. - **workspace_name** (string) - Required - The name of the workspace to rebuild. ### POST /api/v1/organizations/{org_id}/workspaces/{workspace_name}/pin #### Description Pins a workspace, preventing it from being automatically stopped. #### Method POST #### Endpoint /api/v1/organizations/{org_id}/workspaces/{workspace_name}/pin #### Path Parameters - **org_id** (string) - Required - The ID of the organization. - **workspace_name** (string) - Required - The name of the workspace to pin. ### POST /api/v1/organizations/{org_id}/workspaces/{workspace_name}/unpin #### Description Unpins a workspace, allowing it to be automatically stopped. #### Method POST #### Endpoint /api/v1/organizations/{org_id}/workspaces/{workspace_name}/unpin #### Path Parameters - **org_id** (string) - Required - The ID of the organization. - **workspace_name** (string) - Required - The name of the workspace to unpin. ``` -------------------------------- ### POST /api/v1/auth/cli/generate-token Source: https://context7.com/lapce/lapdev/llms.txt Generates a CLI authentication token for a specific device. ```APIDOC ## POST /api/v1/auth/cli/generate-token ### Description Generates a 30-day valid CLI authentication token. ### Method POST ### Endpoint https://app.lap.dev/api/v1/auth/cli/generate-token ### Parameters #### Request Body - **session_id** (string) - Required - Unique session UUID - **device_name** (string) - Required - Name of the device ``` -------------------------------- ### Delete Project Source: https://context7.com/lapce/lapdev/llms.txt Remove a project and all its associated configurations from the organization. This action is irreversible. ```bash # Delete project curl -X DELETE "https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}" \ -b cookies.txt ``` -------------------------------- ### Delete Prebuild Source: https://context7.com/lapce/lapdev/llms.txt Remove a specific prebuild from a project. This is useful for cleaning up old or unnecessary cached images. ```bash # Delete a prebuild curl -X DELETE "https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}/prebuilds/{prebuild_id}" \ -b cookies.txt ``` -------------------------------- ### Project Management Source: https://context7.com/lapce/lapdev/llms.txt Endpoints for managing projects, including creation, listing, environment variables, and deletion. ```APIDOC ## POST /organizations/{org_id}/projects ### Description Creates a new project. ### Method POST ### Endpoint https://app.lap.dev/api/v1/organizations/{org_id}/projects ### Parameters #### Request Body - **name** (string) - Required - Project name - **repo_url** (string) - Required - Repository URL - **machine_type_id** (string) - Required - Machine type UUID --- ## GET /organizations/{org_id}/projects/{project_id}/env ### Description Retrieves environment variables for a project. ### Method GET ### Endpoint https://app.lap.dev/api/v1/organizations/{org_id}/projects/{project_id}/env ### Response #### Success Response (200) - **env_vars** (array) - List of key-value pairs ``` -------------------------------- ### Stream Events via SSE Source: https://context7.com/lapce/lapdev/llms.txt Subscribes to real-time event streams for various infrastructure components using Server-Sent Events. ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/kube/environments/{environment_id}/events" \ -H "Accept: text/event-stream" \ -b cookies.txt ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/kube/environments/{environment_id}/workloads/events" \ -H "Accept: text/event-stream" \ -b cookies.txt ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/kube/environments/events" \ -H "Accept: text/event-stream" \ -b cookies.txt ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/kube/clusters/{cluster_id}/events" \ -H "Accept: text/event-stream" \ -b cookies.txt ``` ```bash curl -X GET "https://app.lap.dev/api/v1/organizations/{org_id}/kube/catalogs/{catalog_id}/events" \ -H "Accept: text/event-stream" \ -b cookies.txt ``` -------------------------------- ### DevboxSessionInfo Struct Source: https://context7.com/lapce/lapdev/llms.txt Provides core information about a Devbox session, including user ID, email, device name, and session validity timestamps. ```rust // Session and user info pub struct DevboxSessionInfo { pub user_id: Uuid, pub email: String, pub device_name: String, pub created_at: DateTime, pub expires_at: DateTime, pub last_used_at: DateTime, } ``` -------------------------------- ### Generate CLI Tokens via REST API Source: https://context7.com/lapce/lapdev/llms.txt Creates a 30-day authentication token for CLI usage. Requires an existing browser session cookie. ```bash # Generate CLI token (requires browser session cookie) curl -X POST "https://app.lap.dev/api/v1/auth/cli/generate-token" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{ "session_id": "unique-session-uuid", "device_name": "macbook-pro-work" }' ``` -------------------------------- ### Admin: Update Hostnames Source: https://context7.com/lapce/lapdev/llms.txt Configure the mapping of regions to public hostnames for the LapDev service. This endpoint is for administrative purposes. ```bash # Admin: Update hostnames curl -X PUT "https://app.lap.dev/api/v1/admin/hostnames" \ -H "Content-Type: application/json" \ -b cookies.txt \ -d '{"us-west-2": "app.lap.dev", "eu-west-1": "eu.lap.dev"}' ``` -------------------------------- ### Admin: Create machine type Source: https://context7.com/lapce/lapdev/llms.txt API endpoint for creating a new machine type within the admin section. ```APIDOC ## POST /api/v1/admin/machine_types ### Description Creates a new machine type with specified CPU and memory configurations. ### Method POST ### Endpoint /api/v1/admin/machine_types ### Request Body - **name** (string) - Required - The name of the machine type (e.g., "Large"). - **cpu** (integer) - Required - The number of CPUs for the machine type. - **memory** (integer) - Required - The amount of memory in MB for the machine type. ### Request Example ```json { "name": "Large", "cpu": 4, "memory": 8192 } ``` ``` -------------------------------- ### Devbox Whoami API Source: https://context7.com/lapce/lapdev/llms.txt Retrieves current CLI session information using Bearer token authentication. Validates the token and returns user and session details. ```APIDOC ## GET /api/v1/devbox/whoami ### Description Gets the current CLI session information. ### Method GET ### Endpoint /api/v1/devbox/whoami ### Headers - **Authorization** (string) - Required - Bearer token for authentication. Format: `Bearer YOUR_CLI_TOKEN` ### Response #### Success Response (200) - **user_id** (string) - The unique identifier for the user. - **email** (string) - The user's email address. - **name** (string) - The user's name. - **organization_id** (string) - The ID of the organization the user belongs to. - **device_name** (string) - The name of the device used for authentication. - **authenticated_at** (string) - The timestamp when the user was authenticated. - **expires_at** (string) - The timestamp when the authentication token expires. #### Response Example ```json { "user_id": "550e8400-e29b-41d4-a716-446655440000", "email": "developer@example.com", "name": "John Developer", "organization_id": "org-uuid", "device_name": "macbook-pro-work", "authenticated_at": "2024-01-15T10:30:00Z", "expires_at": "2024-02-14T10:30:00Z" } ``` ``` -------------------------------- ### WorkloadInterceptInfo Struct Source: https://context7.com/lapce/lapdev/llms.txt Contains information about an active workload intercept, including its ID, associated workload, port mappings, and creation timestamp. ```rust pub struct WorkloadInterceptInfo { pub intercept_id: Uuid, pub workload_id: Uuid, pub workload_name: String, pub namespace: String, pub port_mappings: Vec, pub created_at: DateTime, pub device_name: String, } ``` -------------------------------- ### DevboxInterceptRpc Interface Source: https://context7.com/lapce/lapdev/llms.txt RPC interface for managing workload traffic interception. ```APIDOC ## DevboxInterceptRpc Interface ### Description Provides methods for managing workload traffic interception from the dashboard or CLI. ### Methods #### `start_workload_intercept(workload_id: Uuid, port_mappings: Vec)` - **Description**: Start intercepting traffic for a workload. - **Method**: `POST` (Assumed, as it's an RPC call) - **Endpoint**: `/rpc/DevboxInterceptRpc/start_workload_intercept` (Assumed) - **Parameters**: - **workload_id** (Uuid) - Required - The ID of the workload to intercept. - **port_mappings** (Vec) - Required - A list of port mappings to apply. - **Response**: `Result` #### `stop_workload_intercept(intercept_id: Uuid)` - **Description**: Stop an active intercept. - **Method**: `POST` (Assumed) - **Endpoint**: `/rpc/DevboxInterceptRpc/stop_workload_intercept` (Assumed) - **Parameters**: - **intercept_id** (Uuid) - Required - The ID of the intercept to stop. - **Response**: `Result<(), String>` ```