latestOpenAPI 3.0.3GitGuardian2026-08-201871515.0 MB

511b067cdcb1

Internal Secret Locations

List locations of a secret incident

List the files that still hold the secret of an incident, on the default branch of each source of your perimeter.

One location is one file of one source. It carries the position of every match of the secret in that file, so that you can point a developer at the exact lines to change. A location disappears once the secret is removed from the file. Locations are only computed for VCS sources.

get/v1/incidents/secrets/{incident_id}/locations

Path parameters

incident_idinteger required

The id of the incident to retrieve

Query parameters

cursorstring

Pagination cursor.

per_pageinteger

Number of items to list per page.

sourcestring
Example:5523,5524

Locations of the following source ids.

activeboolean

When true, only return the locations held by sources that GitGuardian currently monitors, that is sources that are not unmonitored, archived nor deleted, and that are not installed through a revoked installation. When false, only return the locations held by the other sources.

number_of_mentions_mininteger
Example:2

Locations mentioning the secret at least this number of times.

number_of_mentions_maxinteger
Example:10

Locations mentioning the secret at most this number of times.

code_fix_request_status'pending' | 'processing' | 'created' | 'error' | 'none'

Locations whose code fix request has the following status. Use none to filter locations without any code fix request.

searchstring
Example:settings.py

Locations whose filepath contains this value.

ordering'last_updated_at' | '-last_updated_at' | 'number_of_mentions' | '-number_of_mentions' | 'source' | '-source'

Sort the results by their field value. The default sort is ASC, DESC if the field is preceded by a '-'.

Response

Secret Incident Location List

idinteger
incident_idinteger

Id of the secret incident the location belongs to.

filepathstring

Path of the file in the source, on its default branch.

number_of_mentionsinteger

Number of times the secret is found in the file.

last_updated_atstring date-time

Date at which GitGuardian last computed this location.

branch_namestring

Default branch the location was computed on. Empty when the default branch of the source is unknown.

external_urlstring

URL of the file on the provider, on the branch of branch_name. GitGuardian builds this URL from the source and does not check it: the provider can answer 404 if the file, the branch or the source is gone. The branch segment of the URL is empty when branch_name is empty.

external_url_matches_highlightedstring

Same URL as external_url, with the lines of the first match highlighted.

Example response

[
  {
    "id": 4421,
    "incident_id": 3759,
    "filepath": "config/settings.py",
    "matches": [
      {
        "name": "apikey",
        "line_start": 12,
        "line_end": 12,
        "index_start": 320,
        "index_end": 352
      }
    ],
    "number_of_mentions": 2,
    "last_updated_at": "2021-05-20T12:40:55.662949Z",
    "source": {
      "id": 6531,
      "type": "github",
      "full_name": "gitguardian/gg-shield",
      "default_branch": "main",
      "visibility": "private"
    },
    "remediation_prs": [
      {
        "created_at": "2021-05-20T12:40:55.662949Z",
        "url": "https://github.com/GitGuardian/ggshield/pull/123",
        "branch_name": "gitguardian/remove-secret",
        "target_branch_name": "main",
        "status": "OPEN",
        "title": "Remove hardcoded GitGuardian token",
        "description": "Replaces the hardcoded token with an environment variable.",
        "last_actor_name": "Eric",
        "external_id": "123"
      }
    ],
    "branch_name": "main",
    "external_url": "https://github.com/GitGuardian/ggshield/blob/main/config/settings.py",
    "external_url_matches_highlighted": "https://github.com/GitGuardian/ggshield/blob/main/config/settings.py#L12"
  }
]