`GET /api/workflows/stats?project_id=<uuid>` — the #358 header-card stats for the caller's workspace, optionally narrowed to one project (Active runs, Workflows, Success 24h %, Failed 24h, Avg duration).
const url = 'https://example.com/api/workflows/stats';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/api/workflows/statsParameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Responses
Section titled “Responses”The five header stat cards of the #358 workflows list board, aggregated over the caller’s workspace (optionally narrowed to one project) — Active runs, Workflows, Success 24h %, Failed 24h and Avg duration.
Serde casing: snake_case, matching WorkflowSummary and the zod schema.
object
Count of workflow runs currently in flight
(queued/pending/starting/running/waiting).
Distinct workflows with an in-flight run — backs the “over N workflows”
sub-caption (always ≤ active_runs).
Mean wall-clock duration in seconds of completed workflow runs in the
last 24h; None when none completed (or none had both timestamps).
Count of workflow runs that completed in the last 24h — the success
numerator; completed_24h + failed_24h is the exact denominator behind
success_rate_24h, so the “X / Y runs” sub-caption uses these two and
matches the headline percent.
Count of completed runs (with both timestamps) in the last 24h — the
EXACT sample behind the median/avg, so the “median over N runs” caption’s
N matches the duration set (not all terminal runs).
Count of workflow runs that failed in the last 24h.
Distinct workflows with a failed run in the last 24h — the “N workflows
affected” sub-caption (always ≤ failed_24h).
Median (p50) wall-clock duration in seconds over the same set as
avg_duration_secs — the robust central value the card shows; None
when none qualify.
Share (0.0–1.0) of DECIDED workflow runs in the last 24h that
completed — completed / (completed + failed), i.e. cancelled/skipped
are excluded from the denominator; 0.0 when nothing decided in the window.
Count of workflow definitions in scope.
Examplegenerated
{ "active_runs": 1, "active_workflows": 1, "avg_duration_secs": 1, "completed_24h": 1, "duration_sample_24h": 1, "failed_24h": 1, "failed_workflows": 1, "median_duration_secs": 1, "success_rate_24h": 1, "total_workflows": 1}Structured client error
The canonical JSON body of every error response — the single source of truth
the frontend binds to. Every AppError serializes as this exact shape, and
the generated OpenAPI component ApiErrorBody (with its ErrorCode enum) is
what the frontend error schema is generated from, so there is no hand-written
error schema on either end.
object
Machine-readable, stable error code.
Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.
object
The entitlement feature key that was hit, e.g. apps.max_count.
The plan’s limit for this key.
Where to send the user to upgrade.
Current usage (count or bytes, per the key).
Human-readable message (the server’s English text; the client may localize
by code).
Example
{ "code": "not_found"}Authentication required
The canonical JSON body of every error response — the single source of truth
the frontend binds to. Every AppError serializes as this exact shape, and
the generated OpenAPI component ApiErrorBody (with its ErrorCode enum) is
what the frontend error schema is generated from, so there is no hand-written
error schema on either end.
object
Machine-readable, stable error code.
Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.
object
The entitlement feature key that was hit, e.g. apps.max_count.
The plan’s limit for this key.
Where to send the user to upgrade.
Current usage (count or bytes, per the key).
Human-readable message (the server’s English text; the client may localize
by code).
Example
{ "code": "not_found"}Permission denied
The canonical JSON body of every error response — the single source of truth
the frontend binds to. Every AppError serializes as this exact shape, and
the generated OpenAPI component ApiErrorBody (with its ErrorCode enum) is
what the frontend error schema is generated from, so there is no hand-written
error schema on either end.
object
Machine-readable, stable error code.
Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.
object
The entitlement feature key that was hit, e.g. apps.max_count.
The plan’s limit for this key.
Where to send the user to upgrade.
Current usage (count or bytes, per the key).
Human-readable message (the server’s English text; the client may localize
by code).
Example
{ "code": "not_found"}Structured server error
The canonical JSON body of every error response — the single source of truth
the frontend binds to. Every AppError serializes as this exact shape, and
the generated OpenAPI component ApiErrorBody (with its ErrorCode enum) is
what the frontend error schema is generated from, so there is no hand-written
error schema on either end.
object
Machine-readable, stable error code.
Present only on a quota-exceeded 403 — the inline upgrade-CTA payload.
object
The entitlement feature key that was hit, e.g. apps.max_count.
The plan’s limit for this key.
Where to send the user to upgrade.
Current usage (count or bytes, per the key).
Human-readable message (the server’s English text; the client may localize
by code).
Example
{ "code": "not_found"}