0

I want to read some files in one project existing in gitlab from the application via gitlab API. I create deploy token in the project through

settings -> Repository -> Deploy Tokens. 

I then try

/api/v4/projects/MY_ID?private_token=MY_TOKEN

and

/api/v4/projects/MY_ID?access_token=MY_TOKEN

, and none of them work - Both return 401

Can't this deploy token use as an authentication token, and I have to create a new user to achieve it?

But the documentation describes that this deploy token is used for accessing this project, or?

Holm
  • 2,987
  • 3
  • 27
  • 48

1 Answers1

0

You need to use a Personal Access Token not a Deploy Token. These are created from:

profile -> settings -> access tokens

And in the API request the ID you pass is the Project ID, eg:

curl "https://your-host/api/v4/projects/<project-id>?private_token=<your-private-token>"

To find the Project ID either go to the project page or query all projects you have access to, eg:

curl "https://your-host/api/v4/projects?private_token=<your-private-token>"

Cheers

S

slowko
  • 829
  • 1
  • 7
  • 12