Personal API token undefined in circleci jobs

I created a personal API token named “CIRCLE_API_USER_TOKEN” and I am using the token to trigger builds, but I keep getting “Project not found” error which is misleading.

This is my config.yml (user and repo are hardcoded)

      - run:
          name: Trigger Build
          command: |
              curl \
                --data build_parameters[CIRCLE_JOB]=build-test-deploy-project \
                --data revision=$CIRCLE_SHA1 \
                https://circleci.com/api/v1.1/project/github/<user>/<repo>/tree/$CIRCLE_BRANCH?circle-token=$CIRCLE_API_USER_TOKEN

I get the following everytime

{
  "message" : "Project not found"
}

in my terminal I was able to get API build trigger to work, but in CI it doesn’t. If I console/echo CIRCLE_API_USER_TOKEN it shows nothing.

The token is not exposed by default. You need to add it as an environment variable in the project settings.

1 Like