API to fetch specific folders and its contents

Is there an API that can be used to fetch specific folder, its subfolders and files in it.
Would be even helpful if the specified folder structure in it is intact after fetching the contents of it.


Do you mean a folder of a git repository? That sounds like a specific git question. I believe https://stackoverflow.com/questions/600079/how-do-i-clone-a-subdirectory-only-of-a-git-repository#13738951 is a good option to read.
https://docs.gitlab.com/ee/api/repositories.html doesn’t seem to have the sparse checkout functionality