V2 api endpoint returns unexpected answer

I need to manually call the api and cancel a job thats on hold, I found the following script from another post in the community but it seems its wrong:

  rolling-backward :
    executor: node
      - aws-cli/install
      - restore_cache:
            - aws-lambda-scripts-v1
      - run: |
          ls -l
          sh ./aws-lambda-scripts/scripts/set-previous-to-full-traffic.sh FUNCTION=lambda-test ALIAS=LATEST PREVIOUS_VERSION=$(./aws-lambda-scripts/scripts/get-previous-version.sh FUNCTION=lambda-test)
      - run:
          name: Cancelling the other on_hold workflow
          command: |
            other_on_hold_id=$(curl -G "https://circleci.com/api/v2/pipeline/<<pipeline.id>>/workflow" -H "Circle-Token: $MyToken"|jq -rs --arg CIRCLE_WORKFLOW_ID "$CIRCLE_WORKFLOW_ID" '.[].items[]|select(.status == "on_hold")|select(.id != $CIRCLE_WORKFLOW_ID)|.id')
                  echo $other_on_hold_id
                  curl -X POST "https://circleci.com/api/v2/workflow/${other_on_hold_id}/cancel" -H "Circle-Token: ${MyToken}"

the output:

#!/bin/bash -eo pipefail
other_on_hold_id=$(curl -G "https://circleci.com/api/v2/pipeline/353df28d-2961-4bce-89e2-14e4b6c9b002/workflow" -H "Circle-Token: $MyToken")
      echo $other_on_hold_id       
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    37  100    37    0     0    853      0 --:--:-- --:--:-- --:--:--   860
{ "message" : "Project not found" }

Hi @farhad-taran ,

Could you confirm for me if you are using a personal API token? Personal API tokens can be set on the following page: https://app.circleci.com/settings/user/tokens

I have seen cases where an invalid token, or a project level api token were returning the Project not found error.

One way to test this would be to run the following api call for the workflow in your example:

curl --request GET \
  --url https://circleci.com/api/v2/pipeline/353df28d-2961-4bce-89e2-14e4b6c9b002/workflow \
  --header "circle-token: $MyToken"

If the above call still returns { "message" : "Project not found" } there may be an issue with the API token.

If you would like us to take a closer look, please feel free to submit a ticket via CircleCI Support Center

Thank you!