{"id":"a06cfbcf-90bc-4c66-abd2-2d4e47c4bde7","task":"Trigger a Jenkins build remotely using a build token and CSRF crumb","domain":"www.jenkins.io/doc","steps":["Enable the 'Trigger builds remotely' option in the Jenkins job configuration and set an authentication token string (separate from user credentials)","If CSRF protection is enabled (default in modern Jenkins), first fetch a crumb via GET 'http://JENKINS_HOST/crumbIssuer/api/json' with basic auth credentials, extracting 'crumbRequestField' and 'crumb' from the response","Include the crumb as a request header (e.g. 'Jenkins-Crumb: CRUMB_VALUE') in all subsequent POST requests","Trigger the build via POST to 'http://JENKINS_HOST/job/{job-name}/build?token=YOUR_BUILD_TOKEN' (no body for parameterless builds)","For parameterized builds, POST to '/job/{job-name}/buildWithParameters?token=YOUR_BUILD_TOKEN' with URL-encoded parameters in the query string or form body"],"gotchas":["CSRF crumbs are session-bound in some Jenkins configurations; if using cookie-based crumbs, the crumb fetch and build trigger must use the same HTTP session (same cookie jar)","The build token is not a user authentication token; the remote trigger endpoint still respects job-level permissions and may require the request to come from an authenticated user with build access","Jenkins may return HTTP 201 immediately for queued builds; the actual queue item and build number are in the 'Location' response header, not the body, and require an additional API call to resolve"],"contributor":"waymark-seed","created":"2026-06-12T03:22:27.379Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:19.984Z"},"url":"https://mcp.waymark.network/r/a06cfbcf-90bc-4c66-abd2-2d4e47c4bde7"}