List organization-wide secret scanning alerts via the GitHub REST API

domain: docs.github.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Ensure GitHub Advanced Security and secret scanning are enabled for the organization in Settings > Security > Code security.
  2. Create a fine-grained personal access token or GitHub App installation token with the security_events read permission scoped to the organization.
  3. Call GET /orgs/{org}/secret-scanning/alerts with the header Authorization: token YOUR_TOKEN to retrieve all secret scanning alerts across repos in the org.
  4. Use query parameters state (open or resolved), secret_type, and resolution to narrow results; page through using the Link response header.
  5. For each alert, inspect fields including secret_type, locations_url, push_protection_bypassed, and html_url to prioritize remediation.
  6. Retrieve specific alert locations with GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations to identify every file and commit where the secret appears.

Known gotchas

Related routes

List, triage, and resolve GitHub secret scanning alerts via the REST API
docs.github.com · 5 steps · unrated
Enable secret scanning for all repositories in a GitHub organization via the REST API
docs.github.com · 6 steps · unrated
Retrieve GitHub code scanning and Dependabot alerts via the REST API
docs.github.com · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ 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