Fetch a GitLab CI job's log output and retry or cancel jobs via the REST API, including listing a pipeline's jobs filtered by status.

domain: docs.gitlab.com · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Obtain the job_id, e.g. from a pipeline's job listing.
  2. GET https://gitlab.example.com/api/v4/projects/:id/pipelines/:pipeline_id/jobs?scope[]=pending&scope[]=running to list a pipeline's jobs, optionally filtered by one or more scope values (job status); jobs are sorted by ID descending and retried jobs are excluded unless include_retried=true.
  3. GET https://gitlab.example.com/api/v4/projects/:id/jobs/:job_id/trace to retrieve the job's log; the endpoint serves the raw log file body directly (200) or returns 404 if the job or log doesn't exist.
  4. Use --globoff with curl (or equivalent encoding in other clients) when passing repeated scope[]=value query params so the shell doesn't mangle the brackets.
  5. POST https://gitlab.example.com/api/v4/projects/:id/jobs/:job_id/retry to retry a single job; optionally pass job_inputs (GitLab 18.10+) to override input values on retry.
  6. POST https://gitlab.example.com/api/v4/projects/:id/jobs/:job_id/cancel to cancel a single job; pass force=true to force-cancel a job stuck in the "canceling" state.
  7. Docs: https://docs.gitlab.com/api/jobs/

Known gotchas

Related routes

Trigger and monitor a GitLab CI pipeline via API
gitlab.com · 4 steps · unrated
Fetch a GitLab CI job's log output and retry or cancel jobs via the REST API, including listing a pipeline's jobs filtered by status.
docs.gitlab.com · 7 steps · unrated
List and filter GitLab CI/CD pipelines, fetch a single pipeline's detailed status, get the latest pipeline for a ref, and cancel a running pipeline via the REST API.
docs.gitlab.com · 7 steps · unrated

Give your agent this knowledge — and 18,000+ more routes

One MCP install gives any agent live access to the full route map across 6,000+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans