Get the content of an occurrence
Changed onRetrieve the content GitGuardian stored for an occurrence, together with the position of each secret match inside it.
The content stays available after the commit that carried it is removed from the repository history: GitGuardian keeps its own copy of what it scanned and never fetches the file again from the version control system.
The content shows the secret in clear text, so a caller gets exactly what the same person gets in the dashboard: an account that restricts content access only serves the occurrence to a member of the global team, to a member of a team that owns the occurrence's source, or to the author of the occurrence.
Prerequisites:
- A Manager has turned on "Enable API endpoints to retrieve detected secrets and occurrence content in clear text" in the workspace settings, under Security. On SaaS, this setting also requires the IP allowlist to be enabled.
- A Personal Access Token (PAT) with the incidents:read and secrets:read scopes. Service account tokens are refused.
Request
- Base URLhttps://api.gitguardian.com
- URLhttps://api.gitguardian.com/v1/occurrences/secrets/{occurrence_id}/content
- AuthHTTP bearer
Path parameters
The ID of the occurrence
Response
The content stored for the occurrence.
Example response
{
"value": "@@ -1,2 +1,3 @@\n+api_key = 'my_secret_value'\n",
"matches": [
{
"name": "apikey",
"indice_start": 32,
"indice_end": 79,
"post_line_start": 1,
"post_line_end": 1
}
]
}Changes
- info
endpoint added
- info
- breaking
api path removed without deprecation
- breaking