Skip to main content
POST
/
api
/
analysis
/
results
/
secrets
Get Secrets Scan Results
curl --request POST \
  --url https://api.codeant.ai/api/analysis/results/secrets \
  --header 'Content-Type: application/json' \
  --data '
{
  "repo": "owner/repository",
  "commit_id": "abc123def456",
  "access_token": "ghp_xxxxxxxxxxxx",
  "service": "github"
}
'
import requests

url = "https://api.codeant.ai/api/analysis/results/secrets"

payload = {
"repo": "owner/repository",
"commit_id": "abc123def456",
"access_token": "ghp_xxxxxxxxxxxx",
"service": "github"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
repo: 'owner/repository',
commit_id: 'abc123def456',
access_token: 'ghp_xxxxxxxxxxxx',
service: 'github'
})
};

fetch('https://api.codeant.ai/api/analysis/results/secrets', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.codeant.ai/api/analysis/results/secrets",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'repo' => 'owner/repository',
'commit_id' => 'abc123def456',
'access_token' => 'ghp_xxxxxxxxxxxx',
'service' => 'github'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.codeant.ai/api/analysis/results/secrets"

payload := strings.NewReader("{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.codeant.ai/api/analysis/results/secrets")
.header("Content-Type", "application/json")
.body("{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.codeant.ai/api/analysis/results/secrets")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"repo\": \"owner/repository\",\n \"commit_id\": \"abc123def456\",\n \"access_token\": \"ghp_xxxxxxxxxxxx\",\n \"service\": \"github\"\n}"

response = http.request(request)
puts response.read_body
{
  "results": {
    "secrets": [
      {
        "type": "Secret Keyword",
        "filename": "/mnt/lambda/owner/repository/abc123def456/src/config.py",
        "hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
        "is_verified": false,
        "line_number": 14,
        "confidence_score": "FALSE_POSITIVE"
      }
    ],
    "secretsCount": 1
  },
  "status": "done",
  "commit_id": "abc123def456"
}
{
"error": "Access token invalid"
}
{
"error": "Error retrieving secrets scan results"
}

Body

application/json
repo
string
required

Repository identifier (format varies by service)

Example:

"owner/repository"

access_token
string
required

Authentication token for the service

Example:

"ghp_xxxxxxxxxxxx"

service
enum<string>
required

Version control service provider

Available options:
github,
azuredevops,
gitlab,
bitbucket
Example:

"github"

commit_id
string

Git commit SHA or identifier. Either commit_id or branch is required. If both are provided, commit_id takes precedence.

Example:

"abc123def456"

branch
string

Git branch name. When provided without commit_id, the service resolves the latest commit from scan history for this branch. Either commit_id or branch is required.

Example:

"main"

gitlab_base_url
string

Base URL for the service (optional for GitHub, required for GitLab)

Example:

"https://gitlab.com"

Response

Secrets scan results retrieved successfully

Secrets scanning response containing detected secrets and sensitive information

results
object

Secrets scanning results

status
enum<string>

Status of the secrets scan

Available options:
pending,
processing,
done,
failed
Example:

"done"

commit_id
string

Git commit SHA that was analyzed

Example:

"abc123def456"