GitLab Repositories API

I want to list all the file names and directories present in a repository using GitLab’s API.

For this I’m using List Repository Tree API for accessing the file names and directories.

However, this only lists all the directories (and the subdirectories), and the file names present at the top most level. This DOES NOT list the file names in subdirectories.

For Example: Making an API call to this URL: https://gitlab.com/api/v4/projects/nanuchi%2Fgitlab-cicd-crash-course/repository/tree?ref=main&recursive=false would not list the files present in the subdirectories.

Any help as to how can I get the list of all files and directories will be appreciated.