Skip to main content
DELETE
http://127.0.0.1:8005
/
api
/
v1
/
runs
/
{job_id}
curl -X DELETE http://127.0.0.1:8005/api/v1/runs/run_abc123
(empty response body)
Delete an async job and all associated data. This operation is permanent.
job_id
string
required
The unique job identifier (e.g., run_abc123).

Response

Returns 204 No Content on successful deletion.
curl -X DELETE http://127.0.0.1:8005/api/v1/runs/run_abc123
(empty response body)

Deletion Behavior

  • Completed jobs: Can be deleted immediately
  • Cancelled jobs: Can be deleted immediately
  • Running jobs: Must be cancelled first before deletion
  • Queued jobs: Must be cancelled first before deletion

Example: Cancel and Delete

import httpx

API_URL = "http://127.0.0.1:8005"

def force_delete_job(job_id):
    # First, try to cancel if running
    status = httpx.get(f"{API_URL}/api/v1/runs/{job_id}").json()
    
    if status["status"] in ("queued", "running"):
        print(f"Cancelling job {job_id}...")
        httpx.post(f"{API_URL}/api/v1/runs/{job_id}/cancel")
    
    # Now delete
    response = httpx.delete(f"{API_URL}/api/v1/runs/{job_id}")
    
    if response.status_code == 204:
        print(f"Job {job_id} deleted successfully")
        return True
    else:
        print(f"Failed to delete: {response.json()}")
        return False

force_delete_job("run_abc123")

Error Responses

StatusDescription
400Cannot delete running/queued job
404Job not found
500Internal server error

See Also