Custom backup solution?


I’ve been searching for a few hours and hope here will be when I find the solution or the answer to my question.
I’m looking for a way to generate a backup of a workspace(including all the environments with their variables) in a programmatic way. A possible solution(but not yet verified) is that, that I could possible collect all the data from a workspace using the API and write it in a JSON, using the same format that the does. Would there be a better way? Github is off the table and any other solution that is under integrations > backup (except Postman API obviously).

Best regards.