latestOpenAPI 3.0.3GitGuardian2026-08-201871515.0 MB

511b067cdcb1

Internal Secret Locations
Sources

List locations of a source

List the files of a source that still hold a secret, on the default branch of the source.

One location is one file and one secret incident. 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/sources/{source_id}/locations

Path parameters

source_idinteger required
Example:5523

The id of the source to list the locations of.

Query parameters

cursorstring

Pagination cursor.

per_pageinteger

Number of items to list per page.

activeboolean

When true, only return locations if GitGuardian currently monitors the source, that is if the source is not unmonitored, archived, deleted, nor installed through a revoked installation. When false, only return them otherwise.

number_of_mentions_mininteger
Example:2

Locations mentioning their secret at least this number of times.

number_of_mentions_maxinteger
Example:10

Locations mentioning their 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

Source 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"
  }
]