latestOpenAPI 3.0.3GitGuardian2026-08-201871515.0 MB

511b067cdcb1

Scan Methods

Content scan

Scan provided document content for policy breaks.

Request body shouldn't exceed 1MB.

This endpoint is stateless and as such will not store in our servers neither the documents nor the secrets found.

post/v1/scan

Request body

filenamestring
documentstring required

Example request

{
  "filename": ".env",
  "document": "\nimport urllib.request\nurl = 'http://jen_barber:correcthorsebatterystaple@cake.gitguardian.com/isreal.json'\nresponse = urllib.request.urlopen(url)\nconsume(response.read())\n"
}

Response

Successful Scan

policy_break_countinteger required

Number of policy breaks on this document.

policiesstring[] required

Policies checked on this document.

is_diffboolean required

Indicates whether the document is a diff.

Example response

{
  "policy_break_count": 2,
  "policies": [
    "Filename",
    "File extensions",
    "Secrets detection"
  ],
  "policy_breaks": [
    {
      "type": ".env",
      "policy": "Filenames",
      "matches": [
        {
          "type": "filename",
          "match": ".env"
        }
      ]
    },
    {
      "type": "Basic Auth String",
      "policy": "Secrets detection",
      "validity": "cannot_check",
      "matches": [
        {
          "type": "username",
          "match": "jen_barber",
          "index_start": 52,
          "index_end": 61,
          "line_start": 2,
          "line_end": 2
        },
        {
          "type": "password",
          "match": "correcthorsebatterystaple",
          "index_start": 63,
          "index_end": 87,
          "line_start": 2,
          "line_end": 2
        },
        {
          "type": "host",
          "match": "cake.gitguardian.com",
          "index_start": 89,
          "index_end": 108,
          "line_start": 2,
          "line_end": 2
        }
      ]
    }
  ],
  "is_diff": true
}