Skip to main content

Why do my API workflow metrics not match the CircleCI UI?

If you're querying the Insights API and finding that total_runs or other workflow metrics don't match what you see in the CircleCI UI, the most likely cause is that your API call is only querying the default branch.

The all-branches parameter

By default, the Insights API scopes results to your project's default branch (commonly main or master). To retrieve metrics across all branches, add all-branches=true as a query parameter:

curl --request GET \
  --url "https://circleci.com/api/v2/insights/{vcs-slug}/{org-name}/{project-name}/workflows?reporting-window=last-30-days&all-branches=true" \
  --header "Circle-Token: $CIRCLE_TOKEN"

Replace {vcs-slug}, {org-name}, and {project-name} with your own values.

Why might there still be a small discrepancy?

Even with all-branches=true, you may notice a small difference (typically a handful of runs) between the API response and the UI. This is expected — Insights metrics are refreshed daily and may not reflect pipeline runs from the past 24 hours.

Did this answer your question?