How to get worker script from each environment

I have a worker with environments.

The API accounts/{account_identifier}/workers/scripts/{script_name} fetches the script by name. And in my case only downloads the from my production environment.

How does one use the API to fetch a script from an alternate environment such as dev?

Poking under the dash.cloudflare.com hood, I find this undocumented API that at least tells me I have multiple environments.

accounts/{account_identifier}/workers/services/{script_name}

{
  "id": "www",
  "default_environment": {
    "environment": "production",
    "script": {
      "id": "www",
      "logpush": false,
      "handlers": [
        "fetch"
      ],
      "last_deployed_from": "dash",
      "usage_model": "bundled"
    }
  },
  "environments": [
    {
      "environment": "production",
    },
    {
      "environment": "dev",
    }
  ]
}

(*) Note, I pruned some fluff from that json for simplicity.

So it appears that accounts/{account_identifier}/workers/scripts/{script_name} downloads the default_environment script.

What’s the undocumented API to download the script for the alternate environments?

Aha! One more undocumented API ftw…

accounts/{account_identifier}/workers/services/{script_name}/environments/{worker_env}/content

Boom.