Is it possible to navigate to a repo file based on the projectId

I’m using the GitLab API to search projects and store information of certain files for our application.

I’m currently only saving the projectId in the database as it seems an overkill to save the name as well, however, if I wanted to create a URL to a specific blob, I seem to need the name of the repo, as the URL structure is

https://[gitlabURL]/[namespace]/[project/repo name]/blob/[branch]/[path to file]

Is there an alternative URL where I could use the projectId instead of its name??

Would the APIs work for you?

GET /projects/:id/repository/files/:file_path/raw

No, the idea here is to include an anchor to the file so the users can navigate to it straight away. We do have to download them when they are being used - I use the suggested endpoint for that occasion (which is why we need to store the projectId in the database.