Calling circleci api from within another circleci project gives '"Project not found"' error

When I try this command in a shell on my local PC , it works as expected

curl -X POST --header "Content-Type: application/json" https://circleci.com/api/v1.1/project/github/<CompanyGitHubAccount>/myproject/tree/mybranch?circle-token=...

I can see a job to build myproject is started.

However if I put this as a step in a workflow

  deploy:
    docker: *docker
    steps:
      - run:
          name: Run deploy command
          command: |
            TRIGGER_BUILD_URL=https://circleci.com/api/v1.1/project/github/CompanyGitHubAccount/myproject/tree/${CIRCLE_BRANCH}?circle-token=
            echo Deploy url ${TRIGGER_BUILD_URL}
            curl -X POST --header "Content-Type: application/json" ${TRIGGER_BUILD_URL}=${CI_TOKEN}

I get this error:

{
  "message" : "Project not found"
}

If I use an invalid project name in my shell, I will get a different error message:

{
  "message" : "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/repos/#get\"}"

My questions:

  1. Why api call failed as a step in my circleci job?

  2. Why the error messages are entirely different between the circleci one and my local one?