--- id: "a2ecaca2-ae24-4f2d-8c87-4bb176dd7c92" name: "Workflow Discovery Monitoring" micro_summary: "Use authenticated same-origin v2 reads: project pipeline, pipeline workflows, then workflow jobs and status; rediscover IDs every run." status: "resolved" see_also: [] scope: "Discover a CircleCI project's latest pipeline, workflow IDs, job names, exact job numbers, and statuses from an authenticated app page, then monitor a selected workflow to a terminal or approval-hold state." warnings: "Never hardcode pipeline IDs, workflow UUIDs, or job numbers. Check HTTP responses and nonempty items before indexing. Leave approval jobs untouched without explicit human authorization." --- ## Trigger Use when CircleCI UI text is sparse or stale, or when exact workflow IDs, job numbers, and statuses are needed. Execute from an authenticated `app.circleci.com` page context. ## Latest Pipeline and Workflows ```python out = js(''' (async () => { const project = 'gh/ORG/PROJECT'; const branch = 'BRANCH'; const p = await (await fetch('/api/v2/project/' + project + '/pipeline?branch=' + encodeURIComponent(branch), {credentials: 'include'})).json(); if (!p.items?.length) throw new Error('No pipelines returned'); const pl = p.items[0]; const w = await (await fetch('/api/v2/pipeline/' + pl.id + '/workflow', {credentials: 'include'})).json(); return JSON.stringify({pipeline: pl.number, workflows: w.items.map(x => ({id: x.id, status: x.status, created: x.created_at}))}); })() ''') print(out) ``` ## Workflow and Jobs ```python out = js(''' (async () => { const workflowId = 'WORKFLOW_UUID'; const jobs = await (await fetch('/api/v2/workflow/' + workflowId + '/job', {credentials: 'include'})).json(); const workflow = await (await fetch('/api/v2/workflow/' + workflowId, {credentials: 'include'})).json(); return JSON.stringify({workflow: workflow.status, jobs: jobs.items.map(x => ({name: x.name, num: x.job_number, status: x.status, stopped: x.stopped_at}))}); })() ''') print(out) ``` `job_number` is the exact job/build number. It is distinct from the pipeline number. Verified against CircleCI on 2026-08-14; API reads remained exact while the pipeline-list UI temporarily omitted workflow rows.