Yes, you can use the API to grab the Host Details which will include the Environment Details:
You can do the same for processes and so on as well. It can all be extracted via the API.
Let me know if you need any assistance with this.
I tried the Host API, but it does not return the custom meta data.
I checked with the DynatraceOne guys and they mentioned that it cant be done with the API.
Not even the Entities v2 API extracts the custom metadata