Secret Scanner API

Scan text, a file, a diff or a ZIP of a repo for leaked API keys, tokens, private keys and passwords with the 220+ gitleaks rules. Secrets are masked.

POSThttps://apibox.io.vn/v1/secret-scan
Security & Crypto▶ Try it online

Send text (text or a raw body) or a file: a single source file, a .gz, a unified diff (only added lines are scanned, with line numbers of the new file) or a .zip of a repository. The scanner applies the default gitleaks rule set (220+ rules: AWS, GitHub, GitLab, Stripe, Slack, Google, OpenAI and Anthropic keys, private keys, JWTs and many more), converted from Go RE2 to JavaScript and refreshed weekly, plus our own rule for passwords inside connection-string URLs (postgres://user:pass@host). As in gitleaks, each rule has keywords, an optional secret group, a Shannon entropy threshold and allowlists (placeholders like ${VAR}, changeme, example keys, node_modules, lock files, images).

Each finding gives rule_id, description, file, line / column (1-based) and end position, the masked secret and masked match, the entropy and a confidence (low for the generic key rule). entropy=true also reports long high-entropy strings that no rule matched. rules restricts the scan to some rule ids. Regexes run only on windows around keyword hits, with a total time budget, so a pathological input cannot run forever; the response flags timed_out or slow_rules if that happens.

Privacy: the content is scanned in memory and is never stored or logged, and secrets are masked in the response. Still, a key that has been pasted anywhere should be rotated. Limits: 5 million characters in total, files in a ZIP up to 2 MB each, 10,000 files.

Parameters

NameInTypeRequiredDefault
textbodystringnoText, code or a unified diff to scan (or send a raw text body).
filebodyfilenoA text file, .gz, diff or .zip of a repository (multipart, or file_base64).
filenamebodystringnoPath of the text, for path-based rules and allowlists (e.g. config/.env).
diffbodybooleannoTreat the text as a unified diff (auto-detected).
entropybodybooleannofalseAlso report high-entropy strings not matched by a rule.
rulesbodystringnoComma-separated rule ids to run (default: all).
limitbodynumberno1000Maximum findings returned (1–5000).

Example

curl -X POST "https://apibox.io.vn/v1/secret-scan" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"AWS_ACCESS_KEY_ID=AKIAQWERTYUIOPASDFGH\nDATABASE_URL=postgres://admin:S3cr3tP4ssw0rd!@db.example.com:5432/app\n","filename":".env"}'

Response

{
  "leaks_found": true,
  "count": 2,
  "files_scanned": 1,
  "characters_scanned": 109,
  "by_rule": {
    "aws-access-token": 1,
    "url-credentials": 1
  },
  "findings": [
    {
      "rule_id": "aws-access-token",
      "description": "Identified a pattern that may indicate AWS credentials, risking unauthorized cloud resource access and data breaches on AWS platforms.",
      "file": ".env",
      "line": 1,
      "column": 19,
      "end_line": 1,
      "end_column": 38,
      "secret_masked": "AKIA**************GH",
      "match_masked": "AKIA**************GH",
      "entropy": 3.984,
      "confidence": "high",
      "fingerprint": ".env:aws-access-token:1"
    },
    {
      "rule_id": "url-credentials",
      "description": "Password inside a URL / connection string (database, broker, FTP, HTTP basic auth).",
      "file": ".env",
      "line": 2,
      "column": 31,
      "end_line": 2,
      "end_column": 45,
      "secret_masked": "S3***********d!",
      "match_masked": "postgres://admin:S3***********d!@db.example.com:5432",
      "entropy": 3.507,
      "confidence": "high",
      "fingerprint": ".env:url-credentials:2"
    }
  ],
  "truncated": false,
  "rules": {
    "count": 222,
    "source": "gitleaks default config (MIT)",
    "dropped": 0
  },
  "ms": 5,
  "privacy": "The text is scanned in memory and not stored or logged; secrets are masked in the response."
}

Use cases

  • Check logs or a support ticket for keys before pasting them into an LLM
  • Light pre-commit or CI check on a diff without installing a scanner
  • Audit a ZIP of a project handed over by a contractor
  • Catch database passwords left in .env or config files

FAQ

Is my code stored?

No. The request is processed in memory, nothing is written to storage or logs, and the response only contains masked secrets.

Is this the same as running gitleaks?

It uses the same default rules, keywords, entropy thresholds and allowlists. A rule that cannot be converted from RE2 is dropped and counted in rules.dropped (none at the moment). Git history is not scanned, only the files you send.

Why is a finding marked low confidence?

The generic-api-key rule matches any key = "long random value" assignment, so it finds real secrets that have no known format but also some false positives. Provider-specific rules are marked high.

Related APIs

Start with 1,000 free requests every month. Get free API key →