Skip to main content
GET
Get Code Scan Metrics

Permissions

Requires a service user or personal access token with the ViewCodeScans permission at the organization level.

Time filters

This endpoint requires the time_after and time_before query parameters.
  • Both time_after and time_before are Unix timestamps in seconds, interpreted as UTC.
  • time_after must be earlier than time_before.
  • The time range between time_after and time_before must be 100 days or less.
  • Metrics are scoped to code scans created within this time range.
For metrics across every organization in an enterprise, use Get Code Scan Metrics (Enterprise).

Authorizations

Authorization
string
header
required

Service User credential (prefix: cog_)

Path Parameters

org_id
string
required

Organization ID (prefix: org-)

Example:

"org-abc123def456"

Query Parameters

time_before
integer
required
time_after
integer
required

Response

Successful Response

Response model for code scan metrics.

All metrics are scoped to code scans created within the specified time range: findings and remediation PRs are attributed to the scan that produced them.

avg_pr_open_duration_seconds
number | null
required

Average time a PR is (or was) open, in seconds: creation to merge/close for finished PRs, creation to now for open PRs. Null when no PRs were created.

avg_pr_time_to_merge_seconds
number | null
required

Average time from PR creation to merge, in seconds. Null when no PRs have been merged.

open_critical_findings_count
integer
required

Number of open findings with critical severity.

open_high_findings_count
integer
required

Number of open findings with high severity.

open_low_findings_count
integer
required

Number of open findings with low severity.

open_medium_findings_count
integer
required

Number of open findings with medium severity.

prs_closed_count
integer
required

Number of remediation PRs closed without being merged.

prs_created_count
integer
required

Number of PRs created by the scans' remediation sessions.

prs_merged_count
integer
required

Number of remediation PRs merged.

prs_open_count
integer
required

Number of remediation PRs currently in the open state.

repos_scanned_count
integer
required

Number of distinct repositories scanned.

scans_count
integer
required

Number of code scans created within the specified time range.