Hack to change bootdevice

Posted July 16, 2021 269 views
APIConfiguration ManagementAnsibleDevelopmentDigitalOcean API and CLI (doctl)

As i was trying to automate some filesystem changes on multiple hosts, i need to send droplets into recovery state, connect via ssh into recovery image and make changes to original droplets FS and than boot back into normal mode.

However, there is no way to do this action via API v2 request, only through the web panel, which is frustrating, because i need to go for recovery panel for every single droplet and manually change boot mode to recovery, and than change it back.

So, to free myself from manual labor, i hoped to “Hack around and find out”. I inspected requests that browser send when you press “Boot from recovery ISO” button, and found this request (i cut out all unnecessary info)

curl '****/set_boot_device' \
  -H 'authority:' \
  -H 'accept: application/json' \
  -H 'referer:****/recovery?i=05ae82' \
  -H 'cookie: ***********************************\
  --data-raw '{"local_disk":false}' \

As you can see, the old API v1 is used here, which btw has no documentation left

I tried to send request to old v1 api endpoint with same parameters as for new one

do_change_bootorder() {
    local do_token="$1"
    local do_droplet_id="$2"

    curl -X POST \
        -H "Content-Type: application/json" \
        -H "Authorization: Bearer $do_token" \
        -d '{"local_disk":false}' \

But it does not seem to be working

{"id":"api_error","message":"Looks like something went wrong. If this continues, please open a support ticket so we can help you out. ","request_id":"0fd23148-02f8-495a-******"}

I also tried to send same request to v2 API but got another error

{"id":"not_found","message":"route not found"}

I hope someone here can help me solve this problem.

P.s. I don’t wanna solve this problem via:

  • “copy request as curl with all cookies and ‘foreach’ for all droplets”
  • “automate login and obtaining cookies via beautifulsoup4 python”
  • “automate via selenium”
  • “automate via mouse programming to click on buttons”

I want simple API request and i wonder why it’s still not implemented after all these years ?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


The API that you are referring to is the internal DigitalOcean API used by their frontend. The public API does not seem to have this functionality in place.

But this sounds like a great idea, sounds like it’d be super useful!

The best thing to do to get your voice heard regarding this would be to head over to our Product Ideas board and post a new idea, including as much information as possible for what you’d like to see implemented.

Hope that helps!
- Bobby.