401 Unauthorized while playing a job using API

,

I’m trying to trigger a manual job from a project, but i get {“message”:“401 Unauthorized”}. Oddly - pipeline trigger runs fine.

  • What are you seeing, and how does that differ from what you expect to see?

curl --request POST --header “PRIVATE-TOKEN: 0fa6” https://gitlab.***/api/v4/projects/262/jobs/93137/play
{"message":"401 Unauthorized"}

I expect to play this job through curl. Creating new pipeline works fine, I don’t have problems with authorization.

  • What version are you on? Are you using self-managed or GitLab.com?

    • GitLab (Hint: /help): 12.7.2
    • Runner (Hint: /admin/runners): Alpine Linux v3.8
  • Add the CI configuration from .gitlab-ci.yml and other configuration if relevant (e.g. docker-compose.yml)

stages:
  - deploy_test

before_script:
  - echo $CI_COMMIT_REF_NAME

deploy_test:
  stage: deploy_test
  script:
    - echo "hi"
  when: manual
  • What troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?

I was using gitlab documentation:
https://docs.gitlab.com/ee/api/jobs.html