# Scan a GitHub repo for leaked API keys and secrets

**Use case:** 

Scan one public GitHub repository's full history, every branch and pull request included, for leaked AWS, Stripe, OpenAI, Anthropic and GitHub tokens with gitleaks, each finding with file, line, commit and author. The example repo holds test keys made for secret scanners; replace it with yours.

## Input

```json
{
  "search_for": "platform",
  "platform": "aws",
  "platform_custom": "convex",
  "additional_platforms": [
    "stripe",
    "openai",
    "anthropic",
    "github-pat"
  ],
  "keyword": "anthropic",
  "regex_pattern": "rzp_live_[A-Za-z0-9]{14}",
  "scope": "single_repo",
  "target": "https://github.com/trufflesecurity/test_keys",
  "max_results": 100,
  "pushed_after": "2025-01-01",
  "pushed_before": "2024-01-01",
  "language": "javascript",
  "include_test_keys": true,
  "include_pr_refs": true,
  "include_all_branches": true,
  "include_submodules": false,
  "include_dangling_objects": false,
  "max_file_size_mb": 100
}
```

## Output

```json
{
  "repo_url": {
    "label": "Repo",
    "format": "link"
  },
  "file": {
    "label": "File"
  },
  "line": {
    "label": "Line"
  },
  "secret_name": {
    "label": "Var name"
  },
  "secret_value": {
    "label": "Secret value"
  },
  "paired": {
    "label": "Paired?"
  },
  "paired_with": {
    "label": "Paired component"
  },
  "permalink": {
    "label": "Open in GitHub",
    "format": "link"
  },
  "platform": {
    "label": "Platform"
  },
  "branch_ref": {
    "label": "Ref"
  },
  "is_dangling": {
    "label": "Dangling?"
  },
  "rule_id": {
    "label": "Rule"
  },
  "commit_sha": {
    "label": "Commit"
  },
  "is_test_key": {
    "label": "Test key?"
  },
  "author_name": {
    "label": "Author"
  },
  "author_email": {
    "label": "Author email"
  },
  "commit_date": {
    "label": "Commit date"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Gitleaks Cloud - GitHub API Key Hunter & Secret Scanner Actor is ready to run with the inputs already set for "Scan a GitHub repo for leaked API keys and secrets". [Sign up or log in](https://console.apify.com/create-task-from-example/NcV9YbwZUi7OtNGhb) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Scan a GitHub repo for leaked API keys and secrets" task

The Gitleaks Cloud - GitHub API Key Hunter & Secret Scanner Actor will start running based on the input automatically. You can also change all the input fields, like what are you hunting for?, platform, and more, to match your specific use case.

### 3. Receive the "Scan a GitHub repo for leaked API keys and secrets" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as repo, file, line, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Scan a GitHub repo for leaked API keys and secrets" task via API](https://apify.com/anshumanatrey/gitleaks-github-secret-scanner.md).

## About this Actor

This example demonstrates how to use [Gitleaks Cloud - GitHub API Key Hunter & Secret Scanner](https://apify.com/anshumanatrey/gitleaks-github-secret-scanner.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/anshumanatrey/gitleaks-github-secret-scanner.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/anshumanatrey/gitleaks-github-secret-scanner.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
