title: GitLab: Unauthorized access to API from pipeline using CI_JOB_TOKEN
body: <p>I am trying to make a request to the api of my gitlab host to resolve a tag release information, from what i have seen on the internet is that i could be able to get this information with <code>curl</code> using the pre-defined variables in the job so i could get what i am looking for.</p>
  
  <p>Right now how the curl is being executed is like this:</p>
  
  <pre><code>curl -H "PRIVATE-TOKEN: $CI_JOB_TOKEN" $CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/tags/$CI_COMMIT_TAG
  </code></pre>
  
  <p>The response of this request is <code>404: Unauthorized</code>. I have also tried using <code>CI_BUILD_TOKEN</code> environment variable but i also get the same result.</p>
  
  <p>The repository on which i am creating these jobs is not a private, just internal. So i don't know how to make this work.</p>
  
  <p>In case it's necessary, here's how the job pipeline is coded:</p>
  
  <pre><code>fetch-tag-info:
    stage: setup
    only:
      - tags
    image: ubuntu:18.04
    before_script:
      - apt-get update
      - apt-get install curl jq -y
    script:
      - "curl -H \"PRIVATE-TOKEN: $CI_JOB_TOKEN\" $CI_API_V4_URL/projects/$CI_PROJECT_ID/repository/tags/$CI_COMMIT_TAG -o release-notes.json"
  </code></pre>