Manage and delete Runpod serverless endpoints deployed via Flash.
The flash undeploy command helps you clean up Serverless endpoints that Flash has created when you deployed Endpoint functions using flash dev or flash deploy. It manages endpoints recorded in .flash/resources.pkl and ensures both the cloud resources and local tracking state stay in sync.
- Cleaning up individual endpoints you no longer need
- Removing endpoints after local development/testing
| Command | Scope | When to use |
|---|---|---|
flash undeploy |
Individual endpoints from local tracking | Granular cleanup, development endpoints |
flash env delete |
Entire environment + all its resources | Production cleanup, full teardown |
For production deployments, use flash env delete to remove the entire environment and all associated resources automatically.
Flash tracks deployed endpoints in .flash/resources.pkl. Endpoints get added to this file when you:
- Run
flash dev --auto-provision(local development) - Run
flash deploy(production deployment)
flash undeploy [NAME|list] [OPTIONS]Display all tracked endpoints with their current status:
flash undeploy listOutput includes:
- Name: Endpoint name
- Endpoint ID: Runpod endpoint identifier
- Status: Current health status (Active/Inactive/Unknown)
- Type: Resource type (Live Serverless, Cpu Live Serverless, etc.)
- Resource ID: Internal tracking identifier
Status Indicators:
- 🟢 Active: Endpoint is running and responding to health checks
- 🔴 Inactive: Endpoint tracking exists but health check fails (likely deleted externally)
- ❓ Unknown: Exception occurred during health check
Delete a specific endpoint:
flash undeploy my-apiBehavior:
- Searches for endpoints matching the name
- Shows endpoint details
- Prompts for confirmation
- Deletes endpoint from Runpod
- Removes from local tracking
Delete all tracked endpoints with double confirmation:
flash undeploy --allSafety features:
- Shows total count of endpoints
- First confirmation: Yes/No prompt
- Second confirmation: Type "DELETE ALL" exactly
- Deletes all endpoints from Runpod
- Removes all from tracking
Select endpoints to undeploy using checkboxes:
flash undeploy --interactiveBehavior:
- Displays interactive list with checkboxes
- Use arrow keys to navigate
- Use space bar to select/deselect
- Press Enter to confirm selection
- Prompts for final confirmation
- Deletes selected endpoints
Remove inactive endpoints from tracking without API deletion:
flash undeploy --cleanup-staleUse case: When endpoints are deleted via Runpod UI or API (not through Flash), the tracking file becomes stale. This command identifies and removes those orphaned entries.
Behavior:
- Checks health status of all tracked endpoints
- Identifies inactive endpoints
- Lists inactive endpoints for review
- Prompts for confirmation
- Removes only from local tracking (endpoints already deleted)
--all: Undeploy all endpoints (requires double confirmation)--interactive, -i: Interactive checkbox selection--cleanup-stale: Remove inactive endpoints from tracking
# Check what's deployed
flash undeploy list
# Remove a specific endpoint
flash undeploy my-api
# Clean up stale tracking
flash undeploy --cleanup-stale# Undeploy all endpoints
flash undeploy --all
# Interactive selection for partial cleanup
flash undeploy --interactiveIf you delete endpoints via Runpod UI:
# Check status - will show as "Inactive"
flash undeploy list
# Remove stale tracking entries
flash undeploy --cleanup-staleThe Status column performs a health check API call for each endpoint. This:
- Adds latency (1 API call per endpoint)
- Provides accurate current state
- Identifies endpoints deleted externally
Why it's valuable:
- Catches endpoints deleted via Runpod UI
- Identifies unhealthy endpoints
- Prevents stale tracking file issues
- All deletion operations require explicit confirmation
--allrequires double confirmation with exact text match- Interactive mode shows count before deletion
- Clear indication that operations cannot be undone
- Displays endpoint details before deletion
- Shows success/failure counts after operations
- Continues processing remaining endpoints if one fails
- Shows detailed error messages per endpoint
- Tracks success/failure counts in summary
Endpoints are tracked in .flash/resources.pkl.
Important:
- This file is in
.gitignore(never commit) - Contains local deployment state
- Use
flash undeploy --cleanup-staleto maintain accuracy make cleanno longer deletes this file (use flash undeploy instead)
When you use the Endpoint class:
from runpod_flash import Endpoint, GpuGroup
@Endpoint(name="my-worker", gpu=GpuGroup.ANY)
def my_function(data):
return {"result": data}Flash automatically:
- Deploys endpoint to Runpod
- Tracks in
.flash/resources.pkl - Reuses endpoint on subsequent calls
To clean up:
flash undeploy my-workerCause: Endpoint was deleted via Runpod UI/API
Solution:
flash undeploy --cleanup-staleSymptoms: "No endpoint found with name 'my-api'"
Solution: Check exact name with:
flash undeploy listCause: Network issues or invalid API key
Solution:
- Check
RUNPOD_API_KEYin.env - Verify network connectivity
- Check endpoint still exists on Runpod
flash init- Initialize new projectflash dev- Start development serverflash build- Build deployment packagesflash deploy- Deploy to Runpod