File API: Accessing files in subfolders leads to redirect

I seem to only be able to access the top level Files in my Repo, if I try to access any files that are located in folders, I am being redirected to the login page:
Repo content:
.gitignore
test/test.txt

This works:
curl “xxx/api/v4/projects/114/repository/files/.gitignore/raw?ref=master&private_token=xxx”

This causes a redirect:
curl “xxx/api/v4/projects/114/repository/files/test%2Ftest.txt/raw?ref=master&private_token=xxx”

Repsonse: “You are being redirected.”

I followed these instructions: https://docs.gitlab.com/ee/api/repository_files.html#get-file-from-repository

I tried with a read_only filea access and with a api access token.
Any ideas?