Secrets

Retrieve a secret value

Changed on

Retrieve the information, including its clear text value, of a secret by its ID.

Access requires the token to see at least one incident linked to the secret, private or public.

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 secrets:read scope. Service account tokens are refused.
get/v1/secrets/{secret_id}

Request

  • Base URL
    https://api.gitguardian.com
  • URL
    https://api.gitguardian.com/v1/secrets/{secret_id}
  • Auth
    HTTP bearer

Path parameters

secret_idinteger required

The ID of the secret to retrieve

Headers

X-Privacy-Mode'true' | 'false'

When set to true, sensitive values in the response are obfuscated (replaced with <GG>OBFUSCATED</GG>). Useful for sharing API responses without exposing sensitive data.

Response

Secret details

idinteger required

ID of the secret

matchesobject required

Matches of the secret

Example response

{
  "id": 37,
  "detector": {
    "name": "slack_bot_token",
    "display_name": "Slack Bot Token",
    "nature": "specific",
    "family": "token",
    "category": "messaging_system",
    "detector_group_name": "slackbot_token",
    "detector_group_display_name": "Slack Bot Token"
  },
  "matches": {
    "apikey": "sk-xxxxxxxxxxxxxxxx"
  }
}

Changes