How to get a list of all subfolders and their owners through API in Git

I need to get the list of all sub-folders with their associated owners in the form of csv, with a list of projects and comma delimited column for owners. Please help me to get this information through API.
And also to get the above information with powershell /python scripting language

Hi and welcome to our community!

Could you please shed some more light into your question, especially the part on

sub-folders with their associated owners

is not clear to me. Is a “sub folder” located in a Git repository where you have sort of Codeowners, or are you talking about projects in a given (sub group) with assigned roles?

Also, please include the GitLab version and whether it is self-hosted EE/CE or on