Retrieve GitHub code scanning and Dependabot alerts via the 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. Create a GitHub personal access token or GitHub App installation token with the security_events scope (for code scanning) and the dependabot_alerts scope (for Dependabot); use fine-grained tokens scoped to the target repository
  2. List code scanning alerts with GET /repos/OWNER/REPO/code-scanning/alerts; filter by state (open, dismissed, fixed), severity, and tool name query parameters
  3. Retrieve alert details including the most_recent_instance field which contains the file path, line number, and rule description; use the html_url field to link directly to the alert in the GitHub UI
  4. List Dependabot alerts with GET /repos/OWNER/REPO/dependabot/alerts; filter by severity (critical, high, medium, low) and ecosystem; each alert contains a security_vulnerability object with the CVE identifier and affected version range
  5. Dismiss alerts programmatically with PATCH requests providing a dismissed_reason and dismissed_comment when a vulnerability is not applicable or has an accepted risk
  6. For organization-wide aggregation, use the organization-level endpoints GET /orgs/ORG/code-scanning/alerts and GET /orgs/ORG/dependabot/alerts with appropriate pagination via the Link header

Known gotchas

Related routes

Open a GitHub pull request from a fork via REST API
github-api · 4 steps · 88% success
List, triage, and resolve GitHub secret scanning alerts via the REST API
docs.github.com · 5 steps · unrated
List and dismiss GitHub Dependabot alerts across a repository and organization via the REST API
docs.github.com · 5 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