I have tried to execute(trigger) jenkins job (not a parameterized job) via curl command by using below methods but it showing these results. my jenkins version is Jenkins 2.73.3

curl -X POST -u jenkins_user_name:jenkins_user_passwd http://jenkins_server/job/job_name/build

But it says Forbidden 403 enter image description here

Therefore, I have created a Authentication Token for the Job enter image description here

curl -X POST http://jenkins_server/job/job_name/build?token=wefiytgwiefiweihfqweiodf

It's also giving the same error. it says Forbidden 403

After that , I have created an API Token for jenkins User and tried. enter image description here

curl -X POST -u auto:testingdae6dc22a73048e6d596e7b0 http://jenkins_server/job/job_name/build?token=wefiytgwiefiweihfqweiodf

But It also the same , it says Forbidden 403

Actually I have followed this answer as well. https://www.nczonline.net/blog/2015/10/triggering-jenkins-builds-by-url/ this is also not worked for me.

every time , It's 403 forbidden. I think I couldn't authenticate jenkins user properly.

3 Answers 3


found the answer. Actually those steps are correct. I would like to mention the correct steps.

Create a user in Jenkins, you can use that user password or API token for trigger Jenkins job. But creating an API token for that user is much better. But both ways working fine.

But you have to create an Authentication token for Jenkins Job

enter image description here

Using Password

curl -I -u auto:<userpasswd> http://<jenkins_server>/job/test/build?token=wefiytgwiefiweihfqweiodf

Using an API Token

Create an API token for that Jenkins user enter image description here

curl -I -u auto:<user_api_token> http://<jenkins_Server>/job/test/build?token=wefiytgwiefiweihfqweiodf

these are the results, using jenkins user Password and jenkins user API token.

enter image description here

Actually you can send this request , without "-I" as well.

curl -u auto:<jenkins_user_token> http://<jenkins_server>/job/test/build?token=wefiytgwiefiweihfqweiodf

curl -u auto:<jenkins_user_password> http://<jenkins_server>/job/test/build?token=wefiytgwiefiweihfqweiodf
  • 1
    Just tried this... I added an Auth-token and used it with curl -u auto:<jenkins_user_token> http://<jenkins_server>/job/test/build?token=wefiytgwiefiweihfqweiodf and got <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 403 No valid crumb was included in the request</title> </head> <body><h2>HTTP ERROR 403</h2> <p>Problem accessing /job/hailo_ci_pull_request/build. Reason: <pre> No valid crumb was included in the request</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/> </body> </html> Feb 4, 2019 at 13:58
  • seems like you have entered the wrong authentication token. please check this part "token=wefiytgwiefiweihfqweiodf" with your authentication token. Feb 4, 2019 at 14:31
  • I used my authentication token that I generated from the API token in my user tab - http://<IP>/user/<my_name>/configure Feb 4, 2019 at 15:26
  • I'm running an Execute shell build step to start a job on the very same Jenkins (v2.249.1) instance. The user:token version works (even without the token query parameter, now wonder: it's for Trigger builds remotely, I'm working locally): '/c/Program Files/Git/mingw64/bin/curl' -I -s -S -u jenkins:11e73355c68426b1bd0a4616d189d5bc2f \ -X POST http://localhost:8083/job/$Project_To_Build/build. The user:pwd version doesn't: '/c/Program Files/Git/mingw64/bin/curl' -I -s -S -u jenkins:jenkins \ -X POST http://localhost:8083/job/$Project_To_Build/buildHTTP/1.1 403 Forbidden. Sep 15, 2020 at 19:43

Fast Forward to 2023

You need to pass 2 tokens to execute your job remotely from a script/bash.
You need:

  1. apiToken to authenticate your identity. This value is created from JENKINS_URL/me/configure . Also check here for documentation
  2. Another Job authentication token which you create when you enable 'Trigger builds remotely'.

Below is a sample to execute job with 2 parameters, you can tweak to get your done.

JOB_TOKEN="<value>" # you create this token when you enable Job>Configure>Build Triggers>Trigger builds remotely
LOGIN_API_TOKEN="<value>" #get this value from JENKINS_URL/me/configure 

curl -L --user $USERNAME:$LOGIN_API_TOKEN "$JENKINS_URL/job/JobName/buildWithParameters?token=$JOB_TOKEN&param1_name=$PARAM1_VALUE&param2_name=$PARAM2_VALUE"
  • That's not correct AFAIK. If your user has Build permissions for the job, you don't need the additional job token. You're probably running into the issue with the job token that you still need an authenticated user for the Read permissions for /job/JobName This plugin provides a solution for that: plugins.jenkins.io/build-token-root
    – Kutzi
    2 days ago

To configure these permissions:

  • Click Manage Jenkins
  • Click Configure Global Security
  • Remove Prevent Cross Site Request Forgery exploits
  • Click save
  • 4
    Sounds like this would undermine the security of your system. Do you really want every website you visit to be able to run jobs on your Jenkins install?
    – kasperd
    Oct 25, 2018 at 18:40
  • 2
    You should use tokens instead of doing that. Security first !!!!
    – Robert
    Jun 25, 2020 at 17:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .