How to delete all jobs using the REST API

Learn how to delete all Databricks jobs using the REST API.

Written by Adam Pavlacka

Last published at: May 10th, 2022

Run the following commands to delete all jobs in a Databricks workspace.

  1. Identify the jobs to delete and list them in a text file:
    curl -X GET -u "Bearer: <token>" https://<databricks-instance>/api/2.0/jobs/list | grep -o -P 'job_id.{0,6}' | awk -F':' '{print $2}' >> job_id.txt
  2. Run the curlcommand in a loop to delete the identified jobs:
    while read line
    curl -X POST -u "Bearer: <token>" https://<databricks-instance>/api/2.0/jobs/delete -d '{"job_id": '"$job_id"'}'
    done < job_id.txt

Was this article helpful?