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"<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

    docker: *docker
      - run:
          name: Run deploy command
          command: |
            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\":\"\"}"

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?